Merge "Handle missing namespace prefix in XML dumps more gracefully"
[lhc/web/wiklou.git] / includes / specialpage / WantedQueryPage.php
index 1c19f3c..9d92cbd 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Class definition for a wanted query page like
  * WantedPages, WantedTemplates, etc
@@ -41,18 +43,7 @@ abstract class WantedQueryPage extends QueryPage {
         * @param ResultWrapper $res
         */
        function preprocessResults( $db, $res ) {
-               if ( !$res->numRows() ) {
-                       return;
-               }
-
-               $batch = new LinkBatch;
-               foreach ( $res as $row ) {
-                       $batch->add( $row->namespace, $row->title );
-               }
-               $batch->execute();
-
-               // Back to start for display
-               $res->seek( 0 );
+               $this->executeLBFromResultWrapper( $res );
        }
 
        /**
@@ -75,14 +66,15 @@ abstract class WantedQueryPage extends QueryPage {
         * @return string
         */
        public function formatResult( $skin, $result ) {
+               $linkRenderer = $this->getLinkRenderer();
                $title = Title::makeTitleSafe( $result->namespace, $result->title );
                if ( $title instanceof Title ) {
                        if ( $this->isCached() || $this->forceExistenceCheck() ) {
                                $pageLink = $this->existenceCheck( $title )
-                                       ? '<del>' . Linker::link( $title ) . '</del>'
-                                       : Linker::link( $title );
+                                       ? '<del>' . $linkRenderer->makeLink( $title ) . '</del>'
+                                       : $linkRenderer->makeLink( $title );
                        } else {
-                               $pageLink = Linker::link(
+                               $pageLink = $linkRenderer->makeLink(
                                        $title,
                                        null,
                                        [],