From ef26c7ad4fc4555f7de0c4592cd0b42faab5cd61 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 17 Sep 2014 16:12:53 -0700 Subject: [PATCH] Followup 1cf5a6e: use $wgResourceBasePath to refer to resources/assets, not $wgScriptPath Bonus: actually make $wgResourceBasePath default to $wgScriptPath, rather than special-casing it in ResourceLoaderFileModule. Change-Id: I608435cef00d3e77a5bbdb0a0122d3e7e1a4eb78 --- includes/DefaultSettings.php | 2 +- includes/Setup.php | 7 +++++-- includes/filerepo/file/File.php | 4 ++-- includes/installer/Installer.php | 12 ++++++------ includes/resourceloader/ResourceLoaderFileModule.php | 10 +++++----- includes/skins/Skin.php | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 51606847a2..2123af1070 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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", ) diff --git a/includes/Setup.php b/includes/Setup.php index cf2df6bd6b..253d25b21d 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -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"; } /** diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 08c98bd060..b574c5e7f4 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -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' ); diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 7d94c2c711..f23dfc95c2 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -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' => '', diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index fee78d1ab7..137ff62330 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -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'] ) ) { diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index 7793f1da15..2f6a7101e7 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -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 = 'Powered by MediaWiki'; wfRunHooks( 'SkinGetPoweredBy', array( &$text, $this ) ); -- 2.20.1