X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUnwatchedpages.php;h=ae375b2d706fdd413995d5f190e6ed8bc33dc395;hp=df57744b3ae3f4c6e29a55f0d0852258c3058c21;hb=9964ca1a390c446397dcd466916ffed356cdc3c9;hpb=a85d1b9d0cd7f02111d3a647d5b91e3b1f334563 diff --git a/includes/specials/SpecialUnwatchedpages.php b/includes/specials/SpecialUnwatchedpages.php index df57744b3a..ae375b2d70 100644 --- a/includes/specials/SpecialUnwatchedpages.php +++ b/includes/specials/SpecialUnwatchedpages.php @@ -43,7 +43,28 @@ 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() { + $dbr = wfGetDB( DB_REPLICA ); return [ 'tables' => [ 'page', 'watchlist' ], 'fields' => [ @@ -54,7 +75,7 @@ class UnwatchedpagesPage extends QueryPage { 'conds' => [ 'wl_title IS NULL', 'page_is_redirect' => 0, - "page_namespace != '" . NS_MEDIAWIKI . "'" + 'page_namespace != ' . $dbr->addQuotes( NS_MEDIAWIKI ), ], 'join_conds' => [ 'watchlist' => [ 'LEFT JOIN', [ 'wl_title = page_title',