From: Timo Tijhof Date: Fri, 14 Sep 2018 00:13:57 +0000 (+0100) Subject: resourceloader: Remove MW cacheEpoch from module version hash X-Git-Tag: 1.34.0-rc.0~4006^2 X-Git-Url: http://git.cyclocoop.org/%24dirpuce/%27%241/%27%40script%40/Fool?a=commitdiff_plain;h=450da07f3a39c16a7ec71a9f0e2f08100cbe6716;p=lhc%2Fweb%2Fwiklou.git 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 --- 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