Moved contribs rev parent ID batch query into doBatchLookups()
authorAaron Schulz <aaron@users.mediawiki.org>
Thu, 20 Oct 2011 02:26:59 +0000 (02:26 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Thu, 20 Oct 2011 02:26:59 +0000 (02:26 +0000)
includes/Pager.php
includes/specials/SpecialContributions.php

index e4c2405..bfb011c 100644 (file)
@@ -388,8 +388,9 @@ abstract class IndexPager extends ContextSource implements Pager {
        }
 
        /**
-        * Called from getBody(), before getStartBody() is called. This
-        * will be called even if there are no rows in the result set.
+        * Called from getBody(), before getStartBody() is called and
+        * after doQuery() was called. This will be called even if there
+        * are no rows in the result set.
         *
         * @return void
         */
index ac1b57f..1885b53 100644 (file)
@@ -549,6 +549,18 @@ class ContribsPager extends ReverseChronologicalPager {
        }
 
        function doBatchLookups() {
+               global $wgRCShowChangedSize;
+
+               $this->mParentLens = array();
+               if ( $wgRCShowChangedSize ) {
+                       $this->mResult->rewind();
+                       $revIds = array();
+                       foreach ( $this->mResult as $row ) {
+                               $revIds[] = $row->rev_parent_id;
+                       }
+                       $this->mParentLens = $this->getParentLengths( $revIds );
+                       $this->mResult->rewind(); // reset
+               }
                if ( $this->contribs === 'newbie' ) { // multiple users
                        # Do a link batch query
                        $this->mResult->seek( 0 );
@@ -563,32 +575,6 @@ class ContribsPager extends ReverseChronologicalPager {
                }
        }
 
-       function getStartBody() {
-               return "<ul>\n";
-       }
-
-       function getEndBody() {
-               return "</ul>\n";
-       }
-
-       function getBody() {
-               global $wgRCShowChangedSize;
-               if( !$this->mQueryDone ) {
-                       $this->doQuery();
-               }
-               $this->mParentLens = array();
-               if( $wgRCShowChangedSize ) {
-                       $this->mResult->rewind();
-                       $revIds = array();
-                       foreach( $this->mResult as $row ) {
-                               $revIds[] = $row->rev_parent_id;
-                       }
-                       $this->mParentLens = $this->getParentLengths( $revIds );
-                       $this->mResult->rewind();
-               }
-               return parent::getBody();
-       }
-
        /*
         * Do a batched query to get the parent revision lengths
         */
@@ -609,6 +595,14 @@ class ContribsPager extends ReverseChronologicalPager {
                return $revLens;
        }
 
+       function getStartBody() {
+               return "<ul>\n";
+       }
+
+       function getEndBody() {
+               return "</ul>\n";
+       }
+
        /**
         * Generates each row in the contributions list.
         *