resourceloader: Remove MW cacheEpoch from module version hash
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 14 Sep 2018 00:13:57 +0000 (01:13 +0100)
committerKrinkle <krinklemail@gmail.com>
Mon, 24 Sep 2018 17:10:35 +0000 (17:10 +0000)
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
tests/phpunit/includes/OutputPageTest.php

index a507ad3..79ad0ee 100644 (file)
@@ -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' ),
                ];
        }
 
index 42ea9ed..5a2d1f7 100644 (file)
@@ -1800,7 +1800,7 @@ class OutputPageTest extends MediaWikiTestCase {
                                'exemptStyleModules' => [ 'site' => [ 'site.styles' ], 'user' => [ 'user.styles' ] ],
                                '<meta name="ResourceLoaderDynamicStyles" content=""/>' . "\n" .
                                '<link rel="stylesheet" href="/w/load.php?debug=false&amp;lang=en&amp;modules=site.styles&amp;only=styles&amp;skin=fallback"/>' . "\n" .
-                               '<link rel="stylesheet" href="/w/load.php?debug=false&amp;lang=en&amp;modules=user.styles&amp;only=styles&amp;skin=fallback&amp;version=1e9z0ox"/>',
+                               '<link rel="stylesheet" href="/w/load.php?debug=false&amp;lang=en&amp;modules=user.styles&amp;only=styles&amp;skin=fallback&amp;version=0nrehaq"/>',
                        ],
                        'custom modules' => [
                                'exemptStyleModules' => [
@@ -1811,7 +1811,7 @@ class OutputPageTest extends MediaWikiTestCase {
                                '<link rel="stylesheet" href="/w/load.php?debug=false&amp;lang=en&amp;modules=example.site.a%2Cb&amp;only=styles&amp;skin=fallback"/>' . "\n" .
                                '<link rel="stylesheet" href="/w/load.php?debug=false&amp;lang=en&amp;modules=site.styles&amp;only=styles&amp;skin=fallback"/>' . "\n" .
                                '<link rel="stylesheet" href="/w/load.php?debug=false&amp;lang=en&amp;modules=example.user&amp;only=styles&amp;skin=fallback&amp;version=0a56zyi"/>' . "\n" .
-                               '<link rel="stylesheet" href="/w/load.php?debug=false&amp;lang=en&amp;modules=user.styles&amp;only=styles&amp;skin=fallback&amp;version=1e9z0ox"/>',
+                               '<link rel="stylesheet" href="/w/load.php?debug=false&amp;lang=en&amp;modules=user.styles&amp;only=styles&amp;skin=fallback&amp;version=0nrehaq"/>',
                        ],
                ];
                // phpcs:enable