Kill a bunch of '=&' references for LinkCache, ParserCache, and MimeMagic singletons.
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 9 Apr 2008 18:23:34 +0000 (18:23 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 9 Apr 2008 18:23:34 +0000 (18:23 +0000)
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.

13 files changed:
includes/Article.php
includes/LinkBatch.php
includes/OutputPage.php
includes/Parser.php
includes/Parser_OldPP.php
includes/RefreshLinksJob.php
includes/SpecialImport.php
includes/SpecialUpload.php
includes/StreamFile.php
includes/Title.php
includes/api/ApiParse.php
includes/filerepo/File.php
maintenance/cleanupTitles.php

index c1180b4..57e4887 100644 (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 );
                }
 
index 90ed33a..2f5e830 100644 (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 );
         }
 
index 8bfb7e6..70f6f12 100644 (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 );
index 8de72b8..97e4630 100644 (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' );
index 0f35bab..92a7e18 100644 (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' );
index 367d994..d6e1221 100644 (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 ) ) {
index 9a7a394..5557b0a 100644 (file)
@@ -358,7 +358,7 @@ class WikiRevision {
                }
 
                // avoid memory leak...?
-               $linkCache =& LinkCache::singleton();
+               $linkCache = LinkCache::singleton();
                $linkCache->clear();
 
                $article = new Article( $this->title );
index 8ea9a8e..0d23c96 100644 (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 ) ) {
index 2dbbe6d..30cb277 100644 (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
        }
 }
index 36fec1d..b7b5d1e 100644 (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 );
index e4c8599..a8d2ea5 100644 (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());
index 8f89092..ed89fac 100644 (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() );
index 1f06b16..6a50a8e 100644 (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();
                }
        }