http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100305
Revision: 100305 Author: aaron Date: 2011-10-20 00:43:43 +0000 (Thu, 20 Oct 2011) Log Message: ----------- * Added a proper Pager::doBatchLookups() function * Made HistoryPager use a link batch via Pager::doBatchLookups() Modified Paths: -------------- trunk/phase3/includes/HistoryPage.php trunk/phase3/includes/Pager.php Modified: trunk/phase3/includes/HistoryPage.php =================================================================== --- trunk/phase3/includes/HistoryPage.php 2011-10-20 00:41:48 UTC (rev 100304) +++ trunk/phase3/includes/HistoryPage.php 2011-10-20 00:43:43 UTC (rev 100305) @@ -382,6 +382,19 @@ return $s; } + function doBatchLookups() { + # Do a link batch query + $this->mResult->seek( 0 ); + $batch = new LinkBatch(); + # Give some pointers to make (last) links + foreach ( $this->mResult as $row ) { + $batch->addObj( Title::makeTitleSafe( NS_USER, $row->rev_user_name ) ); + $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->rev_user_name ) ); + } + $batch->execute(); + $this->mResult->seek( 0 ); + } + /** * Creates begin of history list with a submit button * Modified: trunk/phase3/includes/Pager.php =================================================================== --- trunk/phase3/includes/Pager.php 2011-10-20 00:41:48 UTC (rev 100304) +++ trunk/phase3/includes/Pager.php 2011-10-20 00:43:43 UTC (rev 100305) @@ -325,10 +325,13 @@ * * @return String */ - function getBody() { + public function getBody() { if ( !$this->mQueryDone ) { $this->doQuery(); } + # Do any special query batches before display + $this->doBatchLookups(); + # Don't use any extra rows returned by the query $numRows = min( $this->mResult->numRows(), $this->mLimit ); @@ -385,12 +388,20 @@ } /** + * Called from getBody(), before getStartBody() is called. This + * will be called even if there are no rows in the result set. + * + * @return void + */ + protected function doBatchLookups() {} + + /** * Hook into getBody(), allows text to be inserted at the start. This * will be called even if there are no rows in the result set. * * @return String */ - function getStartBody() { + protected function getStartBody() { return ''; } @@ -399,7 +410,7 @@ * * @return String */ - function getEndBody() { + protected function getEndBody() { return ''; } @@ -409,7 +420,7 @@ * * @return String */ - function getEmptyBody() { + protected function getEmptyBody() { return ''; } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs