Merge r57468 fix from wmf-deployment... fixes $wgStylePath in default script loader...
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 7 Oct 2009 17:40:56 +0000 (17:40 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 7 Oct 2009 17:40:56 +0000 (17:40 +0000)
DO NOT ASSUME THAT /skins IS ALWAYS THE SAME AS $wgStylePath

includes/OutputPage.php

index 844496c..79f1dbd 100644 (file)
@@ -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" ) );