33 if ( $params[
'operation'] !==
'delete'
34 && !$this->
getAuthority()->isAllowed(
'managechangetags' )
36 $this->
dieWithError(
'tags-manage-no-permission',
'permissiondenied' );
37 } elseif ( !$this->
getAuthority()->isAllowed(
'deletechangetags' ) ) {
38 $this->
dieWithError(
'tags-delete-no-permission',
'permissiondenied' );
42 if ( $params[
'tags'] ) {
44 if ( !$ableToTag->isOK() ) {
50 $tag = $params[
'tag'];
51 $reason = $params[
'reason'];
52 $ignoreWarnings = $params[
'ignorewarnings'];
53 $tags = $params[
'tags'] ?: [];
54 switch ( $params[
'operation'] ) {
69 throw new \UnexpectedValueException(
'invalid operation' );
71 if ( !$status->isOK() ) {
76 'operation' => $params[
'operation'],
77 'tag' => $params[
'tag'],
79 if ( !$status->isGood() ) {
80 $ret[
'warnings'] = $this->
getErrorFormatter()->arrayFromStatus( $status,
'warning' );
82 $ret[
'success'] = $status->value !==
null;
83 if ( $ret[
'success'] ) {
84 $ret[
'logid'] = $status->value;
111 'ignorewarnings' => [
128 'action=managetags&operation=create&tag=spam&reason=For+use+in+edit+patrolling&token=123ABC'
129 =>
'apihelp-managetags-example-create',
130 'action=managetags&operation=delete&tag=vandlaism&reason=Misspelt&token=123ABC'
131 =>
'apihelp-managetags-example-delete',
132 'action=managetags&operation=activate&tag=spam&reason=For+use+in+edit+patrolling&token=123ABC'
133 =>
'apihelp-managetags-example-activate',
134 'action=managetags&operation=deactivate&tag=spam&reason=No+longer+required&token=123ABC'
135 =>
'apihelp-managetags-example-deactivate',
140 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.
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.