From 9804ee9d3a5d872ae1385fb46c73451a928367a1 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 13 Mar 2019 23:44:38 -0700 Subject: [PATCH] Make LinkCache::isCacheable include namespaces like NS_CATEGORY/NS_MODULE Category and module pages are some of the most frequently referenced Change-Id: I6d29e883883cbea596b287494e75663d09130749 --- includes/cache/LinkCache.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/cache/LinkCache.php b/includes/cache/LinkCache.php index b3dc00468b..348369ea64 100644 --- a/includes/cache/LinkCache.php +++ b/includes/cache/LinkCache.php @@ -281,7 +281,16 @@ class LinkCache { } private function isCacheable( LinkTarget $title ) { - return ( $title->inNamespace( NS_TEMPLATE ) || $title->inNamespace( NS_FILE ) ); + $ns = $title->getNamespace(); + if ( in_array( $ns, [ NS_TEMPLATE, NS_FILE, NS_CATEGORY ] ) ) { + return true; + } + // Focus on transcluded pages more than the main content + if ( MWNamespace::isContent( $ns ) ) { + return false; + } + // Non-talk extension namespaces (e.g. NS_MODULE) + return ( $ns >= 100 && MWNamespace::isSubject( $ns ) ); } private function fetchPageRow( IDatabase $db, LinkTarget $nt ) { -- 2.20.1