From 79c44dd0a6cab747aadd65c0b10c7cc493cd421e Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 19 Jun 2015 21:39:50 +0200 Subject: [PATCH] Add LinkBatch to ImagePage for user pages in the file history Each user in the file history trigger an own query to get the state of the user page, talk page and gender information. Use a LinkBatch to combine all of these queries to two (one for pages, one for gender). Change-Id: Ic1973c1ccfa17002b343d8c0d110a7c1d20b0460 --- includes/page/ImagePage.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php index cebc4c40a9..7ea4ed7464 100644 --- a/includes/page/ImagePage.php +++ b/includes/page/ImagePage.php @@ -1515,6 +1515,18 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager { $s = ''; $this->doQuery(); if ( count( $this->mHist ) ) { + if ( $this->mImg->isLocal() ) { + // Do a batch existence check for user pages and talkpages + $linkBatch = new LinkBatch(); + for ( $i = $this->mRange[0]; $i <= $this->mRange[1]; $i++ ) { + $file = $this->mHist[$i]; + $user = $file->getUser( 'text' ); + $linkBatch->add( NS_USER, $user ); + $linkBatch->add( NS_USER_TALK, $user ); + } + $linkBatch->execute(); + } + $list = new ImageHistoryList( $this->mImagePage ); # Generate prev/next links $navLink = $this->getNavigationBar(); -- 2.20.1