From: Alexandre Emsenhuber Date: Fri, 2 Mar 2012 20:35:01 +0000 (+0000) Subject: * Don't execute the LinkBatch if there are now rows X-Git-Tag: 1.31.0-rc.0~24422 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=53a5959de4a41d7abfe13b7cf86461c7934779f4;p=lhc%2Fweb%2Fwiklou.git * Don't execute the LinkBatch if there are now rows * Call methods directly on ResultWrapper instead of DatabaseBase --- 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 ); } /**