Exemple #1
0
 /**
  * Patrols the article or provides the reason the patrol failed.
  */
 public function execute()
 {
     $params = $this->extractRequestParams();
     $this->requireOnlyOneParameter($params, 'rcid', 'revid');
     if (isset($params['rcid'])) {
         $rc = RecentChange::newFromID($params['rcid']);
         if (!$rc) {
             $this->dieUsageMsg(array('nosuchrcid', $params['rcid']));
         }
     } else {
         $rev = Revision::newFromId($params['revid']);
         if (!$rev) {
             $this->dieUsageMsg(array('nosuchrevid', $params['revid']));
         }
         $rc = $rev->getRecentChange();
         if (!$rc) {
             $this->dieUsage('The revision ' . $params['revid'] . " can't be patrolled as it's too old", 'notpatrollable');
         }
     }
     $retval = $rc->doMarkPatrolled($this->getUser());
     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);
 }
Exemple #2
0
 /**
  * Patrols the article or provides the reason the patrol failed.
  */
 public function execute()
 {
     global $wgUser, $wgUseRCPatrol, $wgUseNPPatrol;
     $this->getMain()->requestWriteMode();
     $params = $this->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(current($retval));
     }
     $result = array('rcid' => $rc->getAttribute('rc_id'));
     ApiQueryBase::addTitleInfo($result, $rc->getTitle());
     $this->getResult()->addValue(null, $this->getModuleName(), $result);
 }
Exemple #3
0
 /**
  * Patrols the article or provides the reason the patrol failed.
  */
 public function execute()
 {
     $params = $this->extractRequestParams();
     $rc = RecentChange::newFromID($params['rcid']);
     if (!$rc instanceof RecentChange) {
         $this->dieUsageMsg(array('nosuchrcid', $params['rcid']));
     }
     $retval = $rc->doMarkPatrolled($this->getUser());
     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);
 }