Moved contribs rev parent ID batch query into doBatchLookups()
This commit is contained in:
parent
5207631a2d
commit
dab142d5f0
2 changed files with 23 additions and 28 deletions
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue