Go to the documentation of this file.
40 if ( isset( $params[
'rcid'] ) ) {
43 $this->
dieWithError( [
'apierror-nosuchrcid', $params[
'rcid'] ] );
46 $store = MediaWikiServices::getInstance()->getRevisionStore();
47 $rev = $store->getRevisionById( $params[
'revid'] );
49 $this->
dieWithError( [
'apierror-nosuchrevid', $params[
'revid'] ] );
51 $rc = $store->getRecentChange( $rev );
53 $this->
dieWithError( [
'apierror-notpatrollable', $params[
'revid'] ] );
58 $tags = $params[
'tags'];
61 if ( !is_null( $tags ) ) {
63 if ( !$ableToTag->isOK() ) {
68 $retval = $rc->doMarkPatrolled( $user,
false, $tags );
74 $result = [
'rcid' => (int)$rc->getAttribute(
'rc_id' ) ];
108 'action=patrol&token=123ABC&rcid=230672766'
109 =>
'apihelp-patrol-example-rcid',
110 'action=patrol&token=123ABC&revid=230672766'
111 =>
'apihelp-patrol-example-revid',
116 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Patrol';
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
getHelpUrls()
Return links to more detailed help pages about the module.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
getExamplesMessages()
Returns usage examples for this module.
This abstract class implements many basic API functions, and is the base of all API classes.
isWriteMode()
Indicates whether this module requires write mode.
mustBePosted()
Indicates whether this module must be called with a POST request.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
needsToken()
Returns the token type this module requires in order to execute.
static newFromId( $rcid)
Obtain the recent change with a given rc_id value.
requireOnlyOneParameter( $params, $required)
Die if none or more than one of a certain set of parameters is set and not false.
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Allows user to patrol pages.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
errorArrayToStatus(array $errors, User $user=null)
Turn an array of message keys or key+param arrays into a Status.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
execute()
Patrols the article or provides the reason the patrol failed.