From 2b94b7fe743237d6c7e1d738f16ac2849e20b15d Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 26 Sep 2014 20:47:42 +0200 Subject: [PATCH] Add LinkBatch to Special:LinkSearch When building the result list, each link results in a database query. The select is on the page table, so it is known, that each page exists, but using Linker::linkKnown does not prepare the link for stubthreshold or redirect marker. Change-Id: I8f73d398f510f252ac8d5a0fd04ccb0feaf79cc4 --- includes/specials/SpecialLinkSearch.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/includes/specials/SpecialLinkSearch.php b/includes/specials/SpecialLinkSearch.php index 37edc0f95c..2d6213ae40 100644 --- a/includes/specials/SpecialLinkSearch.php +++ b/includes/specials/SpecialLinkSearch.php @@ -251,6 +251,25 @@ class LinkSearchPage extends QueryPage { return $retval; } + /** + * Pre-fill the link cache + * + * @param DatabaseBase $db + * @param ResultWrapper $res + */ + function preprocessResults( $db, $res ) { + if ( $res->numRows() > 0 ) { + $linkBatch = new LinkBatch(); + + foreach ( $res as $row ) { + $linkBatch->add( $row->namespace, $row->title ); + } + + $res->seek( 0 ); + $linkBatch->execute(); + } + } + /** * @param Skin $skin * @param object $result Result row -- 2.20.1