* Don't execute the LinkBatch if there are now rows
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 28 Feb 2012 21:12:38 +0000 (21:12 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 28 Feb 2012 21:12:38 +0000 (21:12 +0000)
* Call methods directly on ResultWrapper instead of DatabaseBase

includes/specials/SpecialDisambiguations.php

index 2b05fb6..8f780b5 100644 (file)
@@ -108,17 +108,17 @@ class DisambiguationsPage extends PageQueryPage {
         * @param $res
         */
        function preprocessResults( $db, $res ) {
+               if ( !$res->numRows() ) {
+                       return;
+               }
+
                $batch = new LinkBatch;
                foreach ( $res as $row ) {
                        $batch->add( $row->namespace, $row->title );
                }
                $batch->execute();
 
-               // Back to start for display
-               if ( $db->numRows( $res ) > 0 ) {
-                       // If there are no rows we get an error seeking.
-                       $db->dataSeek( $res, 0 );
-               }
+               $res->seek( 0 );
        }
 
        function formatResult( $skin, $result ) {