本文整理汇总了PHP中RecentChange::newFromID方法的典型用法代码示例。如果您正苦于以下问题:PHP RecentChange::newFromID方法的具体用法?PHP RecentChange::newFromID怎么用?PHP RecentChange::newFromID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecentChange
的用法示例。
在下文中一共展示了RecentChange::newFromID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* 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);
}
示例2: execute
/**
* 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);
}
示例3: execute
/**
* 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);
}