* Use WikiPage instead of Article
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 7 Jan 2012 15:43:05 +0000 (15:43 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 7 Jan 2012 15:43:05 +0000 (15:43 +0000)
* 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

maintenance/refreshLinks.php

index 1d33a8e..c16b696 100644 (file)
@@ -184,17 +184,15 @@ class RefreshLinks extends Maintenance {
                                __METHOD__ );
                        return;
                }
-               $article = new Article( $title );
 
-               $rt = $article->followRedirect();
+               $page = WikiPage::factory( $title );
+               $rt = $page->getRedirectTarget();
 
-               if ( !$rt || !is_object( $rt ) ) {
+               if ( $rt === null ) {
                        // $title is not a redirect
                        // Delete any redirect table entry for it
                        $dbw->delete( 'redirect', array( 'rd_from' => $id ),
                                __METHOD__ );
-               } else {
-                       $article->updateRedirectOn( $dbw, $rt );
                }
        }