From 784d10e4d3f018ef65f0d4a708274b22944a7cf2 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 9 Apr 2008 18:23:34 +0000 Subject: [PATCH] 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. --- includes/Article.php | 8 ++++---- includes/LinkBatch.php | 2 +- includes/OutputPage.php | 4 ++-- includes/Parser.php | 12 ++++++------ includes/Parser_OldPP.php | 2 +- includes/RefreshLinksJob.php | 2 +- includes/SpecialImport.php | 2 +- includes/SpecialUpload.php | 6 +++--- includes/StreamFile.php | 2 +- includes/Title.php | 10 +++++----- includes/api/ApiParse.php | 2 +- includes/filerepo/File.php | 2 +- maintenance/cleanupTitles.php | 2 +- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index c1180b441e..57e4887ef0 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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 ); } diff --git a/includes/LinkBatch.php b/includes/LinkBatch.php index 90ed33aa99..2f5e830a19 100644 --- a/includes/LinkBatch.php +++ b/includes/LinkBatch.php @@ -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 ); } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 8bfb7e661f..70f6f121d8 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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 ); diff --git a/includes/Parser.php b/includes/Parser.php index 8de72b88d9..97e4630376 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -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' ); diff --git a/includes/Parser_OldPP.php b/includes/Parser_OldPP.php index 0f35bab341..92a7e18139 100644 --- a/includes/Parser_OldPP.php +++ b/includes/Parser_OldPP.php @@ -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' ); diff --git a/includes/RefreshLinksJob.php b/includes/RefreshLinksJob.php index 367d994fd4..d6e12212cd 100644 --- a/includes/RefreshLinksJob.php +++ b/includes/RefreshLinksJob.php @@ -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 ) ) { diff --git a/includes/SpecialImport.php b/includes/SpecialImport.php index 9a7a394e94..5557b0af79 100644 --- a/includes/SpecialImport.php +++ b/includes/SpecialImport.php @@ -358,7 +358,7 @@ class WikiRevision { } // avoid memory leak...? - $linkCache =& LinkCache::singleton(); + $linkCache = LinkCache::singleton(); $linkCache->clear(); $article = new Article( $this->title ); diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 8ea9a8e1d2..0d23c963f5 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -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 ) ) { diff --git a/includes/StreamFile.php b/includes/StreamFile.php index 2dbbe6dee3..30cb277cad 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -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 } } diff --git a/includes/Title.php b/includes/Title.php index 36fec1d576..b7b5d1e214 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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 ); diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index e4c85996ac..a8d2ea584c 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -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()); diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index 8f890928b7..ed89fac9d4 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -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() ); diff --git a/maintenance/cleanupTitles.php b/maintenance/cleanupTitles.php index 1f06b1659d..6a50a8e185 100644 --- a/maintenance/cleanupTitles.php +++ b/maintenance/cleanupTitles.php @@ -125,7 +125,7 @@ class TitleCleanup extends TableCleanup { ), array( 'page_id' => $row->page_id ), 'cleanupTitles::moveInconsistentPage' ); - $linkCache =& LinkCache::singleton(); + $linkCache = LinkCache::singleton(); $linkCache->clear(); } } -- 2.20.1