extractRequestParams(); if ( !isset( $params['rcid'] ) ) $this->dieUsageMsg( array( 'missingparam', 'rcid' ) ); $rc = RecentChange::newFromID( $params['rcid'] ); if ( !$rc instanceof RecentChange ) $this->dieUsageMsg( array( 'nosuchrcid', $params['rcid'] ) ); $retval = RecentChange::markPatrolled( $params['rcid'] ); if ( $retval ) $this->dieUsageMsg( reset( $retval ) ); $result = array( 'rcid' => intval( $rc->getAttribute( 'rc_id' ) ) ); ApiQueryBase::addTitleInfo( $result, $rc->getTitle() ); $this->getResult()->addValue( null, $this->getModuleName(), $result ); } public function isWriteMode() { return true; } public function getAllowedParams() { return array ( 'token' => null, 'rcid' => array( ApiBase :: PARAM_TYPE => 'integer' ), ); } public function getParamDescription() { return array ( 'token' => 'Patrol token obtained from list=recentchanges', 'rcid' => 'Recentchanges ID to patrol', ); } public function getDescription() { return array ( 'Patrol a page or revision. ' ); } public function getPossibleErrors() { return array_merge( parent::getPossibleErrors(), array( array( 'missingparam', 'rcid' ), array( 'nosuchrcid', 'rcid' ), ) ); } public function getTokenSalt() { return ''; } protected function getExamples() { return array( 'api.php?action=patrol&token=123abc&rcid=230672766' ); } public function getVersion() { return __CLASS__ . ': $Id: ApiPatrol.php 69578 2010-07-20 02:46:20Z tstarling $'; } }