From: Timo Tijhof Date: Fri, 12 Feb 2016 23:33:45 +0000 (+0100) Subject: resourceloader: Add content hash to static debug urls X-Git-Tag: 1.31.0-rc.0~7890^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=792054a2a41a321e66e33fda47e9b95c44e87679;p=lhc%2Fweb%2Fwiklou.git 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 --- 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;