Changed global variables ($wgTitle and $wgArticle) to local ones
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 13 Dec 2010 15:13:06 +0000 (15:13 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 13 Dec 2010 15:13:06 +0000 (15:13 +0000)
maintenance/refreshLinks.php

index 45e77a7..d481a5b 100644 (file)
@@ -160,29 +160,27 @@ class RefreshLinks extends Maintenance {
         * @param $id int The page_id of the redirect
         */
        private function fixRedirect( $id ) {
-               global $wgTitle, $wgArticle;
-
-               $wgTitle = Title::newFromID( $id );
+               $title = Title::newFromID( $id );
                $dbw = wfGetDB( DB_MASTER );
 
-               if ( is_null( $wgTitle ) ) {
+               if ( is_null( $title ) ) {
                        // This page doesn't exist (any more)
                        // Delete any redirect table entry for it
                        $dbw->delete( 'redirect', array( 'rd_from' => $id ),
                                __METHOD__ );
                        return;
                }
-               $wgArticle = new Article( $wgTitle );
+               $article = new Article( $title );
 
-               $rt = $wgArticle->followRedirect();
+               $rt = $article->followRedirect();
 
                if ( !$rt || !is_object( $rt ) ) {
-                       // $wgTitle is not a redirect
+                       // $title is not a redirect
                        // Delete any redirect table entry for it
                        $dbw->delete( 'redirect', array( 'rd_from' => $id ),
                                __METHOD__ );
                } else {
-                       $wgArticle->updateRedirectOn( $dbw, $rt );
+                       $article->updateRedirectOn( $dbw, $rt );
                }
        }
 
@@ -191,26 +189,26 @@ class RefreshLinks extends Maintenance {
         * @param $id int The page_id
         */
        public static function fixLinksFromArticle( $id ) {
-               global $wgTitle, $wgParser;
+               global $wgParser;
 
-               $wgTitle = Title::newFromID( $id );
+               $title = Title::newFromID( $id );
                $dbw = wfGetDB( DB_MASTER );
 
                LinkCache::singleton()->clear();
 
-               if ( is_null( $wgTitle ) ) {
+               if ( is_null( $title ) ) {
                        return;
                }
                $dbw->begin();
 
-               $revision = Revision::newFromTitle( $wgTitle );
+               $revision = Revision::newFromTitle( $title );
                if ( !$revision ) {
                        return;
                }
 
                $options = new ParserOptions;
-               $parserOutput = $wgParser->parse( $revision->getText(), $wgTitle, $options, true, true, $revision->getId() );
-               $update = new LinksUpdate( $wgTitle, $parserOutput, false );
+               $parserOutput = $wgParser->parse( $revision->getText(), $title, $options, true, true, $revision->getId() );
+               $update = new LinksUpdate( $title, $parserOutput, false );
                $update->doUpdate();
                $dbw->commit();
        }