r108321 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108320‎ | r108321 | r108322 >
Date:15:43, 7 January 2012
Author:ialex
Status:ok
Tags:
Comment:
* Use WikiPage instead of Article
* Use getRedirectTarget() instead of followRedirect(); the latter may return a string, which is not wanted here
* No need to call updateRedirectOn(); getRedirectTarget() already populates the redirect table if needed
Modified paths:
  • /trunk/phase3/maintenance/refreshLinks.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/refreshLinks.php
@@ -184,17 +184,15 @@
185185 __METHOD__ );
186186 return;
187187 }
188 - $article = new Article( $title );
189188
190 - $rt = $article->followRedirect();
 189+ $page = WikiPage::factory( $title );
 190+ $rt = $page->getRedirectTarget();
191191
192 - if ( !$rt || !is_object( $rt ) ) {
 192+ if ( $rt === null ) {
193193 // $title is not a redirect
194194 // Delete any redirect table entry for it
195195 $dbw->delete( 'redirect', array( 'rd_from' => $id ),
196196 __METHOD__ );
197 - } else {
198 - $article->updateRedirectOn( $dbw, $rt );
199197 }
200198 }
201199

Sign-offs

UserFlagDate
Bawolffinspected17:05, 7 January 2012

Status & tagging log