From: Timo Tijhof Date: Tue, 17 Nov 2015 21:15:24 +0000 (+0000) Subject: resourceloader: Include 'raw' in ResourceLoaderContext hash X-Git-Tag: 1.31.0-rc.0~8959^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%2C%22id_auteur=%24connecte%22%29%20.%20%22?a=commitdiff_plain;h=8c00d37f47e75006cdd961c9e962a8c3a346382c;p=lhc%2Fweb%2Fwiklou.git resourceloader: Include 'raw' in ResourceLoaderContext hash This parameter was introduced last year as a way to extract bare scripts from modules without any 'mw.loader.state()' suffix. When ResourceFileCache is used ($wgUseFileCache) this causes cache pollution as it didn't include getRaw() in the hash. Change-Id: I7b9f9b6a5756777462395b911abafb62468cbefa --- diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php index 5ea47693c7..ff0e449cb0 100644 --- a/includes/resourceloader/ResourceLoaderContext.php +++ b/includes/resourceloader/ResourceLoaderContext.php @@ -359,6 +359,7 @@ class ResourceLoaderContext { // Request vary $this->getOnly(), $this->getVersion(), + $this->getRaw(), $this->getImage(), $this->getVariant(), $this->getFormat(), diff --git a/tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php b/tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php index ee9d766e08..24ea4b28e8 100644 --- a/tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php +++ b/tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php @@ -25,7 +25,7 @@ class DerivativeResourceLoaderContextTest extends PHPUnit_Framework_TestCase { $this->assertEquals( $derived->getModules(), array( 'test.context' ) ); $this->assertEquals( $derived->getOnly(), 'scripts' ); $this->assertEquals( $derived->getSkin(), 'fallback' ); - $this->assertEquals( $derived->getHash(), 'zh|fallback|||scripts||||' ); + $this->assertEquals( $derived->getHash(), 'zh|fallback|||scripts|||||' ); } public function testSetLanguage() { @@ -72,7 +72,7 @@ class DerivativeResourceLoaderContextTest extends PHPUnit_Framework_TestCase { $derived->setLanguage( 'nl' ); // Assert that subclass is able to clear parent class "hash" member - $this->assertEquals( $derived->getHash(), 'nl|fallback|||scripts||||' ); + $this->assertEquals( $derived->getHash(), 'nl|fallback|||scripts|||||' ); } }