r112641 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112640‎ | r112641 | r112642 >
Date:21:12, 28 February 2012
Author:ialex
Status:ok (Comments)
Tags:
Comment:
* Don't execute the LinkBatch if there are now rows
* Call methods directly on ResultWrapper instead of DatabaseBase
Modified paths:
  • /trunk/phase3/includes/specials/SpecialDisambiguations.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialDisambiguations.php
@@ -108,17 +108,17 @@
109109 * @param $res
110110 */
111111 function preprocessResults( $db, $res ) {
 112+ if ( !$res->numRows() ) {
 113+ return;
 114+ }
 115+
112116 $batch = new LinkBatch;
113117 foreach ( $res as $row ) {
114118 $batch->add( $row->namespace, $row->title );
115119 }
116120 $batch->execute();
117121
118 - // Back to start for display
119 - if ( $db->numRows( $res ) > 0 ) {
120 - // If there are no rows we get an error seeking.
121 - $db->dataSeek( $res, 0 );
122 - }
 122+ $res->seek( 0 );
123123 }
124124
125125 function formatResult( $skin, $result ) {

Comments

#Comment by Aaron Schulz (talk | contribs)   21:13, 28 February 2012

Pager::doBatchLookups() could also be used.

#Comment by IAlex (talk | contribs)   20:34, 2 March 2012

That special page uses QueryPage, not Pager.

Status & tagging log