From 792054a2a41a321e66e33fda47e9b95c44e87679 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sat, 13 Feb 2016 00:33:45 +0100 Subject: [PATCH] resourceloader: Add content hash to static debug urls This way, they automatically bypass any stale client or server cache. Remove an old wfExpandUrl() call that would interfere with transformResourcePath()'s ability to recognise the path. Expanding the url there wasn't needed anyway. Whether it's on a separate host (eg. bits.wikimedia.org), or path-absolute, either way works as-is. Bug: T90983 Change-Id: I64eb3291adcfc3733ef96690399c09c06e19b3aa --- .../resourceloader/ResourceLoaderFileModule.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index b31e8dcc98..6924d31dae 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -341,10 +341,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $remoteBasePath = (string)$options['remoteBasePath']; } - // Make sure the remote base path is a complete valid URL, - // but possibly protocol-relative to avoid cache pollution - $remoteBasePath = wfExpandUrl( $remoteBasePath, PROTO_RELATIVE ); - return [ $localBasePath, $remoteBasePath ]; } @@ -366,7 +362,10 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { public function getScriptURLsForDebug( ResourceLoaderContext $context ) { $urls = []; foreach ( $this->getScriptFiles( $context ) as $file ) { - $urls[] = $this->getRemotePath( $file ); + $urls[] = OutputPage::transformResourcePath( + $this->getConfig(), + $this->getRemotePath( $file ) + ); } return $urls; } @@ -412,7 +411,10 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { foreach ( $this->getStyleFiles( $context ) as $mediaType => $list ) { $urls[$mediaType] = []; foreach ( $list as $file ) { - $urls[$mediaType][] = $this->getRemotePath( $file ); + $urls[$mediaType][] = OutputPage::transformResourcePath( + $this->getConfig(), + $this->getRemotePath( $file ) + ); } } return $urls; -- 2.20.1