40 if ( isset( $params[
'rcid'] ) ) {
41 $rc = RecentChange::newFromId( $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' ) ];
75 ApiQueryBase::addTitleInfo( $result, $rc->getTitle() );
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';
This abstract class implements many basic API functions, and is the base of all API classes.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
errorArrayToStatus(array $errors, User $user=null)
Turn an array of message keys or key+param arrays into a Status.
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.
requireOnlyOneParameter( $params, $required)
Die if none or more than one of a certain set of parameters is set and not false.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
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.