ResourceLoader: make `cacheReport` option false by default
authorOri Livneh <ori@wikimedia.org>
Tue, 11 Aug 2015 16:24:03 +0000 (09:24 -0700)
committerOri Livneh <ori@wikimedia.org>
Tue, 11 Aug 2015 16:38:43 +0000 (09:38 -0700)
In the three years or so that I have been around, we at Wikimedia have not to
my knowledge used the cache keys to manage the cache of ResourceLoader modules.
Instead, if we want to force a module to rebuild, we simply touch one of its
files. (Though even that is not often required these days.)

Change-Id: Ib62a792e053572f268d4be19a10f99f84c07abc5

includes/resourceloader/ResourceLoader.php
tests/phpunit/includes/OutputPageTest.php

index eb28109..408487b 100644 (file)
@@ -181,7 +181,7 @@ class ResourceLoader implements LoggerAwareInterface {
         * @param string $data Text to filter, such as JavaScript or CSS text
         * @param array $options For back-compat, can also be the boolean value for "cacheReport". Keys:
         *  - (bool) cache: Whether to allow caching this data. Default: true.
-        *  - (bool) cacheReport: Whether to include the "cache key" report comment. Default: true.
+        *  - (bool) cacheReport: Whether to include the "cache key" report comment. Default: false.
         * @return string Filtered data, or a comment containing an error message
         */
        public function filter( $filter, $data, $options = array() ) {
@@ -190,7 +190,7 @@ class ResourceLoader implements LoggerAwareInterface {
                        $options = array( 'cacheReport' => $options );
                }
                // Defaults
-               $options += array( 'cache' => true, 'cacheReport' => true );
+               $options += array( 'cache' => true, 'cacheReport' => false );
 
                // Don't filter empty content
                if ( trim( $data ) === '' ) {
index 4b90372..85c2220 100644 (file)
@@ -162,15 +162,15 @@ class OutputPageTest extends MediaWikiTestCase {
                                array( 'test.quux', ResourceLoaderModule::TYPE_SCRIPTS ),
                                "<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
                                        . "mw.test.baz({token:123});mw.loader.state({\"test.quux\":\"ready\"});\n"
-                                       . "\n} );</script>"
+                                       . "} );</script>"
                        ),
                        // Load private module (combined)
                        array(
                                array( 'test.quux', ResourceLoaderModule::TYPE_COMBINED ),
                                "<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
                                        . "mw.loader.implement(\"test.quux\",function($,jQuery){"
-                                       . "mw.test.baz({token:123});},{\"css\":[\".mw-icon{transition:none}\\n"
-                                       . "\"]});\n\n} );</script>"
+                                       . "mw.test.baz({token:123});},{\"css\":[\".mw-icon{transition:none}"
+                                       . "\"]});\n} );</script>"
                        ),
                        // Load no modules
                        array(