本文整理汇总了PHP中DifferenceEngine::getOldid方法的典型用法代码示例。如果您正苦于以下问题:PHP DifferenceEngine::getOldid方法的具体用法?PHP DifferenceEngine::getOldid怎么用?PHP DifferenceEngine::getOldid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DifferenceEngine
的用法示例。
在下文中一共展示了DifferenceEngine::getOldid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extractRowInfo
//.........这里部分代码省略.........
$vals['sha1'] = wfBaseConvert($revision->getSha1(), 36, 16, 40);
} else {
$vals['sha1'] = '';
}
}
if ($this->fld_comment || $this->fld_parsedcomment) {
if ($revision->isDeleted(Revision::DELETED_COMMENT)) {
$vals['commenthidden'] = '';
} else {
$comment = $revision->getComment();
if ($this->fld_comment) {
$vals['comment'] = $comment;
}
if ($this->fld_parsedcomment) {
$vals['parsedcomment'] = Linker::formatComment($comment, $title);
}
}
}
if ($this->fld_tags) {
if ($row->ts_tags) {
$tags = explode(',', $row->ts_tags);
$this->getResult()->setIndexedTagName($tags, 'tag');
$vals['tags'] = $tags;
} else {
$vals['tags'] = array();
}
}
if (!is_null($this->token)) {
$tokenFunctions = $this->getTokenFunctions();
foreach ($this->token as $t) {
$val = call_user_func($tokenFunctions[$t], $title->getArticleID(), $title, $revision);
if ($val === false) {
$this->setWarning("Action '{$t}' is not allowed for the current user");
} else {
$vals[$t . 'token'] = $val;
}
}
}
$text = null;
global $wgParser;
if ($this->fld_content || !is_null($this->difftotext)) {
$text = $revision->getText();
// Expand templates after getting section content because
// template-added sections don't count and Parser::preprocess()
// will have less input
if ($this->section !== false) {
$text = $wgParser->getSection($text, $this->section, false);
if ($text === false) {
$this->dieUsage("There is no section {$this->section} in r" . $revision->getId(), 'nosuchsection');
}
}
}
if ($this->fld_content && !$revision->isDeleted(Revision::DELETED_TEXT)) {
if ($this->generateXML) {
$wgParser->startExternalParse($title, ParserOptions::newFromContext($this->getContext()), OT_PREPROCESS);
$dom = $wgParser->preprocessToDom($text);
if (is_callable(array($dom, 'saveXML'))) {
$xml = $dom->saveXML();
} else {
$xml = $dom->__toString();
}
$vals['parsetree'] = $xml;
}
if ($this->expandTemplates && !$this->parseContent) {
$text = $wgParser->preprocess($text, $title, ParserOptions::newFromContext($this->getContext()));
}
if ($this->parseContent) {
$text = $wgParser->parse($text, $title, ParserOptions::newFromContext($this->getContext()))->getText();
}
ApiResult::setContent($vals, $text);
} elseif ($this->fld_content) {
$vals['texthidden'] = '';
}
if (!is_null($this->diffto) || !is_null($this->difftotext)) {
global $wgAPIMaxUncachedDiffs;
static $n = 0;
// Number of uncached diffs we've had
if ($n < $wgAPIMaxUncachedDiffs) {
$vals['diff'] = array();
$context = new DerivativeContext($this->getContext());
$context->setTitle($title);
if (!is_null($this->difftotext)) {
$engine = new DifferenceEngine($context);
$engine->setText($text, $this->difftotext);
} else {
$engine = new DifferenceEngine($context, $revision->getID(), $this->diffto);
$vals['diff']['from'] = $engine->getOldid();
$vals['diff']['to'] = $engine->getNewid();
}
$difftext = $engine->getDiffBody();
ApiResult::setContent($vals['diff'], $difftext);
if (!$engine->wasCacheHit()) {
$n++;
}
} else {
$vals['diff']['notcached'] = '';
}
}
return $vals;
}
示例2: testGetOldid
public function testGetOldid()
{
$revs = self::$revisions;
$diffEngine = new DifferenceEngine($this->context, $revs[1], $revs[2], 2, true, false);
$this->assertEquals($revs[1], $diffEngine->getOldid(), 'diff get old id');
}