35 if ( $params[
'operation'] !==
'delete'
36 && !$authority->isAllowed(
'managechangetags' )
38 $this->
dieWithError(
'tags-manage-no-permission',
'permissiondenied' );
39 } elseif ( !$authority->isAllowed(
'deletechangetags' ) ) {
40 $this->
dieWithError(
'tags-delete-no-permission',
'permissiondenied' );
44 if ( $params[
'tags'] ) {
46 if ( !$ableToTag->isOK() ) {
52 $tag = $params[
'tag'];
53 $reason = $params[
'reason'];
54 $ignoreWarnings = $params[
'ignorewarnings'];
55 $tags = $params[
'tags'] ?: [];
56 switch ( $params[
'operation'] ) {
71 throw new UnexpectedValueException(
'invalid operation' );
73 if ( !$status->isOK() ) {
78 'operation' => $params[
'operation'],
79 'tag' => $params[
'tag'],
81 if ( !$status->isGood() ) {
82 $ret[
'warnings'] = $this->
getErrorFormatter()->arrayFromStatus( $status,
'warning' );
84 $ret[
'success'] = $status->value !==
null;
85 if ( $ret[
'success'] ) {
86 $ret[
'logid'] = $status->value;
103 ParamValidator::PARAM_TYPE => [
'create',
'delete',
'activate',
'deactivate' ],
104 ParamValidator::PARAM_REQUIRED =>
true,
108 ParamValidator::PARAM_TYPE =>
'string',
109 ParamValidator::PARAM_REQUIRED =>
true,
112 ParamValidator::PARAM_TYPE =>
'string',
113 ParamValidator::PARAM_DEFAULT =>
'',
115 'ignorewarnings' => [
116 ParamValidator::PARAM_TYPE =>
'boolean',
117 ParamValidator::PARAM_DEFAULT =>
false,
120 ParamValidator::PARAM_TYPE =>
'tags',
121 ParamValidator::PARAM_ISMULTI =>
true,
132 'action=managetags&operation=create&tag=spam&reason=For+use+in+edit+patrolling&token=123ABC'
133 =>
'apihelp-managetags-example-create',
134 'action=managetags&operation=delete&tag=vandlaism&reason=Misspelt&token=123ABC'
135 =>
'apihelp-managetags-example-delete',
136 'action=managetags&operation=activate&tag=spam&reason=For+use+in+edit+patrolling&token=123ABC'
137 =>
'apihelp-managetags-example-activate',
138 'action=managetags&operation=deactivate&tag=spam&reason=No+longer+required&token=123ABC'
139 =>
'apihelp-managetags-example-deactivate',
144 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Tag_management';
This abstract class implements many basic API functions, and is the base of all API classes.
dieWithError( $msg, $code=null, $data=null, $httpCode=0)
Abort execution with an error.
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getModuleName()
Get the name of the module being executed by this instance.
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.