本文整理匯總了PHP中LinkCache::clear方法的典型用法代碼示例。如果您正苦於以下問題:PHP LinkCache::clear方法的具體用法?PHP LinkCache::clear怎麽用?PHP LinkCache::clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類LinkCache
的用法示例。
在下文中一共展示了LinkCache::clear方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: runParser
/**
* Parse the text from a given Revision
*
* @param Revision $revision
*/
function runParser(Revision $revision)
{
$content = $revision->getContent();
$content->getParserOutput($revision->getTitle(), $revision->getId());
if ($this->clearLinkCache) {
$this->linkCache->clear();
}
}
示例2: showArticle
/**
* After we've either updated or inserted the article, update
* the link tables and redirect to the new page.
*/
function showArticle($text, $subtitle, $sectionanchor = '')
{
global $wgUseDumbLinkUpdate, $wgAntiLockFlags, $wgOut, $wgUser, $wgLinkCache, $wgEnotif;
global $wgUseEnotif;
$fname = 'Article::showArticle';
wfProfileIn($fname);
$wgLinkCache = new LinkCache();
if (!$wgUseDumbLinkUpdate) {
# Preload links to reduce lock time
if ($wgAntiLockFlags & ALF_PRELOAD_LINKS) {
$wgLinkCache->preFill($this->mTitle);
$wgLinkCache->clear();
}
}
# Parse the text and replace links with placeholders
$wgOut = new OutputPage();
# Pass the current title along in case we're creating a wiki page
# which is different than the currently displayed one (e.g. image
# pages created on file uploads); otherwise, link updates will
# go wrong.
$wgOut->addWikiTextWithTitle($text, $this->mTitle);
if (!$wgUseDumbLinkUpdate) {
# Move the current links back to the second register
$wgLinkCache->swapRegisters();
# Get old version of link table to allow incremental link updates
# Lock this data now since it is needed for an update
$wgLinkCache->forUpdate(true);
$wgLinkCache->preFill($this->mTitle);
# Swap this old version back into its rightful place
$wgLinkCache->swapRegisters();
}
if ($this->isRedirect($text)) {
$r = 'redirect=no';
} else {
$r = '';
}
$wgOut->redirect($this->mTitle->getFullURL($r) . $sectionanchor);
wfProfileOut($fname);
}