extractRequestParams(); if(!isset($params['token'])) $this->dieUsageMsg(array('missingparam', 'token')); if(!isset($params['rcid'])) $this->dieUsageMsg(array('missingparam', 'rcid')); if(!$wgUser->matchEditToken($params['token'])) $this->dieUsageMsg(array('sessionfailure')); $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. ' ); } protected function getExamples() { return array( 'api.php?action=patrol&token=123abc&rcid=230672766' ); } public function getVersion() { return __CLASS__ . ': $Id: ApiPatrol.php 48122 2009-03-07 12:58:41Z catrope $'; } }