Followup 1cf5a6e: use $wgResourceBasePath to refer to resources/assets, not $wgScriptPath
authorRoan Kattouw <roan.kattouw@gmail.com>
Wed, 17 Sep 2014 23:12:53 +0000 (16:12 -0700)
committerRoan Kattouw <roan.kattouw@gmail.com>
Wed, 17 Sep 2014 23:21:28 +0000 (16:21 -0700)
Bonus: actually make $wgResourceBasePath default to $wgScriptPath, rather than
special-casing it in ResourceLoaderFileModule.

Change-Id: I608435cef00d3e77a5bbdb0a0122d3e7e1a4eb78

includes/DefaultSettings.php
includes/Setup.php
includes/filerepo/file/File.php
includes/installer/Installer.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/skins/Skin.php

index 5160684..2123af1 100644 (file)
@@ -3102,7 +3102,7 @@ $wgFooterIcons = array(
        ),
        "poweredby" => array(
                "mediawiki" => array(
-                       "src" => null, // Defaults to "$wgScriptPath/resources/assets/poweredby_mediawiki_88x31.png"
+                       "src" => null, // Defaults to "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png"
                        "url" => "//www.mediawiki.org/",
                        "alt" => "Powered by MediaWiki",
                )
index cf2df6b..253d25b 100644 (file)
@@ -77,6 +77,9 @@ if ( $wgStyleDirectory === false ) {
 if ( $wgExtensionAssetsPath === false ) {
        $wgExtensionAssetsPath = "$wgScriptPath/extensions";
 }
+if ( $wgResourceBasePath === null ) {
+       $wgResourceBasePath = $wgScriptPath;
+}
 
 if ( $wgLogo === false ) {
        $wgLogo = "$wgStylePath/common/images/wiki.png";
@@ -106,7 +109,7 @@ if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
 if ( $wgRightsIcon ) {
        $wgRightsIcon = str_replace(
                "{$wgStylePath}/common/images/",
-               "{$wgScriptPath}/resources/assets/licenses/",
+               "{$wgResourceBasePath}/resources/assets/licenses/",
                $wgRightsIcon
        );
 }
@@ -133,7 +136,7 @@ if ( isset( $wgFooterIcons['poweredby'] )
        && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
 ) {
        $wgFooterIcons['poweredby']['mediawiki']['src'] =
-               "$wgScriptPath/resources/assets/poweredby_mediawiki_88x31.png";
+               "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
 }
 
 /**
index 08c98bd..b574c5e 100644 (file)
@@ -1328,8 +1328,8 @@ abstract class File {
         * @return ThumbnailImage
         */
        function iconThumb() {
-               global $wgScriptPath, $IP;
-               $assetsPath = "$wgScriptPath/resources/assets/file-type-icons/";
+               global $wgResourceBasePath, $IP;
+               $assetsPath = "$wgResourceBasePath/resources/assets/file-type-icons/";
                $assetsDirectory = "$IP/resources/assets/file-type-icons/";
 
                $try = array( 'fileicon-' . $this->getExtension() . '.png', 'fileicon.png' );
index 7d94c2c..f23dfc9 100644 (file)
@@ -286,27 +286,27 @@ abstract class Installer {
        public $licenses = array(
                'cc-by' => array(
                        'url' => 'http://creativecommons.org/licenses/by/3.0/',
-                       'icon' => '{$wgScriptPath}/resources/assets/licenses/cc-by.png',
+                       'icon' => '{$wgResourceBasePath}/resources/assets/licenses/cc-by.png',
                ),
                'cc-by-sa' => array(
                        'url' => 'http://creativecommons.org/licenses/by-sa/3.0/',
-                       'icon' => '{$wgScriptPath}/resources/assets/licenses/cc-by-sa.png',
+                       'icon' => '{$wgResourceBasePath}/resources/assets/licenses/cc-by-sa.png',
                ),
                'cc-by-nc-sa' => array(
                        'url' => 'http://creativecommons.org/licenses/by-nc-sa/3.0/',
-                       'icon' => '{$wgScriptPath}/resources/assets/licenses/cc-by-nc-sa.png',
+                       'icon' => '{$wgResourceBasePath}/resources/assets/licenses/cc-by-nc-sa.png',
                ),
                'cc-0' => array(
                        'url' => 'https://creativecommons.org/publicdomain/zero/1.0/',
-                       'icon' => '{$wgScriptPath}/resources/assets/licenses/cc-0.png',
+                       'icon' => '{$wgResourceBasePath}/resources/assets/licenses/cc-0.png',
                ),
                'pd' => array(
                        'url' => '',
-                       'icon' => '{$wgScriptPath}/resources/assets/licenses/public-domain.png',
+                       'icon' => '{$wgResourceBasePath}/resources/assets/licenses/public-domain.png',
                ),
                'gfdl' => array(
                        'url' => 'http://www.gnu.org/copyleft/fdl.html',
-                       'icon' => '{$wgScriptPath}/resources/assets/licenses/gnu-fdl.png',
+                       'icon' => '{$wgResourceBasePath}/resources/assets/licenses/gnu-fdl.png',
                ),
                'none' => array(
                        'url' => '',
index fee78d1..137ff62 100644 (file)
@@ -168,7 +168,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @param string $localBasePath Base path to prepend to all local paths in $options. Defaults
         *     to $IP
         * @param string $remoteBasePath Base path to prepend to all remote paths in $options. Defaults
-        *     to $wgScriptPath
+        *     to $wgResourceBasePath
         *
         * Below is a description for the $options array:
         * @throws MWException
@@ -177,7 +177,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         *     array(
         *         // Base path to prepend to all local paths in $options. Defaults to $IP
         *         'localBasePath' => [base path],
-        *         // Base path to prepend to all remote paths in $options. Defaults to $wgScriptPath
+        *         // Base path to prepend to all remote paths in $options. Defaults to $wgResourceBasePath
         *         'remoteBasePath' => [base path],
         *         // Equivalent of remoteBasePath, but relative to $wgExtensionAssetsPath
         *         'remoteExtPath' => [base path],
@@ -291,7 +291,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @param string $localBasePath Path to use if not provided in module definition. Defaults
         *     to $IP
         * @param string $remoteBasePath Path to use if not provided in module definition. Defaults
-        *     to $wgScriptPath
+        *     to $wgResourceBasePath
         * @return array Array( localBasePath, remoteBasePath )
         */
        public static function extractBasePaths(
@@ -299,14 +299,14 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                $localBasePath = null,
                $remoteBasePath = null
        ) {
-               global $IP, $wgScriptPath, $wgResourceBasePath;
+               global $IP, $wgResourceBasePath;
 
                // The different ways these checks are done, and their ordering, look very silly,
                // but were preserved for backwards-compatibility just in case. Tread lightly.
 
                $localBasePath = $localBasePath === null ? $IP : $localBasePath;
                if ( $remoteBasePath === null ) {
-                       $remoteBasePath = $wgResourceBasePath === null ? $wgScriptPath : $wgResourceBasePath;
+                       $remoteBasePath = $wgResourceBasePath;
                }
 
                if ( isset( $options['remoteExtPath'] ) ) {
index 7793f1d..2f6a710 100644 (file)
@@ -827,9 +827,9 @@ abstract class Skin extends ContextSource {
         * @return string
         */
        function getPoweredBy() {
-               global $wgScriptPath;
+               global $wgResourceBasePath;
 
-               $url = htmlspecialchars( "$wgScriptPath/resources/assets/poweredby_mediawiki_88x31.png" );
+               $url = htmlspecialchars( "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png" );
                $text = '<a href="//www.mediawiki.org/"><img src="' . $url
                        . '" height="31" width="88" alt="Powered by MediaWiki" /></a>';
                wfRunHooks( 'SkinGetPoweredBy', array( &$text, $this ) );