Prevent mutually exclusive values
$this->mParams = $this->extractRequestParams();
$request = $this->getMain()->getRequest();
$this->mParams = $this->extractRequestParams();
$request = $this->getMain()->getRequest();
+
+ if ( isset( $this->mParams['watch'] ) && isset( $this->mParams['unwatch'] ) ) {
+ $this->dieUsageMsg( array( 'show' ) );
+ }
// Add the uploaded file to the params array
$this->mParams['file'] = $request->getFileName( 'file' );
// Add the uploaded file to the params array
$this->mParams['file'] = $request->getFileName( 'file' );
// No errors, no warnings: do the upload
$status = $this->mUpload->performUpload( $this->mParams['comment'],
$this->mParams['text'], $this->mParams['watch'], $wgUser );
// No errors, no warnings: do the upload
$status = $this->mUpload->performUpload( $this->mParams['comment'],
$this->mParams['text'], $this->mParams['watch'], $wgUser );
+
+ if ( $this->mParams['unwatch'] ) {
+ $wgUser->removeWatch( $file->getTitle() );
+ }
if ( !$status->isGood() ) {
$error = $status->getErrorsArray();
if ( !$status->isGood() ) {
$error = $status->getErrorsArray();
'text' => null,
'token' => null,
'watch' => false,
'text' => null,
'token' => null,
'watch' => false,
'ignorewarnings' => false,
'file' => null,
'url' => null,
'ignorewarnings' => false,
'file' => null,
'url' => null,
'comment' => 'Upload comment. Also used as the initial page text for new files if "text" is not specified',
'text' => 'Initial page text for new files',
'watch' => 'Watch the page',
'comment' => 'Upload comment. Also used as the initial page text for new files if "text" is not specified',
'text' => 'Initial page text for new files',
'watch' => 'Watch the page',
+ 'watch' => 'Unwatch the page',
'ignorewarnings' => 'Ignore any warnings',
'file' => 'File contents',
'url' => 'Url to fetch the file from',
'ignorewarnings' => 'Ignore any warnings',
'file' => 'File contents',
'url' => 'Url to fetch the file from',