summaryrefslogtreecommitdiff
path: root/includes/Setup.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/Setup.php')
-rw-r--r--includes/Setup.php89
1 files changed, 67 insertions, 22 deletions
diff --git a/includes/Setup.php b/includes/Setup.php
index 1b6d66c0..905a1d10 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 ) {
@@ -105,6 +106,10 @@ if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
$wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
}
+if ( $wgEnableParserCache === false ) {
+ $wgParserCacheType = CACHE_NONE;
+}
+
// Fix path to icon images after they were moved in 1.24
if ( $wgRightsIcon ) {
$wgRightsIcon = str_replace(
@@ -359,13 +364,13 @@ if ( $wgMetaNamespace === false ) {
// Default value is 2000 or the suhosin limit if it is between 1 and 2000
if ( $wgResourceLoaderMaxQueryLength === false ) {
- $suhosinMaxValueLength = (int) ini_get( 'suhosin.get.max_value_length' );
+ $suhosinMaxValueLength = (int)ini_get( 'suhosin.get.max_value_length' );
if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
$wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
} else {
$wgResourceLoaderMaxQueryLength = 2000;
}
- unset($suhosinMaxValueLength);
+ unset( $suhosinMaxValueLength );
}
// Ensure the minimum chunk size is less than PHP upload limits or the maximum
@@ -434,12 +439,12 @@ if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
}
// Blacklisted file extensions shouldn't appear on the "allowed" list
-$wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
+$wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) );
if ( $wgInvalidateCacheOnLocalSettingsChange ) {
- // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet.
- $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
- // @codingStandardsIgnoreEnd
+ MediaWiki\suppressWarnings();
+ $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( "$IP/LocalSettings.php" ) ) );
+ MediaWiki\restoreWarnings();
}
if ( $wgNewUserLog ) {
@@ -473,6 +478,21 @@ if ( $wgProfileOnly ) {
$wgDebugLogFile = '';
}
+// Backwards compatibility with old password limits
+if ( $wgMinimalPasswordLength !== false ) {
+ $wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = $wgMinimalPasswordLength;
+}
+
+if ( $wgMaximalPasswordLength !== false ) {
+ $wgPasswordPolicy['policies']['default']['MaximalPasswordLength'] = $wgMaximalPasswordLength;
+}
+
+// Backwards compatibility with deprecated alias
+// Must be before call to wfSetupSession()
+if ( $wgSessionsInMemcached ) {
+ $wgSessionsInObjectCache = true;
+}
+
Profiler::instance()->scopedProfileOut( $ps_default );
// Disable MWDebug for command line mode, this prevents MWDebug from eating up
@@ -488,7 +508,22 @@ if ( !class_exists( 'AutoLoader' ) ) {
MWExceptionHandler::installHandler();
-require_once "$IP/includes/libs/normal/UtfNormalUtil.php";
+require_once "$IP/includes/compat/normal/UtfNormalUtil.php";
+
+
+$ps_validation = Profiler::instance()->scopedProfileIn( $fname . '-validation' );
+
+// T48998: Bail out early if $wgArticlePath is non-absolute
+if ( !preg_match( '/^(https?:\/\/|\/)/', $wgArticlePath ) ) {
+ throw new FatalError(
+ 'If you use a relative URL for $wgArticlePath, it must start ' .
+ 'with a slash (<code>/</code>).<br><br>See ' .
+ '<a href="https://www.mediawiki.org/wiki/Manual:$wgArticlePath">' .
+ 'https://www.mediawiki.org/wiki/Manual:$wgArticlePath</a>.'
+ );
+}
+
+Profiler::instance()->scopedProfileOut( $ps_validation );
$ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );
@@ -525,11 +560,11 @@ if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
. 'HTTP or HTTPS. Disabling secure login.' );
}
+$wgVirtualRestConfig['global']['domain'] = $wgCanonicalServer;
+
// Now that GlobalFunctions is loaded, set defaults that depend on it.
if ( $wgTmpDirectory === false ) {
- $ps_tmpdir = Profiler::instance()->scopedProfileIn( $fname . '-tempDir' );
$wgTmpDirectory = wfTempDir();
- Profiler::instance()->scopedProfileOut( $ps_tmpdir );
}
// We don't use counters anymore. Left here for extensions still
@@ -538,6 +573,18 @@ if ( !isset( $wgDisableCounters ) ) {
$wgDisableCounters = true;
}
+if ( $wgMainWANCache === false ) {
+ // Setup a WAN cache from $wgMainCacheType with no relayer.
+ // Sites using multiple datacenters can configure a relayer.
+ $wgMainWANCache = 'mediawiki-main-default';
+ $wgWANObjectCaches[$wgMainWANCache] = array(
+ 'class' => 'WANObjectCache',
+ 'cacheId' => $wgMainCacheType,
+ 'pool' => 'mediawiki-main-default',
+ 'relayerConfig' => array( 'class' => 'EventRelayerNull' )
+ );
+}
+
Profiler::instance()->scopedProfileOut( $ps_default2 );
$ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc1' );
@@ -551,9 +598,9 @@ wfMemoryLimit();
* explicitly set. Inspired by phpMyAdmin's treatment of the problem.
*/
if ( is_null( $wgLocaltimezone ) ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$wgLocaltimezone = date_default_timezone_get();
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
date_default_timezone_set( $wgLocaltimezone );
@@ -561,6 +608,10 @@ if ( is_null( $wgLocalTZoffset ) ) {
$wgLocalTZoffset = date( 'Z' ) / 60;
}
+if ( !$wgDBerrorLogTZ ) {
+ $wgDBerrorLogTZ = $wgLocaltimezone;
+}
+
// Useful debug output
if ( $wgCommandLineMode ) {
$wgRequest = new FauxRequest( array() );
@@ -654,12 +705,6 @@ if ( !is_object( $wgAuth ) ) {
*/
$wgTitle = null;
-/**
- * @deprecated since 1.24 Use DeferredUpdates::addUpdate instead
- * @var array
- */
-$wgDeferredUpdateList = array();
-
Profiler::instance()->scopedProfileOut( $ps_globals );
$ps_extensions = Profiler::instance()->scopedProfileIn( $fname . '-extensions' );