32 parent::__construct( $main, $action );
42 if ( isset( $params[
'rcid'] ) ) {
43 $rc = $this->recentChangeLookup->getRecentChangeById( $params[
'rcid'] );
45 $this->
dieWithError( [
'apierror-nosuchrcid', $params[
'rcid'] ] );
48 $rev = $this->revisionStore->getRevisionById( $params[
'revid'] );
50 $this->
dieWithError( [
'apierror-nosuchrevid', $params[
'revid'] ] );
52 $rc = $this->revisionStore->getRecentChange( $rev );
54 $this->
dieWithError( [
'apierror-notpatrollable', $params[
'revid'] ] );
59 $tags = $params[
'tags'];
62 if ( $tags !==
null ) {
63 $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $tags, $this->
getAuthority() );
64 if ( !$ableToTag->isOK() ) {
69 $status = $this->patrolManager->markPatrolled( $rc, $user, $tags );
71 if ( !$status->isGood() ) {
75 $result = [
'rcid' => (int)$rc->getAttribute(
'rc_id' ) ];
94 ParamValidator::PARAM_TYPE =>
'integer'
97 ParamValidator::PARAM_TYPE =>
'integer'
100 ParamValidator::PARAM_TYPE =>
'tags',
101 ParamValidator::PARAM_ISMULTI =>
true,
114 'action=patrol&token=123ABC&rcid=230672766'
115 =>
'apihelp-patrol-example-rcid',
116 'action=patrol&token=123ABC&revid=230672766'
117 =>
'apihelp-patrol-example-revid',
123 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Patrol';
128class_alias( ApiPatrol::class,
'ApiPatrol' );
This is the main API class, used for both external and internal processing.