summaryrefslogtreecommitdiff
path: root/includes/Setup.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/Setup.php')
-rw-r--r--includes/Setup.php153
1 files changed, 97 insertions, 56 deletions
diff --git a/includes/Setup.php b/includes/Setup.php
index e87b200f..2e083d83 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -44,9 +44,12 @@ if ( !isset( $wgVersion ) ) {
}
// Set various default paths sensibly...
-if ( $wgScript === false ) $wgScript = "$wgScriptPath/index$wgScriptExtension";
-if ( $wgRedirectScript === false ) $wgRedirectScript = "$wgScriptPath/redirect$wgScriptExtension";
-if ( $wgLoadScript === false ) $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
+if ( $wgScript === false ) {
+ $wgScript = "$wgScriptPath/index$wgScriptExtension";
+}
+if ( $wgLoadScript === false ) {
+ $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
+}
if ( $wgArticlePath === false ) {
if ( $wgUsePathInfo ) {
@@ -62,24 +65,38 @@ if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
$wgActionPaths['view'] = $wgArticlePath;
}
-if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
- # 'view' is assumed the default action path everywhere in the code
- # but is rarely filled in $wgActionPaths
- $wgActionPaths['view'] = $wgArticlePath;
+if ( $wgStylePath === false ) {
+ $wgStylePath = "$wgScriptPath/skins";
+}
+if ( $wgLocalStylePath === false ) {
+ $wgLocalStylePath = "$wgScriptPath/skins";
+}
+if ( $wgStyleDirectory === false ) {
+ $wgStyleDirectory = "$IP/skins";
+}
+if ( $wgExtensionAssetsPath === false ) {
+ $wgExtensionAssetsPath = "$wgScriptPath/extensions";
}
-if ( $wgStylePath === false ) $wgStylePath = "$wgScriptPath/skins";
-if ( $wgLocalStylePath === false ) $wgLocalStylePath = "$wgScriptPath/skins";
-if ( $wgStyleDirectory === false ) $wgStyleDirectory = "$IP/skins";
-if ( $wgExtensionAssetsPath === false ) $wgExtensionAssetsPath = "$wgScriptPath/extensions";
-
-if ( $wgLogo === false ) $wgLogo = "$wgStylePath/common/images/wiki.png";
+if ( $wgLogo === false ) {
+ $wgLogo = "$wgStylePath/common/images/wiki.png";
+}
-if ( $wgUploadPath === false ) $wgUploadPath = "$wgScriptPath/images";
-if ( $wgUploadDirectory === false ) $wgUploadDirectory = "$IP/images";
-if ( $wgReadOnlyFile === false ) $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
-if ( $wgFileCacheDirectory === false ) $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
-if ( $wgDeletedDirectory === false ) $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
+if ( $wgUploadPath === false ) {
+ $wgUploadPath = "$wgScriptPath/images";
+}
+if ( $wgUploadDirectory === false ) {
+ $wgUploadDirectory = "$IP/images";
+}
+if ( $wgReadOnlyFile === false ) {
+ $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
+}
+if ( $wgFileCacheDirectory === false ) {
+ $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
+}
+if ( $wgDeletedDirectory === false ) {
+ $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
+}
if ( isset( $wgFileStore['deleted']['directory'] ) ) {
$wgDeletedDirectory = $wgFileStore['deleted']['directory'];
@@ -130,13 +147,13 @@ $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
* Initialise $wgLockManagers to include basic FS version
*/
$wgLockManagers[] = array(
- 'name' => 'fsLockManager',
- 'class' => 'FSLockManager',
+ 'name' => 'fsLockManager',
+ 'class' => 'FSLockManager',
'lockDirectory' => "{$wgUploadDirectory}/lockdir",
);
$wgLockManagers[] = array(
- 'name' => 'nullLockManager',
- 'class' => 'NullLockManager',
+ 'name' => 'nullLockManager',
+ 'class' => 'NullLockManager',
);
/**
@@ -202,15 +219,15 @@ if ( $wgUseSharedUploads ) {
}
if ( $wgUseInstantCommons ) {
$wgForeignFileRepos[] = array(
- 'class' => 'ForeignAPIRepo',
- 'name' => 'wikimediacommons',
- 'apibase' => WebRequest::detectProtocol() === 'https' ?
+ 'class' => 'ForeignAPIRepo',
+ 'name' => 'wikimediacommons',
+ 'apibase' => WebRequest::detectProtocol() === 'https' ?
'https://commons.wikimedia.org/w/api.php' :
'http://commons.wikimedia.org/w/api.php',
- 'hashLevels' => 2,
- 'fetchDescription' => true,
+ 'hashLevels' => 2,
+ 'fetchDescription' => true,
'descriptionCacheExpiry' => 43200,
- 'apiThumbCacheExpiry' => 86400,
+ 'apiThumbCacheExpiry' => 86400,
);
}
/*
@@ -276,6 +293,13 @@ if ( $wgMetaNamespace === false ) {
$wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
}
+
+// Default value is either the suhosin limit or -1 for unlimited
+if ( $wgResourceLoaderMaxQueryLength === false ) {
+ $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
+ $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
+}
+
/**
* Definitions of the NS_ constants are in Defines.php
* @private
@@ -301,7 +325,7 @@ $wgCanonicalNamespaceNames = array(
);
/// @todo UGLY UGLY
-if( is_array( $wgExtraNamespaces ) ) {
+if ( is_array( $wgExtraNamespaces ) ) {
$wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
}
@@ -323,11 +347,17 @@ if ( !$wgEnotifMinorEdits ) {
}
# $wgDisabledActions is deprecated as of 1.18
-foreach( $wgDisabledActions as $action ) {
+foreach ( $wgDisabledActions as $action ) {
$wgActions[$action] = false;
}
-if ( !$wgHtml5Version && $wgHtml5 && $wgAllowRdfaAttributes ) {
+# We always output HTML5 since 1.22, overriding these is no longer supported
+# we set them here for extensions that depend on its value.
+$wgHtml5 = true;
+$wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
+$wgJsMimeType = 'text/javascript';
+
+if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
# see http://www.w3.org/TR/rdfa-in-html/#document-conformance
if ( $wgMimeType == 'application/xhtml+xml' ) {
$wgHtml5Version = 'XHTML+RDFa 1.0';
@@ -347,10 +377,6 @@ if ( $wgInvalidateCacheOnLocalSettingsChange ) {
$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
}
-if ( $wgAjaxUploadDestCheck ) {
- $wgAjaxExportList[] = 'SpecialUpload::ajaxGetExistsWarning';
-}
-
if ( $wgNewUserLog ) {
# Add a new log type
$wgLogTypes[] = 'newusers';
@@ -367,6 +393,15 @@ if ( $wgCookieSecure === 'detect' ) {
$wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
}
+if ( $wgRC2UDPAddress ) {
+ $wgRCFeeds['default'] = array(
+ 'formatter' => 'IRCColourfulRCFeedFormatter',
+ 'uri' => "udp://$wgRC2UDPAddress:$wgRC2UDPPort/$wgRC2UDPPrefix",
+ 'add_interwiki_prefix' => &$wgRC2UDPInterwikiPrefix,
+ 'omit_bots' => &$wgRC2UDPOmitBots,
+ );
+}
+
// Disable MWDebug for command line mode, this prevents MWDebug from eating up
// all the memory from logging SQL queries on maintenance scripts
global $wgCommandLineMode;
@@ -374,22 +409,20 @@ if ( $wgDebugToolbar && !$wgCommandLineMode ) {
MWDebug::init();
}
-if ( !defined( 'MW_COMPILED' ) ) {
- if ( !MWInit::classExists( 'AutoLoader' ) ) {
- require_once( "$IP/includes/AutoLoader.php" );
- }
+if ( !class_exists( 'AutoLoader' ) ) {
+ require_once "$IP/includes/AutoLoader.php";
+}
- wfProfileIn( $fname . '-exception' );
- MWExceptionHandler::installHandler();
- wfProfileOut( $fname . '-exception' );
+wfProfileIn( $fname . '-exception' );
+MWExceptionHandler::installHandler();
+wfProfileOut( $fname . '-exception' );
- wfProfileIn( $fname . '-includes' );
- require_once( "$IP/includes/normal/UtfNormalUtil.php" );
- require_once( "$IP/includes/GlobalFunctions.php" );
- require_once( "$IP/includes/ProxyTools.php" );
- require_once( "$IP/includes/normal/UtfNormalDefines.php" );
- wfProfileOut( $fname . '-includes' );
-}
+wfProfileIn( $fname . '-includes' );
+require_once "$IP/includes/normal/UtfNormalUtil.php";
+require_once "$IP/includes/GlobalFunctions.php";
+require_once "$IP/includes/ProxyTools.php";
+require_once "$IP/includes/normal/UtfNormalDefines.php";
+wfProfileOut( $fname . '-includes' );
if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
$wgSecureLogin = false;
@@ -406,9 +439,16 @@ if ( $wgCanonicalServer === false ) {
$wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP );
}
-// Initialize $wgHTCPMulticastRouting from backwards-compatible settings
-if ( !$wgHTCPMulticastRouting && $wgHTCPMulticastAddress ) {
- $wgHTCPMulticastRouting = array(
+// $wgHTCPMulticastRouting got renamed to $wgHTCPRouting in MediaWiki 1.22
+// ensure back compatibility.
+if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) {
+ $wgHTCPRouting = $wgHTCPMulticastRouting;
+}
+
+// Initialize $wgHTCPRouting from backwards-compatible settings that
+// comes from pre 1.20 version.
+if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) {
+ $wgHTCPRouting = array(
'' => array(
'host' => $wgHTCPMulticastAddress,
'port' => $wgHTCPPort,
@@ -426,14 +466,14 @@ wfMemoryLimit();
* that happens whenever you use a date function without the timezone being
* explicitly set. Inspired by phpMyAdmin's treatment of the problem.
*/
-if ( is_null( $wgLocaltimezone) ) {
+if ( is_null( $wgLocaltimezone ) ) {
wfSuppressWarnings();
$wgLocaltimezone = date_default_timezone_get();
wfRestoreWarnings();
}
date_default_timezone_set( $wgLocaltimezone );
-if( is_null( $wgLocalTZoffset ) ) {
+if ( is_null( $wgLocalTZoffset ) ) {
$wgLocalTZoffset = date( 'Z' ) / 60;
}
@@ -539,10 +579,11 @@ foreach ( $wgExtensionFunctions as $func ) {
if ( is_object( $func ) && $func instanceof Closure ) {
$profName = $fname . '-extensions-closure';
} elseif ( is_array( $func ) ) {
- if ( is_object( $func[0] ) )
+ if ( is_object( $func[0] ) ) {
$profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
- else
+ } else {
$profName = $fname . '-extensions-' . implode( '::', $func );
+ }
} else {
$profName = $fname . '-extensions-' . strval( $func );
}