34 private $revisionStore;
46 parent::__construct( $main, $action );
47 $this->revisionStore = $revisionStore;
57 if ( isset( $params[
'rcid'] ) ) {
58 $rc = RecentChange::newFromId( $params[
'rcid'] );
60 $this->
dieWithError( [
'apierror-nosuchrcid', $params[
'rcid'] ] );
63 $rev = $this->revisionStore->getRevisionById( $params[
'revid'] );
65 $this->
dieWithError( [
'apierror-nosuchrevid', $params[
'revid'] ] );
67 $rc = $this->revisionStore->getRecentChange( $rev );
69 $this->
dieWithError( [
'apierror-notpatrollable', $params[
'revid'] ] );
74 $tags = $params[
'tags'];
77 if ( $tags !==
null ) {
79 if ( !$ableToTag->isOK() ) {
84 $retval = $rc->doMarkPatrolled( $user,
false, $tags );
90 $result = [
'rcid' => (int)$rc->getAttribute(
'rc_id' ) ];
91 ApiQueryBase::addTitleInfo( $result, $rc->getTitle() );
106 ParamValidator::PARAM_TYPE =>
'integer'
109 ParamValidator::PARAM_TYPE =>
'integer'
112 ParamValidator::PARAM_TYPE =>
'tags',
113 ParamValidator::PARAM_ISMULTI =>
true,
124 'action=patrol&token=123ABC&rcid=230672766'
125 =>
'apihelp-patrol-example-rcid',
126 'action=patrol&token=123ABC&revid=230672766'
127 =>
'apihelp-patrol-example-revid',
132 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Patrol';
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.
errorArrayToStatus(array $errors, User $user=null)
Turn an array of message keys or key+param arrays into a Status.
requireOnlyOneParameter( $params,... $required)
Die if none or more than one of a certain set of parameters is set and not false.
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.
This is the main API class, used for both external and internal processing.
Allows user to patrol pages.
isWriteMode()
Indicates whether this module requires write mode.
execute()
Patrols the article or provides the reason the patrol failed.
needsToken()
Returns the token type this module requires in order to execute.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getHelpUrls()
Return links to more detailed help pages about the module.
getExamplesMessages()
Returns usage examples for this module.
mustBePosted()
Indicates whether this module must be called with a POST request.
__construct(ApiMain $main, $action, RevisionStore $revisionStore)