r78305 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78304‎ | r78305 | r78306 >
Date:15:13, 13 December 2010
Author:ialex
Status:ok
Tags:
Comment:
Changed global variables ($wgTitle and $wgArticle) to local ones
Modified paths:
  • /trunk/phase3/maintenance/refreshLinks.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/refreshLinks.php
@@ -160,29 +160,27 @@
161161 * @param $id int The page_id of the redirect
162162 */
163163 private function fixRedirect( $id ) {
164 - global $wgTitle, $wgArticle;
165 -
166 - $wgTitle = Title::newFromID( $id );
 164+ $title = Title::newFromID( $id );
167165 $dbw = wfGetDB( DB_MASTER );
168166
169 - if ( is_null( $wgTitle ) ) {
 167+ if ( is_null( $title ) ) {
170168 // This page doesn't exist (any more)
171169 // Delete any redirect table entry for it
172170 $dbw->delete( 'redirect', array( 'rd_from' => $id ),
173171 __METHOD__ );
174172 return;
175173 }
176 - $wgArticle = new Article( $wgTitle );
 174+ $article = new Article( $title );
177175
178 - $rt = $wgArticle->followRedirect();
 176+ $rt = $article->followRedirect();
179177
180178 if ( !$rt || !is_object( $rt ) ) {
181 - // $wgTitle is not a redirect
 179+ // $title is not a redirect
182180 // Delete any redirect table entry for it
183181 $dbw->delete( 'redirect', array( 'rd_from' => $id ),
184182 __METHOD__ );
185183 } else {
186 - $wgArticle->updateRedirectOn( $dbw, $rt );
 184+ $article->updateRedirectOn( $dbw, $rt );
187185 }
188186 }
189187
@@ -191,26 +189,26 @@
192190 * @param $id int The page_id
193191 */
194192 public static function fixLinksFromArticle( $id ) {
195 - global $wgTitle, $wgParser;
 193+ global $wgParser;
196194
197 - $wgTitle = Title::newFromID( $id );
 195+ $title = Title::newFromID( $id );
198196 $dbw = wfGetDB( DB_MASTER );
199197
200198 LinkCache::singleton()->clear();
201199
202 - if ( is_null( $wgTitle ) ) {
 200+ if ( is_null( $title ) ) {
203201 return;
204202 }
205203 $dbw->begin();
206204
207 - $revision = Revision::newFromTitle( $wgTitle );
 205+ $revision = Revision::newFromTitle( $title );
208206 if ( !$revision ) {
209207 return;
210208 }
211209
212210 $options = new ParserOptions;
213 - $parserOutput = $wgParser->parse( $revision->getText(), $wgTitle, $options, true, true, $revision->getId() );
214 - $update = new LinksUpdate( $wgTitle, $parserOutput, false );
 211+ $parserOutput = $wgParser->parse( $revision->getText(), $title, $options, true, true, $revision->getId() );
 212+ $update = new LinksUpdate( $title, $parserOutput, false );
215213 $update->doUpdate();
216214 $dbw->commit();
217215 }

Status & tagging log