Merge "Add LinkBatch to Special:LinkSearch"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 30 Oct 2014 19:56:02 +0000 (19:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 30 Oct 2014 19:56:02 +0000 (19:56 +0000)
includes/specials/SpecialLinkSearch.php

index 37edc0f..2d6213a 100644 (file)
@@ -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