From 0b031afc99e81df0ee86c68ea0b7255228957378 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 7 Oct 2009 17:40:56 +0000 Subject: [PATCH] Merge r57468 fix from wmf-deployment... fixes $wgStylePath in default script loader... again... DO NOT ASSUME THAT /skins IS ALWAYS THE SAME AS $wgStylePath --- includes/OutputPage.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 844496c1f7..79f1dbd792 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -206,7 +206,7 @@ class OutputPage { */ function addScriptClass( $js_class ){ global $wgDebugJavaScript, $wgJSAutoloadLocalClasses, $wgJSAutoloadClasses, - $wgEnableScriptLoader, $wgStyleVersion, $wgScriptPath, $wgEnableJS2system; + $wgEnableScriptLoader, $wgStyleVersion, $wgScriptPath, $wgStylePath, $wgEnableJS2system; $path = jsScriptLoader::getJsPathFromClass( $js_class ); if( $path !== false ){ @@ -217,7 +217,15 @@ class OutputPage { } } else { // Source the script directly - $path = $wgScriptPath . '/' . $path; + $prefix = "skins/common/"; + if( substr( $path, 0, 1 ) == '/' ) { + // straight path + } elseif( substr( $path, 0, strlen( $prefix ) ) == $prefix ) { + // Respect $wgStypePath + $path = "{$wgStylePath}/common/" . substr( $path, strlen( $prefix ) ); + } else { + $path = $wgScriptPath . '/' . $path; + } $urlAppend = ( $wgDebugJavaScript ) ? time() : $this->getURIDparam( $js_class ); $this->addScript( Html::linkedScript( "$path?$urlAppend" ) ); -- 2.20.1