From 471a3bfb3d541ce73ca9e0fcfe540a17b9f4e2a5 Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Tue, 11 Aug 2015 09:24:03 -0700 Subject: [PATCH] ResourceLoader: make `cacheReport` option false by default 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 | 4 ++-- tests/phpunit/includes/OutputPageTest.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index eb2810977a..408487b661 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -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 ) === '' ) { diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index 4b903726d2..85c2220910 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -162,15 +162,15 @@ class OutputPageTest extends MediaWikiTestCase { array( 'test.quux', ResourceLoaderModule::TYPE_SCRIPTS ), "" + . "} );" ), // Load private module (combined) array( array( 'test.quux', ResourceLoaderModule::TYPE_COMBINED ), "" + . "mw.test.baz({token:123});},{\"css\":[\".mw-icon{transition:none}" + . "\"]});\n} );" ), // Load no modules array( -- 2.20.1