From 3a748592f8da0095f707b6294dd39c269e56ce79 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 12 May 2017 19:05:20 +0100 Subject: [PATCH] resourceloader: Add filename to validateScriptFile cache key * Add fileName to cache key to fix T52919. The cached parsed error message contains the filename, this should be part of the cache key as otherwise two identical user scripts may report the same error message, including " on line X of page Y" where Y is whichever of the two pages first created the cache entry. * Make the cache key global instead of per-wiki. There is no need for this to be per-wiki. Bug: T52919 Change-Id: I6c2718c53be7f6384a6486a4a8718ae7f423d216 --- includes/resourceloader/ResourceLoaderModule.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index 97f9891eeb..3ad6a84864 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -936,11 +936,12 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { } $cache = ObjectCache::getMainWANInstance(); return $cache->getWithSetCallback( - $cache->makeKey( + $cache->makeGlobalKey( 'resourceloader', 'jsparse', self::$parseCacheVersion, - md5( $contents ) + md5( $contents ), + $fileName ), $cache::TTL_WEEK, function () use ( $contents, $fileName ) { -- 2.20.1