Add LinkBatch to Special:UnwatchedPages
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 29 Oct 2016 18:26:10 +0000 (20:26 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 29 Oct 2016 18:26:10 +0000 (20:26 +0200)
Get all the information for blue links in one query.

Change-Id: I18cbaf69c5f75e00e48e27d4b5e7220f51c31808

includes/specials/SpecialUnwatchedpages.php

index df57744..0cbf00d 100644 (file)
@@ -43,6 +43,26 @@ class UnwatchedpagesPage extends QueryPage {
                return false;
        }
 
+       /**
+        * Pre-cache page existence to speed up link generation
+        *
+        * @param IDatabase $db
+        * @param ResultWrapper $res
+        */
+       public function preprocessResults( $db, $res ) {
+               if ( !$res->numRows() ) {
+                       return;
+               }
+
+               $batch = new LinkBatch();
+               foreach ( $res as $row ) {
+                       $batch->add( $row->namespace, $row->title );
+               }
+               $batch->execute();
+
+               $res->seek( 0 );
+       }
+
        public function getQueryInfo() {
                return [
                        'tables' => [ 'page', 'watchlist' ],