From: umherirrender Date: Sat, 29 Oct 2016 18:26:10 +0000 (+0200) Subject: Add LinkBatch to Special:UnwatchedPages X-Git-Tag: 1.31.0-rc.0~5002^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=d5c8a7357b67d715cbe247401d48b82057de0705;p=lhc%2Fweb%2Fwiklou.git Add LinkBatch to Special:UnwatchedPages Get all the information for blue links in one query. Change-Id: I18cbaf69c5f75e00e48e27d4b5e7220f51c31808 --- diff --git a/includes/specials/SpecialUnwatchedpages.php b/includes/specials/SpecialUnwatchedpages.php index df57744b3a..0cbf00d528 100644 --- a/includes/specials/SpecialUnwatchedpages.php +++ b/includes/specials/SpecialUnwatchedpages.php @@ -43,6 +43,26 @@ class UnwatchedpagesPage extends QueryPage { return false; } + /** + * Pre-cache page existence to speed up link generation + * + * @param IDatabase $db + * @param ResultWrapper $res + */ + public function preprocessResults( $db, $res ) { + if ( !$res->numRows() ) { + return; + } + + $batch = new LinkBatch(); + foreach ( $res as $row ) { + $batch->add( $row->namespace, $row->title ); + } + $batch->execute(); + + $res->seek( 0 ); + } + public function getQueryInfo() { return [ 'tables' => [ 'page', 'watchlist' ],