From 31b41c535b094bdac039d3047d8c9f8365c17575 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 1 Sep 2015 18:13:02 +0200 Subject: [PATCH] Use wgResourceBasePath instead of wgScriptPath for wgStylePath etc. This make re-configuring these much easier by only needing to update one variable instead of four. Also remove redundant hardcoding of wgStylePath and wgResourceBasePath in the generated LocalSettings.php file during installation. This way changing wgScriptPath will naturally result in the other variables updating too. We already do this for many other variables (such as wgLoadScript, wgScript, wgExtensionAssetsPath, etc.). Change-Id: Ide74355b4054c78214c17f3b2d6fa2f5270e0ab9 --- includes/DefaultSettings.php | 8 ++++---- includes/Setup.php | 11 ++++++----- includes/installer/LocalSettingsGenerator.php | 3 --- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index c0aad5df04..f0450a9d74 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -211,7 +211,7 @@ $wgLoadScript = false; /** * The URL path of the skins directory. - * Defaults to "{$wgScriptPath}/skins". + * Defaults to "{$wgResourceBasePath}/skins". * @since 1.3 */ $wgStylePath = false; @@ -226,7 +226,7 @@ $wgLocalStylePath = false; /** * The URL path of the extensions directory. - * Defaults to "{$wgScriptPath}/extensions". + * Defaults to "{$wgResourceBasePath}/extensions". * @since 1.16 */ $wgExtensionAssetsPath = false; @@ -3473,8 +3473,8 @@ $wgResourceModuleSkinStyles = array(); $wgResourceLoaderSources = array(); /** - * Default 'remoteBasePath' value for instances of ResourceLoaderFileModule. - * If not set, then $wgScriptPath will be used as a fallback. + * The default 'remoteBasePath' value for instances of ResourceLoaderFileModule. + * Defaults to $wgScriptPath. */ $wgResourceBasePath = null; diff --git a/includes/Setup.php b/includes/Setup.php index 86df4b8667..6abef44831 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -68,17 +68,18 @@ if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) { $wgActionPaths['view'] = $wgArticlePath; } +if ( $wgResourceBasePath === null ) { + $wgResourceBasePath = $wgScriptPath; +} if ( $wgStylePath === false ) { - $wgStylePath = "$wgScriptPath/skins"; + $wgStylePath = "$wgResourceBasePath/skins"; } if ( $wgLocalStylePath === false ) { + // Avoid wgResourceBasePath here since that may point to a different domain (e.g. CDN) $wgLocalStylePath = "$wgScriptPath/skins"; } if ( $wgExtensionAssetsPath === false ) { - $wgExtensionAssetsPath = "$wgScriptPath/extensions"; -} -if ( $wgResourceBasePath === null ) { - $wgResourceBasePath = $wgScriptPath; + $wgExtensionAssetsPath = "$wgResourceBasePath/extensions"; } if ( $wgLogo === false ) { diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index 7b1cfdcc19..09b5929efb 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -332,9 +332,6 @@ if ( !defined( 'MEDIAWIKI' ) ) { ## https://www.mediawiki.org/wiki/Manual:Short_URL \$wgScriptPath = \"{$this->values['wgScriptPath']}\"; ${serverSetting} -## The relative URL path to the skins directory -\$wgStylePath = \"\$wgScriptPath/skins\"; -\$wgResourceBasePath = \$wgScriptPath; ## The relative URL path to the logo. Make sure you change this from the default, ## or else you'll overwrite your logo when you upgrade! -- 2.20.1