Merge "Make LinkCache::isCacheable include namespaces like NS_CATEGORY/NS_MODULE"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 17 Mar 2019 18:49:05 +0000 (18:49 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 17 Mar 2019 18:49:05 +0000 (18:49 +0000)
includes/cache/LinkCache.php

index fb416f0..c13f95e 100644 (file)
@@ -295,7 +295,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 ) {