else
$reqArr['wpSection'] = '';
- if($params['watch'])
- $watch = true;
- else if($params['unwatch'])
- $watch = false;
- else if($titleObj->userIsWatching())
- $watch = true;
- else if($wgUser->getOption('watchdefault'))
- $watch = true;
- else if($wgUser->getOption('watchcreations') && !$titleObj->exists())
+ // Handle watchlist settings
+ switch ($params['watchlist'])
+ {
+ case 'watch':
+ $watch = true;
+ break;
+ case 'unwatch':
+ $watch = false;
+ break;
+ case 'preferences':
+ if ($titleObj->exists())
+ $watch = $wgUser->getOption('watchdefault');
+ else
+ $watch = $wgUser->getOption('watchcreations');
+ break;
+ case 'nochange':
+ default:
+ $watch = $titleObj->userIsWatching();
+ }
+ // Deprecated parameters
+ if ($params['watch'])
+ {
$watch = true;
- else
+ $this->setWarning('The watch parameter has been deprecated.');
+ }
+ elseif ($params['unwatch'])
+ {
$watch = false;
+ $this->setWarning('The unwatch parameter has been deprecated.');
+ }
+
if($watch)
$reqArr['wpWatchthis'] = '';
'captchaid' => null,
'watch' => false,
'unwatch' => false,
+ 'watchlist' => array(
+ ApiBase :: PARAM_DFLT => 'preferences',
+ ApiBase :: PARAM_TYPE => array(
+ 'watch',
+ 'unwatch',
+ 'preferences',
+ 'nochange'
+ ),
+ ),
'md5' => null,
'prependtext' => null,
'appendtext' => null,
'recreate' => 'Override any errors about the article having been deleted in the meantime',
'createonly' => 'Don\'t edit the page if it exists already',
'nocreate' => 'Throw an error if the page doesn\'t exist',
- 'watch' => 'Add the page to your watchlist',
- 'unwatch' => 'Remove the page from your watchlist',
+ 'watch' => 'DEPRECATED! Add the page to your watchlist',
+ 'unwatch' => 'DEPRECATED! Remove the page from your watchlist',
+ 'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
'captchaid' => 'CAPTCHA ID from previous request',
'captchaword' => 'Answer to the CAPTCHA',
'md5' => array( 'The MD5 hash of the text parameter, or the prependtext and appendtext parameters concatenated.',