From 450da07f3a39c16a7ec71a9f0e2f08100cbe6716 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 14 Sep 2018 01:13:57 +0100 Subject: [PATCH] resourceloader: Remove MW cacheEpoch from module version hash This seems quite nuclear. I'd actually like to deprecate the wgCacheEpoch variable more generally in favour of a handful of more specific version constants, but as starting point, remove it from the hash used for load.php urls and localStorage keys. The latter is also controlled by wgResourceLoaderStorageVersion already. Also ref T32956 about a more standalone ResourceLoader. Change-Id: I913f846090e82d3d822653b9b7ce22233cdb5e90 --- includes/resourceloader/ResourceLoaderModule.php | 3 +-- tests/phpunit/includes/OutputPageTest.php | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index a507ad3ef1..79ad0eef60 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -813,7 +813,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { } else { // Infer changes based on definition and other metrics $summary = $this->getDefinitionSummary( $context ); - if ( !isset( $summary['_cacheEpoch'] ) ) { + if ( !isset( $summary['_class'] ) ) { throw new LogicException( 'getDefinitionSummary must call parent method' ); } $str = json_encode( $summary ); @@ -883,7 +883,6 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { public function getDefinitionSummary( ResourceLoaderContext $context ) { return [ '_class' => static::class, - '_cacheEpoch' => $this->getConfig()->get( 'CacheEpoch' ), ]; } diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index 42ea9ed54b..5a2d1f7f02 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -1800,7 +1800,7 @@ class OutputPageTest extends MediaWikiTestCase { 'exemptStyleModules' => [ 'site' => [ 'site.styles' ], 'user' => [ 'user.styles' ] ], '' . "\n" . '' . "\n" . - '', + '', ], 'custom modules' => [ 'exemptStyleModules' => [ @@ -1811,7 +1811,7 @@ class OutputPageTest extends MediaWikiTestCase { '' . "\n" . '' . "\n" . '' . "\n" . - '', + '', ], ]; // phpcs:enable -- 2.20.1