From 53a5959de4a41d7abfe13b7cf86461c7934779f4 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Fri, 2 Mar 2012 20:35:01 +0000 Subject: [PATCH] * Don't execute the LinkBatch if there are now rows * Call methods directly on ResultWrapper instead of DatabaseBase --- includes/QueryPage.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 75736aa3d6..151cc76250 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -295,7 +295,7 @@ abstract class QueryPage extends SpecialPage { $res = $this->reallyDoQuery( $limit, false ); $num = false; if ( $res ) { - $num = $dbr->numRows( $res ); + $num = $res->numRows(); # Fetch results $vals = array(); while ( $res && $row = $dbr->fetchObject( $res ) ) { @@ -733,6 +733,10 @@ abstract class WantedQueryPage extends QueryPage { * Cache page existence for performance */ function preprocessResults( $db, $res ) { + if ( !$res->numRows() ) { + return; + } + $batch = new LinkBatch; foreach ( $res as $row ) { $batch->add( $row->namespace, $row->title ); @@ -740,9 +744,7 @@ abstract class WantedQueryPage extends QueryPage { $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 ); } /** -- 2.20.1