From: Aaron Schulz Date: Thu, 20 Oct 2011 02:26:59 +0000 (+0000) Subject: Moved contribs rev parent ID batch query into doBatchLookups() X-Git-Tag: 1.31.0-rc.0~26990 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=dab142d5f0b66942ea8443f51603f246647db3f1;p=lhc%2Fweb%2Fwiklou.git Moved contribs rev parent ID batch query into doBatchLookups() --- diff --git a/includes/Pager.php b/includes/Pager.php index e4c2405587..bfb011c0a1 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -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 */ diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index ac1b57f23b..1885b53175 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -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 "\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 "\n"; + } + /** * Generates each row in the contributions list. *