From: Alexandre Emsenhuber Date: Mon, 13 Dec 2010 15:13:06 +0000 (+0000) Subject: Changed global variables ($wgTitle and $wgArticle) to local ones X-Git-Tag: 1.31.0-rc.0~33341 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=29a787739cc02ab17557c3679c1a95e30fea8fda;p=lhc%2Fweb%2Fwiklou.git Changed global variables ($wgTitle and $wgArticle) to local ones --- diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php index 45e77a747e..d481a5bb99 100644 --- a/maintenance/refreshLinks.php +++ b/maintenance/refreshLinks.php @@ -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(); }