本文整理汇总了PHP中LinksUpdate::setRecursiveTouch方法的典型用法代码示例。如果您正苦于以下问题:PHP LinksUpdate::setRecursiveTouch方法的具体用法?PHP LinksUpdate::setRecursiveTouch怎么用?PHP LinksUpdate::setRecursiveTouch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinksUpdate
的用法示例。
在下文中一共展示了LinksUpdate::setRecursiveTouch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editUpdates
/**
* Do standard deferred updates after page edit.
* Update links tables, site stats, search index and message cache.
* Purges pages that include this page if the text was changed here.
* Every 100th edit, prune the recent changes table.
*
* @private
* @param $text New text of the article
* @param $summary Edit summary
* @param $minoredit Minor edit
* @param $timestamp_of_pagechange Timestamp associated with the page change
* @param $newid rev_id value of the new revision
* @param $changed Whether or not the content actually changed
*/
public function editUpdates($text, $summary, $minoredit, $timestamp_of_pagechange, $newid, $changed = true)
{
global $wgDeferredUpdateList, $wgMessageCache, $wgUser, $wgParser, $wgEnableParserCache;
wfProfileIn(__METHOD__);
# Parse the text
# Be careful not to double-PST: $text is usually already PST-ed once
if (!$this->mPreparedEdit || $this->mPreparedEdit->output->getFlag('vary-revision')) {
wfDebug(__METHOD__ . ": No prepared edit or vary-revision is set...\n");
$editInfo = $this->prepareTextForEdit($text, $newid);
} else {
wfDebug(__METHOD__ . ": No vary-revision, using prepared edit...\n");
$editInfo = $this->mPreparedEdit;
}
# Save it to the parser cache
if ($wgEnableParserCache) {
$parserCache = ParserCache::singleton();
$parserCache->save($editInfo->output, $this, $wgUser);
}
# Update the links tables
$u = new LinksUpdate($this->mTitle, $editInfo->output, false);
$u->setRecursiveTouch($changed);
// refresh/invalidate including pages too
$u->doUpdate();
wfRunHooks('ArticleEditUpdates', array(&$this, &$editInfo, $changed));
if (wfRunHooks('ArticleEditUpdatesDeleteFromRecentchanges', array(&$this))) {
if (0 == mt_rand(0, 99)) {
// Flush old entries from the `recentchanges` table; we do this on
// random requests so as to avoid an increase in writes for no good reason
global $wgRCMaxAge;
$dbw = wfGetDB(DB_MASTER);
$cutoff = $dbw->timestamp(time() - $wgRCMaxAge);
$recentchanges = $dbw->tableName('recentchanges');
$sql = "DELETE FROM {$recentchanges} WHERE rc_timestamp < '{$cutoff}'";
$dbw->query($sql);
}
}
$id = $this->getID();
$title = $this->mTitle->getPrefixedDBkey();
$shortTitle = $this->mTitle->getDBkey();
if (0 == $id) {
wfProfileOut(__METHOD__);
return;
}
$u = new SiteStatsUpdate(0, 1, $this->mGoodAdjustment, $this->mTotalAdjustment);
array_push($wgDeferredUpdateList, $u);
$u = new SearchUpdate($id, $title, $text);
array_push($wgDeferredUpdateList, $u);
# If this is another user's talk page, update newtalk
# Don't do this if $changed = false otherwise some idiot can null-edit a
# load of user talk pages and piss people off, nor if it's a minor edit
# by a properly-flagged bot.
if ($this->mTitle->getNamespace() == NS_USER_TALK && $shortTitle != $wgUser->getTitleKey() && $changed && !($minoredit && $wgUser->isAllowed('nominornewtalk'))) {
if (wfRunHooks('ArticleEditUpdateNewTalk', array(&$this))) {
$other = User::newFromName($shortTitle, false);
if (!$other) {
wfDebug(__METHOD__ . ": invalid username\n");
} elseif (User::isIP($shortTitle)) {
// An anonymous user
$other->setNewtalk(true);
} elseif ($other->isLoggedIn()) {
$other->setNewtalk(true);
} else {
wfDebug(__METHOD__ . ": don't need to notify a nonexistent user\n");
}
}
}
if ($this->mTitle->getNamespace() == NS_MEDIAWIKI) {
$wgMessageCache->replace($shortTitle, $text);
}
wfProfileOut(__METHOD__);
}