Removed $wgLinkCache, converted to a singleton. Removed obsolete cruft from LinkCache.php.
This commit is contained in:
parent
d77e1f4175
commit
f2a59db33f
18 changed files with 82 additions and 197 deletions
|
|
@ -66,9 +66,6 @@ $wgContLang
|
|||
$wgArticle
|
||||
Article object corresponding to $wgTitle.
|
||||
|
||||
$wgLinkCache
|
||||
LinkCache object.
|
||||
|
||||
$wgParser
|
||||
Parser object. Parser extensions register their
|
||||
hooks here.
|
||||
|
|
|
|||
|
|
@ -1453,7 +1453,6 @@ class Image
|
|||
* This is mostly copied from Title::getLinksTo()
|
||||
*/
|
||||
function getLinksTo( $options = '' ) {
|
||||
global $wgLinkCache;
|
||||
$fname = 'Image::getLinksTo';
|
||||
wfProfileIn( $fname );
|
||||
|
||||
|
|
@ -1462,6 +1461,7 @@ class Image
|
|||
} else {
|
||||
$db =& wfGetDB( DB_SLAVE );
|
||||
}
|
||||
$linkCache =& LinkCache::singleton();
|
||||
|
||||
extract( $db->tableNames( 'page', 'imagelinks' ) );
|
||||
$encName = $db->addQuotes( $this->name );
|
||||
|
|
@ -1472,7 +1472,7 @@ class Image
|
|||
if ( $db->numRows( $res ) ) {
|
||||
while ( $row = $db->fetchObject( $res ) ) {
|
||||
if ( $titleObj = Title::makeTitle( $row->page_namespace, $row->page_title ) ) {
|
||||
$wgLinkCache->addGoodLinkObj( $row->page_id, $titleObj );
|
||||
$linkCache->addGoodLinkObj( $row->page_id, $titleObj );
|
||||
$retVal[] = $titleObj;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,12 +45,21 @@ class LinkBatch {
|
|||
function setArray( $array ) {
|
||||
$this->data = $array;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do the query and add the results to a LinkCache object
|
||||
* Do the query and add the results to the LinkCache object
|
||||
* Return an array mapping PDBK to ID
|
||||
*/
|
||||
function execute( &$cache ) {
|
||||
function execute() {
|
||||
$linkCache =& LinkCache::singleton();
|
||||
$this->executeInto( $linkCache );
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the query and add the results to a given LinkCache object
|
||||
* Return an array mapping PDBK to ID
|
||||
*/
|
||||
function executeInto( &$cache ) {
|
||||
$fname = 'LinkBatch::execute';
|
||||
wfProfileIn( $fname );
|
||||
// Do query
|
||||
|
|
|
|||
|
|
@ -5,15 +5,6 @@
|
|||
* @subpackage Cache
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
# These are used in incrementalSetup()
|
||||
define ('LINKCACHE_GOOD', 0);
|
||||
define ('LINKCACHE_BAD', 1);
|
||||
define ('LINKCACHE_IMAGE', 2);
|
||||
define ('LINKCACHE_PAGE', 3);
|
||||
|
||||
/**
|
||||
* @package MediaWiki
|
||||
* @subpackage Cache
|
||||
|
|
@ -24,28 +15,30 @@ class LinkCache {
|
|||
/* private */ var $mClassVer = 3;
|
||||
|
||||
/* private */ var $mPageLinks;
|
||||
/* private */ var $mGoodLinks, $mBadLinks, $mActive;
|
||||
/* private */ var $mImageLinks, $mCategoryLinks;
|
||||
/* private */ var $mPreFilled, $mOldGoodLinks, $mOldBadLinks;
|
||||
/* private */ var $mGoodLinks, $mBadLinks;
|
||||
/* private */ var $mForUpdate;
|
||||
|
||||
/* private */ function getKey( $title ) {
|
||||
global $wgDBname;
|
||||
return $wgDBname.':lc:title:'.$title;
|
||||
/**
|
||||
* Get an instance of this class
|
||||
*/
|
||||
function &singleton() {
|
||||
static $instance;
|
||||
if ( !isset( $instance ) ) {
|
||||
$instance = new LinkCache;
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function LinkCache() {
|
||||
$this->mActive = true;
|
||||
$this->mPreFilled = false;
|
||||
$this->mForUpdate = false;
|
||||
$this->mPageLinks = array();
|
||||
$this->mGoodLinks = array();
|
||||
$this->mBadLinks = array();
|
||||
$this->mImageLinks = array();
|
||||
$this->mCategoryLinks = array();
|
||||
$this->mOldGoodLinks = array();
|
||||
$this->mOldBadLinks = array();
|
||||
$this->mOldPageLinks = array();
|
||||
}
|
||||
|
||||
/* private */ function getKey( $title ) {
|
||||
global $wgDBname;
|
||||
return $wgDBname.':lc:title:'.$title;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -68,37 +61,19 @@ class LinkCache {
|
|||
}
|
||||
|
||||
function addGoodLinkObj( $id, $title ) {
|
||||
if ( $this->mActive ) {
|
||||
$dbkey = $title->getPrefixedDbKey();
|
||||
$this->mGoodLinks[$dbkey] = $id;
|
||||
$this->mPageLinks[$dbkey] = $title;
|
||||
}
|
||||
$dbkey = $title->getPrefixedDbKey();
|
||||
$this->mGoodLinks[$dbkey] = $id;
|
||||
$this->mPageLinks[$dbkey] = $title;
|
||||
}
|
||||
|
||||
function addBadLinkObj( $title ) {
|
||||
$dbkey = $title->getPrefixedDbKey();
|
||||
if ( $this->mActive && ( ! $this->isBadLink( $dbkey ) ) ) {
|
||||
if ( ! $this->isBadLink( $dbkey ) ) {
|
||||
$this->mBadLinks[$dbkey] = 1;
|
||||
$this->mPageLinks[$dbkey] = $title;
|
||||
}
|
||||
}
|
||||
|
||||
function addImageLink( $title ) {
|
||||
if ( $this->mActive ) { $this->mImageLinks[$title] = 1; }
|
||||
}
|
||||
|
||||
function addImageLinkObj( $nt ) {
|
||||
if ( $this->mActive ) { $this->mImageLinks[$nt->getDBkey()] = 1; }
|
||||
}
|
||||
|
||||
function addCategoryLink( $title, $sortkey ) {
|
||||
if ( $this->mActive ) { $this->mCategoryLinks[$title] = $sortkey; }
|
||||
}
|
||||
|
||||
function addCategoryLinkObj( &$nt, $sortkey ) {
|
||||
$this->addCategoryLink( $nt->getDBkey(), $sortkey );
|
||||
}
|
||||
|
||||
function clearBadLink( $title ) {
|
||||
unset( $this->mBadLinks[$title] );
|
||||
$this->clearLink( $title );
|
||||
|
|
@ -110,17 +85,10 @@ class LinkCache {
|
|||
$wgMemc->delete( $this->getKey( $title ) );
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
function suspend() { $this->mActive = false; }
|
||||
/** @deprecated */
|
||||
function resume() { $this->mActive = true; }
|
||||
|
||||
function getPageLinks() { return $this->mPageLinks; }
|
||||
function getGoodLinks() { return $this->mGoodLinks; }
|
||||
function getBadLinks() { return array_keys( $this->mBadLinks ); }
|
||||
function getImageLinks() { return $this->mImageLinks; }
|
||||
function getCategoryLinks() { return $this->mCategoryLinks; }
|
||||
|
||||
|
||||
/**
|
||||
* Add a title to the link cache, return the page_id or zero if non-existent
|
||||
* @param string $title Title to add
|
||||
|
|
@ -198,60 +166,6 @@ class LinkCache {
|
|||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bulk-check the pagelinks and page arrays for existence info.
|
||||
* @param Title $fromtitle
|
||||
* @deprecated
|
||||
*/
|
||||
function preFill( &$fromtitle ) {
|
||||
global $wgAntiLockFlags;
|
||||
$fname = 'LinkCache::preFill';
|
||||
wfProfileIn( $fname );
|
||||
|
||||
$this->suspend();
|
||||
$id = $fromtitle->getArticleID();
|
||||
$this->resume();
|
||||
|
||||
if( $id == 0 ) {
|
||||
wfDebug( "$fname - got id 0 for title '" . $fromtitle->getPrefixedDBkey() . "'\n" );
|
||||
wfProfileOut( $fname );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $this->mForUpdate ) {
|
||||
$db =& wfGetDB( DB_MASTER );
|
||||
if ( !( $wgAntiLockFlags & ALF_NO_LINK_LOCK ) ) {
|
||||
$options = 'FOR UPDATE';
|
||||
} else {
|
||||
$options = '';
|
||||
}
|
||||
} else {
|
||||
$db =& wfGetDB( DB_SLAVE );
|
||||
$options = '';
|
||||
}
|
||||
|
||||
$page = $db->tableName( 'page' );
|
||||
$pagelinks = $db->tableName( 'pagelinks' );
|
||||
|
||||
$sql = "SELECT page_id,pl_namespace,pl_title
|
||||
FROM $pagelinks
|
||||
LEFT JOIN $page
|
||||
ON pl_namespace=page_namespace AND pl_title=page_title
|
||||
WHERE pl_from=$id $options";
|
||||
$res = $db->query( $sql, $fname );
|
||||
while( $s = $db->fetchObject( $res ) ) {
|
||||
$title = Title::makeTitle( $s->pl_namespace, $s->pl_title );
|
||||
if( $s->page_id ) {
|
||||
$this->addGoodLinkObj( $s->page_id, $title );
|
||||
} else {
|
||||
$this->addBadLinkObj( $title );
|
||||
}
|
||||
}
|
||||
$this->mPreFilled = true;
|
||||
|
||||
wfProfileOut( $fname );
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears cache
|
||||
*/
|
||||
|
|
@ -259,22 +173,6 @@ class LinkCache {
|
|||
$this->mPageLinks = array();
|
||||
$this->mGoodLinks = array();
|
||||
$this->mBadLinks = array();
|
||||
$this->mImageLinks = array();
|
||||
$this->mCategoryLinks = array();
|
||||
$this->mOldGoodLinks = array();
|
||||
$this->mOldBadLinks = array();
|
||||
$this->mOldPageLinks = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Swaps old and current link registers
|
||||
* @deprecated
|
||||
*/
|
||||
function swapRegisters() {
|
||||
swap( $this->mGoodLinks, $this->mOldGoodLinks );
|
||||
swap( $this->mBadLinks, $this->mOldBadLinks );
|
||||
swap( $this->mImageLinks, $this->mOldImageLinks );
|
||||
swap( $this->mPageLinks, $this->mOldPageLinks );
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -219,13 +219,13 @@ class OutputPage {
|
|||
* Add an array of categories, with names in the keys
|
||||
*/
|
||||
function addCategoryLinks($categories) {
|
||||
global $wgUser, $wgLinkCache, $wgContLang;
|
||||
global $wgUser, $wgContLang;
|
||||
|
||||
# Add the links to the link cache in a batch
|
||||
$arr = array( NS_CATEGORY => $categories );
|
||||
$lb = new LinkBatch;
|
||||
$lb->setArray( $arr );
|
||||
$lb->execute( $wgLinkCache );
|
||||
$lb->execute();
|
||||
|
||||
$sk =& $wgUser->getSkin();
|
||||
foreach ( $categories as $category => $arbitrary ) {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ define( 'EXT_IMAGE_REGEX',
|
|||
* performs brace substitution on MediaWiki messages
|
||||
*
|
||||
* Globals used:
|
||||
* objects: $wgLang, $wgLinkCache
|
||||
* objects: $wgLang
|
||||
*
|
||||
* NOT $wgArticle, $wgUser or $wgTitle. Keep them away!
|
||||
*
|
||||
|
|
@ -1222,7 +1222,7 @@ class Parser
|
|||
* @access private
|
||||
*/
|
||||
function replaceInternalLinks( $s ) {
|
||||
global $wgContLang, $wgLinkCache;
|
||||
global $wgContLang;
|
||||
static $fname = 'Parser::replaceInternalLinks' ;
|
||||
|
||||
wfProfileIn( $fname );
|
||||
|
|
@ -3328,7 +3328,7 @@ class Parser
|
|||
* $options is a bit field, RLH_FOR_UPDATE to select for update
|
||||
*/
|
||||
function replaceLinkHolders( &$text, $options = 0 ) {
|
||||
global $wgUser, $wgLinkCache;
|
||||
global $wgUser;
|
||||
global $wgOutputReplace;
|
||||
|
||||
$fname = 'Parser::replaceLinkHolders';
|
||||
|
|
@ -3336,7 +3336,8 @@ class Parser
|
|||
|
||||
$pdbks = array();
|
||||
$colours = array();
|
||||
$sk = $this->mOptions->getSkin();
|
||||
$sk =& $this->mOptions->getSkin();
|
||||
$linkCache =& LinkCache::singleton();
|
||||
|
||||
if ( !empty( $this->mLinkHolders['namespaces'] ) ) {
|
||||
wfProfileIn( $fname.'-check' );
|
||||
|
|
@ -3363,10 +3364,10 @@ class Parser
|
|||
# Check if it's a static known link, e.g. interwiki
|
||||
if ( $title->isAlwaysKnown() ) {
|
||||
$colours[$pdbk] = 1;
|
||||
} elseif ( ( $id = $wgLinkCache->getGoodLinkID( $pdbk ) ) != 0 ) {
|
||||
} elseif ( ( $id = $linkCache->getGoodLinkID( $pdbk ) ) != 0 ) {
|
||||
$colours[$pdbk] = 1;
|
||||
$this->mOutput->addLink( $title, $id );
|
||||
} elseif ( $wgLinkCache->isBadLink( $pdbk ) ) {
|
||||
} elseif ( $linkCache->isBadLink( $pdbk ) ) {
|
||||
$colours[$pdbk] = 0;
|
||||
} else {
|
||||
# Not in the link cache, add it to the query
|
||||
|
|
@ -3402,7 +3403,7 @@ class Parser
|
|||
while ( $s = $dbr->fetchObject($res) ) {
|
||||
$title = Title::makeTitle( $s->page_namespace, $s->page_title );
|
||||
$pdbk = $title->getPrefixedDBkey();
|
||||
$wgLinkCache->addGoodLinkObj( $s->page_id, $title );
|
||||
$linkCache->addGoodLinkObj( $s->page_id, $title );
|
||||
$this->mOutput->addLink( $title, $s->page_id );
|
||||
|
||||
if ( $threshold > 0 ) {
|
||||
|
|
@ -3427,7 +3428,7 @@ class Parser
|
|||
$searchkey = "<!--LINK $key-->";
|
||||
$title = $this->mLinkHolders['titles'][$key];
|
||||
if ( empty( $colours[$pdbk] ) ) {
|
||||
$wgLinkCache->addBadLinkObj( $title );
|
||||
$linkCache->addBadLinkObj( $title );
|
||||
$colours[$pdbk] = 0;
|
||||
$this->mOutput->addLink( $title, 0 );
|
||||
$wgOutputReplace[$searchkey] = $sk->makeBrokenLinkObj( $title,
|
||||
|
|
|
|||
|
|
@ -279,7 +279,6 @@ wfProfileIn( $fname.'-misc2' );
|
|||
$wgDeferredUpdateList = array();
|
||||
$wgPostCommitUpdateList = array();
|
||||
|
||||
$wgLinkCache = new LinkCache();
|
||||
$wgMagicWords = array();
|
||||
$wgMwRedir =& MagicWord::get( MAG_REDIRECT );
|
||||
$wgParserCache = new ParserCache( $messageMemc );
|
||||
|
|
|
|||
|
|
@ -1276,13 +1276,10 @@ END;
|
|||
}
|
||||
|
||||
function dateLink() {
|
||||
global $wgLinkCache;
|
||||
$t1 = Title::newFromText( gmdate( 'F j' ) );
|
||||
$t2 = Title::newFromText( gmdate( 'Y' ) );
|
||||
|
||||
$wgLinkCache->suspend();
|
||||
$id = $t1->getArticleID();
|
||||
$wgLinkCache->resume();
|
||||
|
||||
if ( 0 == $id ) {
|
||||
$s = $this->makeBrokenLink( $t1->getText() );
|
||||
|
|
@ -1291,9 +1288,7 @@ END;
|
|||
}
|
||||
$s .= ', ';
|
||||
|
||||
$wgLinkCache->suspend();
|
||||
$id = $t2->getArticleID();
|
||||
$wgLinkCache->resume();
|
||||
|
||||
if ( 0 == $id ) {
|
||||
$s .= $this->makeBrokenLink( $t2->getText() );
|
||||
|
|
@ -1304,7 +1299,7 @@ END;
|
|||
}
|
||||
|
||||
function talkLink() {
|
||||
global $wgTitle, $wgLinkCache;
|
||||
global $wgTitle;
|
||||
|
||||
if ( NS_SPECIAL == $wgTitle->getNamespace() ) {
|
||||
# No discussion links for special pages
|
||||
|
|
@ -1334,15 +1329,13 @@ END;
|
|||
$text = wfMsg( 'talkpage' );
|
||||
}
|
||||
|
||||
$wgLinkCache->suspend();
|
||||
$s = $this->makeLinkObj( $link, $text );
|
||||
$wgLinkCache->resume();
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
function commentLink() {
|
||||
global $wgContLang, $wgTitle, $wgLinkCache;
|
||||
global $wgContLang, $wgTitle;
|
||||
|
||||
if ( $wgTitle->getNamespace() == NS_SPECIAL ) {
|
||||
return '';
|
||||
|
|
|
|||
|
|
@ -197,8 +197,8 @@ class WikiRevision {
|
|||
}
|
||||
|
||||
// avoid memory leak...?
|
||||
global $wgLinkCache;
|
||||
$wgLinkCache->clear();
|
||||
$linkCache =& LinkCache::singleton();
|
||||
$linkCache->clear();
|
||||
|
||||
$article = new Article( $this->title );
|
||||
$pageId = $article->getId();
|
||||
|
|
|
|||
|
|
@ -57,13 +57,11 @@ class ListUsersPage extends QueryPage {
|
|||
* Fetch user page links and cache their existence
|
||||
*/
|
||||
function preprocessResults( &$db, &$res ) {
|
||||
global $wgLinkCache;
|
||||
|
||||
$batch = new LinkBatch;
|
||||
while ( $row = $db->fetchObject( $res ) ) {
|
||||
$batch->addObj( Title::makeTitleSafe( $row->namespace, $row->title ) );
|
||||
}
|
||||
$batch->execute( $wgLinkCache );
|
||||
$batch->execute();
|
||||
|
||||
// Back to start for display
|
||||
if( $db->numRows( $res ) > 0 ) {
|
||||
|
|
|
|||
|
|
@ -241,7 +241,6 @@ class LogViewer {
|
|||
* @return object database result set
|
||||
*/
|
||||
function getLogRows() {
|
||||
global $wgLinkCache;
|
||||
$result = $this->reader->getRows();
|
||||
$this->numResults = 0;
|
||||
|
||||
|
|
@ -260,7 +259,7 @@ class LogViewer {
|
|||
}
|
||||
++$this->numResults;
|
||||
}
|
||||
$batch->execute( $wgLinkCache );
|
||||
$batch->execute();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
@ -298,17 +297,18 @@ class LogViewer {
|
|||
* @private
|
||||
*/
|
||||
function logLine( $s ) {
|
||||
global $wgLang, $wgLinkCache;
|
||||
global $wgLang;
|
||||
$title = Title::makeTitle( $s->log_namespace, $s->log_title );
|
||||
$user = Title::makeTitleSafe( NS_USER, $s->user_name );
|
||||
$time = $wgLang->timeanddate( wfTimestamp(TS_MW, $s->log_timestamp), true );
|
||||
|
||||
// Enter the existence or non-existence of this page into the link cache,
|
||||
// for faster makeLinkObj() in LogPage::actionText()
|
||||
$linkCache =& LinkCache::singleton();
|
||||
if( $s->page_id ) {
|
||||
$wgLinkCache->addGoodLinkObj( $s->page_id, $title );
|
||||
$linkCache->addGoodLinkObj( $s->page_id, $title );
|
||||
} else {
|
||||
$wgLinkCache->addBadLinkObj( $title );
|
||||
$linkCache->addBadLinkObj( $title );
|
||||
}
|
||||
|
||||
$userLink = $this->skin->makeLinkObj( $user, htmlspecialchars( $s->user_name ) );
|
||||
|
|
|
|||
|
|
@ -45,12 +45,10 @@ class MostlinkedCategoriesPage extends QueryPage {
|
|||
* Fetch user page links and cache their existence
|
||||
*/
|
||||
function preprocessResults( &$db, &$res ) {
|
||||
global $wgLinkCache;
|
||||
|
||||
$batch = new LinkBatch;
|
||||
while ( $row = $db->fetchObject( $res ) )
|
||||
$batch->addObj( Title::makeTitleSafe( $row->namespace, $row->title ) );
|
||||
$batch->execute( $wgLinkCache );
|
||||
$batch->execute();
|
||||
|
||||
// Back to start for display
|
||||
if ( $db->numRows( $res ) > 0 )
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ require_once( 'Revision.php' );
|
|||
function wfSpecialRecentchanges( $par, $specialPage ) {
|
||||
global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol;
|
||||
global $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
|
||||
global $wgLinkCache;
|
||||
$fname = 'wfSpecialRecentchanges';
|
||||
|
||||
# Get query parameters
|
||||
|
|
@ -168,7 +167,7 @@ function wfSpecialRecentchanges( $par, $specialPage ) {
|
|||
# Web output...
|
||||
|
||||
// Run existence checks
|
||||
$batch->execute( $wgLinkCache );
|
||||
$batch->execute();
|
||||
|
||||
// Output header
|
||||
if ( !$specialPage->including() ) {
|
||||
|
|
|
|||
|
|
@ -47,12 +47,10 @@ class WantedCategoriesPage extends QueryPage {
|
|||
* Fetch user page links and cache their existence
|
||||
*/
|
||||
function preprocessResults( &$db, &$res ) {
|
||||
global $wgLinkCache;
|
||||
|
||||
$batch = new LinkBatch;
|
||||
while ( $row = $db->fetchObject( $res ) )
|
||||
$batch->addObj( Title::makeTitleSafe( $row->namespace, $row->title ) );
|
||||
$batch->execute( $wgLinkCache );
|
||||
$batch->execute();
|
||||
|
||||
// Back to start for display
|
||||
if ( $db->numRows( $res ) > 0 )
|
||||
|
|
|
|||
|
|
@ -53,12 +53,10 @@ class WantedPagesPage extends QueryPage {
|
|||
* Fetch user page links and cache their existence
|
||||
*/
|
||||
function preprocessResults( &$db, &$res ) {
|
||||
global $wgLinkCache;
|
||||
|
||||
$batch = new LinkBatch;
|
||||
while ( $row = $db->fetchObject( $res ) )
|
||||
$batch->addObj( Title::makeTitleSafe( $row->namespace, $row->title ) );
|
||||
$batch->execute( $wgLinkCache );
|
||||
$batch->execute();
|
||||
|
||||
// Back to start for display
|
||||
if ( $db->numRows( $res ) > 0 )
|
||||
|
|
|
|||
|
|
@ -1099,14 +1099,14 @@ class Title {
|
|||
* @access public
|
||||
*/
|
||||
function getArticleID( $flags = 0 ) {
|
||||
global $wgLinkCache;
|
||||
$linkCache =& LinkCache::singleton();
|
||||
if ( $flags & GAID_FOR_UPDATE ) {
|
||||
$oldUpdate = $wgLinkCache->forUpdate( true );
|
||||
$this->mArticleID = $wgLinkCache->addLinkObj( $this );
|
||||
$wgLinkCache->forUpdate( $oldUpdate );
|
||||
$oldUpdate = $linkCache->forUpdate( true );
|
||||
$this->mArticleID = $linkCache->addLinkObj( $this );
|
||||
$linkCache->forUpdate( $oldUpdate );
|
||||
} else {
|
||||
if ( -1 == $this->mArticleID ) {
|
||||
$this->mArticleID = $wgLinkCache->addLinkObj( $this );
|
||||
$this->mArticleID = $linkCache->addLinkObj( $this );
|
||||
}
|
||||
}
|
||||
return $this->mArticleID;
|
||||
|
|
@ -1125,7 +1125,7 @@ class Title {
|
|||
|
||||
/**
|
||||
* This clears some fields in this object, and clears any associated
|
||||
* keys in the "bad links" section of $wgLinkCache.
|
||||
* keys in the "bad links" section of the link cache.
|
||||
*
|
||||
* - This is called from Article::insertNewArticle() to allow
|
||||
* loading of the new page_id. It's also called from
|
||||
|
|
@ -1135,8 +1135,8 @@ class Title {
|
|||
* @access public
|
||||
*/
|
||||
function resetArticleID( $newid ) {
|
||||
global $wgLinkCache;
|
||||
$wgLinkCache->clearBadLink( $this->getPrefixedDBkey() );
|
||||
$linkCache =& LinkCache::singleton();
|
||||
$linkCache->clearBadLink( $this->getPrefixedDBkey() );
|
||||
|
||||
if ( 0 == $newid ) { $this->mArticleID = -1; }
|
||||
else { $this->mArticleID = $newid; }
|
||||
|
|
@ -1401,7 +1401,7 @@ class Title {
|
|||
* @access public
|
||||
*/
|
||||
function getLinksTo( $options = '', $table = 'pagelinks', $prefix = 'pl' ) {
|
||||
global $wgLinkCache;
|
||||
$linkCache =& LinkCache::singleton();
|
||||
$id = $this->getArticleID();
|
||||
|
||||
if ( $options ) {
|
||||
|
|
@ -1423,7 +1423,7 @@ class Title {
|
|||
if ( $db->numRows( $res ) ) {
|
||||
while ( $row = $db->fetchObject( $res ) ) {
|
||||
if ( $titleObj = Title::makeTitle( $row->page_namespace, $row->page_title ) ) {
|
||||
$wgLinkCache->addGoodLinkObj( $row->page_id, $titleObj );
|
||||
$linkCache->addGoodLinkObj( $row->page_id, $titleObj );
|
||||
$retVal[] = $titleObj;
|
||||
}
|
||||
}
|
||||
|
|
@ -1452,8 +1452,6 @@ class Title {
|
|||
* @access public
|
||||
*/
|
||||
function getBrokenLinksFrom( $options = '' ) {
|
||||
global $wgLinkCache;
|
||||
|
||||
if ( $options ) {
|
||||
$db =& wfGetDB( DB_MASTER );
|
||||
} else {
|
||||
|
|
@ -1642,7 +1640,7 @@ class Title {
|
|||
* @access private
|
||||
*/
|
||||
function moveOverExistingRedirect( &$nt, $reason = '' ) {
|
||||
global $wgUser, $wgLinkCache, $wgUseSquid, $wgMwRedir;
|
||||
global $wgUser, $wgUseSquid, $wgMwRedir;
|
||||
$fname = 'Title::moveOverExistingRedirect';
|
||||
$comment = wfMsgForContent( '1movedto2', $this->getPrefixedText(), $nt->getPrefixedText() );
|
||||
|
||||
|
|
@ -1655,6 +1653,7 @@ class Title {
|
|||
$newid = $nt->getArticleID();
|
||||
$oldid = $this->getArticleID();
|
||||
$dbw =& wfGetDB( DB_MASTER );
|
||||
$linkCache =& LinkCache::singleton();
|
||||
|
||||
# Delete the old redirect. We don't save it to history since
|
||||
# by definition if we've got here it's rather uninteresting.
|
||||
|
|
@ -1679,7 +1678,7 @@ class Title {
|
|||
/* WHERE */ array( 'page_id' => $oldid ),
|
||||
$fname
|
||||
);
|
||||
$wgLinkCache->clearLink( $nt->getPrefixedDBkey() );
|
||||
$linkCache->clearLink( $nt->getPrefixedDBkey() );
|
||||
|
||||
# Recreate the redirect, this time in the other direction.
|
||||
$redirectText = $wgMwRedir->getSynonym( 0 ) . ' [[' . $nt->getPrefixedText() . "]]\n";
|
||||
|
|
@ -1691,7 +1690,7 @@ class Title {
|
|||
'text' => $redirectText ) );
|
||||
$revid = $redirectRevision->insertOn( $dbw );
|
||||
$redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
|
||||
$wgLinkCache->clearLink( $this->getPrefixedDBkey() );
|
||||
$linkCache->clearLink( $this->getPrefixedDBkey() );
|
||||
|
||||
# Log the move
|
||||
$log = new LogPage( 'move' );
|
||||
|
|
@ -1722,7 +1721,7 @@ class Title {
|
|||
* @access private
|
||||
*/
|
||||
function moveToNewTitle( &$nt, &$newid, $reason = '' ) {
|
||||
global $wgUser, $wgLinkCache, $wgUseSquid;
|
||||
global $wgUser, $wgUseSquid;
|
||||
global $wgMwRedir;
|
||||
$fname = 'MovePageForm::moveToNewTitle';
|
||||
$comment = wfMsgForContent( '1movedto2', $this->getPrefixedText(), $nt->getPrefixedText() );
|
||||
|
|
@ -1734,8 +1733,8 @@ class Title {
|
|||
$oldid = $this->getArticleID();
|
||||
$dbw =& wfGetDB( DB_MASTER );
|
||||
$now = $dbw->timestamp();
|
||||
wfSeedRandom();
|
||||
$rand = wfRandom();
|
||||
$linkCache =& LinkCache::singleton();
|
||||
|
||||
# Save a null revision in the page's history notifying of the move
|
||||
$nullRevision = Revision::newNullRevision( $dbw, $oldid,
|
||||
|
|
@ -1755,7 +1754,7 @@ class Title {
|
|||
$fname
|
||||
);
|
||||
|
||||
$wgLinkCache->clearLink( $nt->getPrefixedDBkey() );
|
||||
$linkCache->clearLink( $nt->getPrefixedDBkey() );
|
||||
|
||||
# Insert redirect
|
||||
$redirectText = $wgMwRedir->getSynonym( 0 ) . ' [[' . $nt->getPrefixedText() . "]]\n";
|
||||
|
|
@ -1767,7 +1766,7 @@ class Title {
|
|||
'text' => $redirectText ) );
|
||||
$revid = $redirectRevision->insertOn( $dbw );
|
||||
$redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
|
||||
$wgLinkCache->clearLink( $this->getPrefixedDBkey() );
|
||||
$linkCache->clearLink( $this->getPrefixedDBkey() );
|
||||
|
||||
# Log the move
|
||||
$log = new LogPage( 'move' );
|
||||
|
|
|
|||
|
|
@ -193,8 +193,8 @@ class TitleCleanup extends FiveUpgrade {
|
|||
),
|
||||
array( 'page_id' => $row->page_id ),
|
||||
'cleanupTitles::moveInconsistentPage' );
|
||||
global $wgLinkCache;
|
||||
$wgLinkCache->clear();
|
||||
$linkCache =& LinkCache::singleton();
|
||||
$linkCache->clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,8 +193,6 @@ class DumpHTML {
|
|||
}
|
||||
|
||||
function doRedirects() {
|
||||
global $wgLinkCache;
|
||||
|
||||
print "Doing redirects...\n";
|
||||
$fname = 'DumpHTML::doRedirects';
|
||||
$this->setupGlobals();
|
||||
|
|
@ -357,8 +355,10 @@ class DumpHTML {
|
|||
|
||||
/** Reads the content of a title object, executes the skin and captures the result */
|
||||
function getArticleHTML( &$title ) {
|
||||
global $wgOut, $wgTitle, $wgArticle, $wgUser, $wgLinkCache;
|
||||
global $wgOut, $wgTitle, $wgArticle, $wgUser;
|
||||
|
||||
$linkCache =& LinkCache::singleton();
|
||||
$linkCache->clear();
|
||||
$wgTitle = $title;
|
||||
if ( is_null( $wgTitle ) ) {
|
||||
return false;
|
||||
|
|
@ -368,7 +368,6 @@ class DumpHTML {
|
|||
if ( $ns == NS_SPECIAL ) {
|
||||
$wgOut = new OutputPage;
|
||||
$wgOut->setParserOptions( new ParserOptions );
|
||||
$wgLinkCache = new LinkCache;
|
||||
SpecialPage::executePath( $wgTitle );
|
||||
} else {
|
||||
if ( $ns == NS_IMAGE ) {
|
||||
|
|
@ -384,7 +383,6 @@ class DumpHTML {
|
|||
} else {
|
||||
$wgOut = new OutputPage;
|
||||
$wgOut->setParserOptions( new ParserOptions );
|
||||
$wgLinkCache = new LinkCache;
|
||||
|
||||
$wgArticle->view();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue