From: umherirrender Date: Fri, 19 Jun 2015 19:39:50 +0000 (+0200) Subject: Add LinkBatch to ImagePage for user pages in the file history X-Git-Tag: 1.31.0-rc.0~11019^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=79c44dd0a6cab747aadd65c0b10c7cc493cd421e;p=lhc%2Fweb%2Fwiklou.git 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 --- 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();