Merge "xhprof: Guard against division by 0 when computing percentages"
[lhc/web/wiklou.git] / includes / specials / SpecialLinkSearch.php
index 37edc0f..f6cb84d 100644 (file)
@@ -251,6 +251,25 @@ class LinkSearchPage extends QueryPage {
                return $retval;
        }
 
+       /**
+        * Pre-fill the link cache
+        *
+        * @param IDatabase $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
@@ -266,24 +285,6 @@ class LinkSearchPage extends QueryPage {
                return $this->msg( 'linksearch-line' )->rawParams( $urlLink, $pageLink )->escaped();
        }
 
-       /**
-        * Override to check query validity.
-        *
-        * @param mixed $offset Numerical offset or false for no offset
-        * @param mixed $limit Numerical limit or false for no limit
-        */
-       function doQuery( $offset = false, $limit = false ) {
-               list( $this->mMungedQuery, ) = LinkSearchPage::mungeQuery( $this->mQuery, $this->mProt );
-               if ( $this->mMungedQuery === false ) {
-                       $this->getOutput()->addWikiMsg( 'linksearch-error' );
-               } else {
-                       // For debugging
-                       // Generates invalid xhtml with patterns that contain --
-                       //$this->getOutput()->addHTML( "\n<!-- " . htmlspecialchars( $this->mMungedQuery ) . " -->\n" );
-                       parent::doQuery( $offset, $limit );
-               }
-       }
-
        /**
         * Override to squash the ORDER BY.
         * We do a truncated index search, so the optimizer won't trust