From: umherirrender Date: Fri, 26 Sep 2014 18:47:42 +0000 (+0200) Subject: Add LinkBatch to Special:LinkSearch X-Git-Tag: 1.31.0-rc.0~13438^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=2b94b7fe743237d6c7e1d738f16ac2849e20b15d;p=lhc%2Fweb%2Fwiklou.git 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 --- 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