Kill a bunch of '=&' references for LinkCache, ParserCache, and MimeMagic singletons.

This is an old PHP 4-ism; only needed today if you want to be able to replace the singleton with another object by using the reference as an lval. :)
Killing them because they annoy me.
This commit is contained in:
Brion Vibber 2008-04-09 18:23:34 +00:00
parent 355c0103a0
commit 784d10e4d3
13 changed files with 28 additions and 28 deletions

View file

@ -303,7 +303,7 @@ class Article {
$data = $this->pageDataFromId( $dbr, $this->getId() );
}
$lc =& LinkCache::singleton();
$lc = LinkCache::singleton();
if ( $data ) {
$lc->addGoodLinkObj( $data->page_id, $this->mTitle, $data->page_len, $data->page_is_redirect );
@ -618,7 +618,7 @@ class Article {
wfProfileIn( __METHOD__ );
$parserCache =& ParserCache::singleton();
$parserCache = ParserCache::singleton();
$ns = $this->mTitle->getNamespace(); # shortcut
# Get variables from query string
@ -2595,7 +2595,7 @@ class Article {
# Save it to the parser cache
if ( $wgEnableParserCache ) {
$parserCache =& ParserCache::singleton();
$parserCache = ParserCache::singleton();
$parserCache->save( $editInfo->output, $this, $wgUser );
}
@ -3294,7 +3294,7 @@ class Article {
$popts->setTidy(false);
$popts->enableLimitReport( false );
if ( $wgEnableParserCache && $cache && $this && $parserOutput->getCacheTime() != -1 ) {
$parserCache =& ParserCache::singleton();
$parserCache = ParserCache::singleton();
$parserCache->save( $parserOutput, $this, $wgUser );
}

View file

@ -64,7 +64,7 @@ class LinkBatch {
* Return an array mapping PDBK to ID
*/
public function execute() {
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
return $this->executeInto( $linkCache );
}

View file

@ -458,7 +458,7 @@ class OutputPage {
$popts, true, true, $this->mRevisionId );
$popts->setTidy(false);
if ( $cache && $article && $parserOutput->getCacheTime() != -1 ) {
$parserCache =& ParserCache::singleton();
$parserCache = ParserCache::singleton();
$parserCache->save( $parserOutput, $article, $wgUser );
}
@ -518,7 +518,7 @@ class OutputPage {
* @return bool True if successful, else false.
*/
public function tryParserCache( &$article, $user ) {
$parserCache =& ParserCache::singleton();
$parserCache = ParserCache::singleton();
$parserOutput = $parserCache->get( $article, $user );
if ( $parserOutput !== false ) {
$this->addParserOutput( $parserOutput );

View file

@ -978,7 +978,7 @@ class Parser
$text = $this->doDoubleUnderscore( $text );
$text = $this->doHeadings( $text );
if($this->mOptions->getUseDynamicDates()) {
$df =& DateFormatter::getInstance();
$df = DateFormatter::getInstance();
$text = $df->reformat( $this->mOptions->getDateFormat(), $text );
}
$text = $this->doAllQuotes( $text );
@ -2737,7 +2737,7 @@ class Parser
# SUBST
wfProfileIn( __METHOD__.'-modifiers' );
if ( !$found ) {
$mwSubst =& MagicWord::get( 'subst' );
$mwSubst = MagicWord::get( 'subst' );
if ( $mwSubst->matchStartAndRemove( $part1 ) xor $this->ot['wiki'] ) {
# One of two possibilities is true:
# 1) Found SUBST but not in the PST phase
@ -2763,17 +2763,17 @@ class Parser
# MSG, MSGNW and RAW
if ( !$found ) {
# Check for MSGNW:
$mwMsgnw =& MagicWord::get( 'msgnw' );
$mwMsgnw = MagicWord::get( 'msgnw' );
if ( $mwMsgnw->matchStartAndRemove( $part1 ) ) {
$nowiki = true;
} else {
# Remove obsolete MSG:
$mwMsg =& MagicWord::get( 'msg' );
$mwMsg = MagicWord::get( 'msg' );
$mwMsg->matchStartAndRemove( $part1 );
}
# Check for RAW:
$mwRaw =& MagicWord::get( 'raw' );
$mwRaw = MagicWord::get( 'raw' );
if ( $mwRaw->matchStartAndRemove( $part1 ) ) {
$forceRawInterwiki = true;
}
@ -3964,7 +3964,7 @@ class Parser
$colours = array();
$linkcolour_ids = array();
$sk = $this->mOptions->getSkin();
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
if ( !empty( $this->mLinkHolders['namespaces'] ) ) {
wfProfileIn( $fname.'-check' );

View file

@ -4081,7 +4081,7 @@ class Parser_OldPP
$pdbks = array();
$colours = array();
$sk = $this->mOptions->getSkin();
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
if ( !empty( $this->mLinkHolders['namespaces'] ) ) {
wfProfileIn( $fname.'-check' );

View file

@ -17,7 +17,7 @@ class RefreshLinksJob extends Job {
global $wgParser;
wfProfileIn( __METHOD__ );
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
$linkCache->clear();
if ( is_null( $this->title ) ) {

View file

@ -358,7 +358,7 @@ class WikiRevision {
}
// avoid memory leak...?
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
$linkCache->clear();
$article = new Article( $this->title );

View file

@ -1246,8 +1246,8 @@ wgUploadAutoFill = {$autofill};
*/
function verify( $tmpfile, $extension ) {
#magically determine mime type
$magic=& MimeMagic::singleton();
$mime= $magic->guessMimeType($tmpfile,false);
$magic = MimeMagic::singleton();
$mime = $magic->guessMimeType($tmpfile,false);
#check mime type, if desired
global $wgVerifyMimeType;
@ -1292,7 +1292,7 @@ wgUploadAutoFill = {$autofill};
* @return bool
*/
function verifyExtension( $mime, $extension ) {
$magic =& MimeMagic::singleton();
$magic = MimeMagic::singleton();
if ( ! $mime || $mime == 'unknown' || $mime == 'unknown/unknown' )
if ( ! $magic->isRecognizableExtension( $extension ) ) {

View file

@ -71,7 +71,7 @@ function wfGetType( $filename ) {
return 'unknown/unknown';
}
else {
$magic=& MimeMagic::singleton();
$magic = MimeMagic::singleton();
return $magic->guessMimeType($filename); //full fancy mime detection
}
}

View file

@ -1836,7 +1836,7 @@ class Title {
* @return int the ID
*/
public function getArticleID( $flags = 0 ) {
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
if ( $flags & GAID_FOR_UPDATE ) {
$oldUpdate = $linkCache->forUpdate( true );
$this->mArticleID = $linkCache->addLinkObj( $this );
@ -1863,7 +1863,7 @@ class Title {
if( !$this->getArticleID($flags) || $this->getNamespace() == NS_SPECIAL ) {
return false;
}
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
$this->mRedirect = (bool)$linkCache->getGoodLinkFieldObj( $this, 'redirect' );
return $this->mRedirect;
@ -1883,7 +1883,7 @@ class Title {
if( !$this->getArticleID($flags) || $this->getNamespace() == NS_SPECIAL ) {
return 0;
}
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
$this->mLength = intval( $linkCache->getGoodLinkFieldObj( $this, 'length' ) );
return $this->mLength;
@ -1911,7 +1911,7 @@ class Title {
* @param int $newid the new Article ID
*/
public function resetArticleID( $newid ) {
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
$linkCache->clearBadLink( $this->getPrefixedDBkey() );
if ( 0 == $newid ) { $this->mArticleID = -1; }
@ -2223,7 +2223,7 @@ class Title {
* @return array the Title objects linking here
*/
public function getLinksTo( $options = '', $table = 'pagelinks', $prefix = 'pl' ) {
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
if ( $options ) {
$db = wfGetDB( DB_MASTER );

View file

@ -58,7 +58,7 @@ class ApiParse extends ApiBase {
$articleObj = new Article($titleObj);
if(isset($prop['revid']))
$revid = $articleObj->getRevIdFetched();
$pcache =& ParserCache::singleton();
$pcache = ParserCache::singleton();
$p_result = $pcache->get($articleObj, $wgUser);
if(!$p_result) {
$p_result = $wgParser->parse($articleObj->getContent(), $titleObj, new ParserOptions());

View file

@ -840,7 +840,7 @@ abstract class File {
} else {
$db = wfGetDB( DB_SLAVE );
}
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
list( $page, $imagelinks ) = $db->tableNamesN( 'page', 'imagelinks' );
$encName = $db->addQuotes( $this->getName() );

View file

@ -125,7 +125,7 @@ class TitleCleanup extends TableCleanup {
),
array( 'page_id' => $row->page_id ),
'cleanupTitles::moveInconsistentPage' );
$linkCache =& LinkCache::singleton();
$linkCache = LinkCache::singleton();
$linkCache->clear();
}
}