From: Aaron Schulz Date: Thu, 14 Mar 2019 06:44:38 +0000 (-0700) Subject: Make LinkCache::isCacheable include namespaces like NS_CATEGORY/NS_MODULE X-Git-Tag: 1.34.0-rc.0~2494^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=9804ee9d3a5d872ae1385fb46c73451a928367a1;p=lhc%2Fweb%2Fwiklou.git Make LinkCache::isCacheable include namespaces like NS_CATEGORY/NS_MODULE Category and module pages are some of the most frequently referenced Change-Id: I6d29e883883cbea596b287494e75663d09130749 --- 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 ) {