diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2014-12-27 15:41:37 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2014-12-31 11:43:28 +0100 |
commit | c1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch) | |
tree | 2b38796e738dd74cb42ecd9bfd151803108386bc /includes/api/ApiOptions.php | |
parent | b88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff) |
Update to MediaWiki 1.24.1
Diffstat (limited to 'includes/api/ApiOptions.php')
-rw-r--r-- | includes/api/ApiOptions.php | 51 |
1 files changed, 16 insertions, 35 deletions
diff --git a/includes/api/ApiOptions.php b/includes/api/ApiOptions.php index 7256066d..b01dc3e2 100644 --- a/includes/api/ApiOptions.php +++ b/includes/api/ApiOptions.php @@ -31,7 +31,6 @@ * @ingroup API */ class ApiOptions extends ApiBase { - /** * Changes preferences of the current user. */ @@ -99,6 +98,9 @@ class ApiOptions extends ApiBase { $validation = true; } break; + case 'special': + $validation = "cannot be set by this module"; + break; case 'unused': default: $validation = "not a valid preference"; @@ -133,10 +135,6 @@ class ApiOptions extends ApiBase { $optionKinds[] = 'all'; return array( - 'token' => array( - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => true - ), 'reset' => false, 'resetkinds' => array( ApiBase::PARAM_TYPE => $optionKinds, @@ -155,50 +153,32 @@ class ApiOptions extends ApiBase { ); } - public function getResultProperties() { - return array( - '' => array( - '*' => array( - ApiBase::PROP_TYPE => array( - 'success' - ) - ) - ) - ); - } - public function getParamDescription() { return array( - 'token' => 'An options token previously obtained through the action=tokens', 'reset' => 'Resets preferences to the site defaults', 'resetkinds' => 'List of types of options to reset when the "reset" option is set', - 'change' => 'List of changes, formatted name=value (e.g. skin=vector), value cannot contain pipe characters. If no value is given (not even an equals sign), e.g., optionname|otheroption|..., the option will be reset to its default value', + 'change' => array( 'List of changes, formatted name=value (e.g. skin=vector), ' . + 'value cannot contain pipe characters. If no value is given (not ', + 'even an equals sign), e.g., optionname|otheroption|..., the ' . + 'option will be reset to its default value' + ), 'optionname' => 'A name of a option which should have an optionvalue set', - 'optionvalue' => 'A value of the option specified by the optionname, can contain pipe characters', + 'optionvalue' => 'A value of the option specified by the optionname, ' . + 'can contain pipe characters', ); } public function getDescription() { return array( - 'Change preferences of the current user', + 'Change preferences of the current user.', 'Only options which are registered in core or in one of installed extensions,', - 'or as options with keys prefixed with \'userjs-\' (intended to be used by user scripts), can be set.' + 'or as options with keys prefixed with \'userjs-\' (intended to be used by user', + 'scripts), can be set.' ); } - public function getPossibleErrors() { - return array_merge( parent::getPossibleErrors(), array( - array( 'code' => 'notloggedin', 'info' => 'Anonymous users cannot change preferences' ), - array( 'code' => 'nochanges', 'info' => 'No changes were requested' ), - ) ); - } - public function needsToken() { - return true; - } - - public function getTokenSalt() { - return ''; + return 'csrf'; } public function getHelpUrls() { @@ -209,7 +189,8 @@ class ApiOptions extends ApiBase { return array( 'api.php?action=options&reset=&token=123ABC', 'api.php?action=options&change=skin=vector|hideminor=1&token=123ABC', - 'api.php?action=options&reset=&change=skin=monobook&optionname=nickname&optionvalue=[[User:Beau|Beau]]%20([[User_talk:Beau|talk]])&token=123ABC', + 'api.php?action=options&reset=&change=skin=monobook&optionname=nickname&' . + 'optionvalue=[[User:Beau|Beau]]%20([[User_talk:Beau|talk]])&token=123ABC', ); } } |