Merge "Add a hook to allow extensions to prevent HTML file caching"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 19 Sep 2014 00:08:58 +0000 (00:08 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 19 Sep 2014 00:08:58 +0000 (00:08 +0000)
docs/hooks.txt
includes/cache/HTMLFileCache.php

index f4b8ef2..51da2d4 100644 (file)
@@ -1376,6 +1376,10 @@ page history view, i.e. undo, rollback, etc.
 $rev: Revision object
 &$links: Array of HTML links
 
+'HTMLFileCache::useFileCache': Override whether a page should be cached in file
+cache.
+$context: An IContextSource object with information about the request being served.
+
 'ImageBeforeProduceHTML': Called before producing the HTML created by a wiki
 image insertion. You can skip the default logic entirely by returning false, or
 just modify a few things using call-by-reference.
index 91580f9..b8dbdf7 100644 (file)
@@ -120,7 +120,11 @@ class HTMLFileCache extends FileCacheBase {
                $clang = $wgContLang->getCode();
 
                // Check that there are no other sources of variation
-               return !$user->getId() && !$user->getNewtalk() && $ulang == $clang;
+               if ( $user->getId() || $user->getNewtalk() || $ulang != $clang ) {
+                       return false;
+               }
+               // Allow extensions to disable caching
+               return wfRunHooks( 'HTMLFileCache::useFileCache', array( $context ) );
        }
 
        /**