summaryrefslogtreecommitdiff
path: root/includes/Setup.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/Setup.php')
-rw-r--r--includes/Setup.php100
1 files changed, 60 insertions, 40 deletions
diff --git a/includes/Setup.php b/includes/Setup.php
index 7a89c7a3..dd8fbf8a 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -33,8 +33,10 @@ if ( !defined( 'MEDIAWIKI' ) ) {
}
$fname = 'Setup.php';
-wfProfileIn( $fname );
-wfProfileIn( $fname . '-defaults' );
+$ps_setup = Profiler::instance()->scopedProfileIn( $fname );
+
+// If any extensions are still queued, force load them
+ExtensionRegistry::getInstance()->loadFromQueue();
// Check to see if we are at the file scope
if ( !isset( $wgVersion ) ) {
@@ -43,6 +45,7 @@ if ( !isset( $wgVersion ) ) {
}
// Set various default paths sensibly...
+$ps_default = Profiler::instance()->scopedProfileIn( $fname . '-defaults' );
if ( $wgScript === false ) {
$wgScript = "$wgScriptPath/index$wgScriptExtension";
@@ -71,9 +74,6 @@ if ( $wgStylePath === false ) {
if ( $wgLocalStylePath === false ) {
$wgLocalStylePath = "$wgScriptPath/skins";
}
-if ( $wgStyleDirectory === false ) {
- $wgStyleDirectory = "$IP/skins";
-}
if ( $wgExtensionAssetsPath === false ) {
$wgExtensionAssetsPath = "$wgScriptPath/extensions";
}
@@ -137,6 +137,9 @@ if ( isset( $wgFooterIcons['poweredby'] )
) {
$wgFooterIcons['poweredby']['mediawiki']['src'] =
"$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
+ $wgFooterIcons['poweredby']['mediawiki']['srcset'] =
+ "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
+ "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
}
/**
@@ -289,8 +292,13 @@ call_user_func( function () use ( $wgValidSkinNames ) {
$factory->register( 'fallback', 'Fallback', function () {
return new SkinFallback;
} );
+ // Register a hidden skin for api output
+ $factory->register( 'apioutput', 'ApiOutput', function () {
+ return new SkinApi;
+ } );
} );
$wgSkipSkins[] = 'fallback';
+$wgSkipSkins[] = 'apioutput';
if ( $wgLocalInterwiki ) {
array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
@@ -301,6 +309,11 @@ if ( $wgSharedPrefix === false ) {
$wgSharedPrefix = $wgDBprefix;
}
+// Set default shared schema
+if ( $wgSharedSchema === false ) {
+ $wgSharedSchema = $wgDBmwschema;
+}
+
if ( !$wgCookiePrefix ) {
if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
$wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
@@ -346,10 +359,15 @@ if ( $wgMetaNamespace === false ) {
$wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
}
-// Default value is either the suhosin limit or -1 for unlimited
+// Default value is 2000 or the suhosin limit if it is between 1 and 2000
if ( $wgResourceLoaderMaxQueryLength === false ) {
- $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
- $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
+ $suhosinMaxValueLength = (int) ini_get( 'suhosin.get.max_value_length' );
+ if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
+ $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
+ } else {
+ $wgResourceLoaderMaxQueryLength = 2000;
+ }
+ unset($suhosinMaxValueLength);
}
/**
@@ -448,32 +466,28 @@ if ( $wgProfileOnly ) {
$wgDebugLogFile = '';
}
-wfProfileOut( $fname . '-defaults' );
+Profiler::instance()->scopedProfileOut( $ps_default );
// Disable MWDebug for command line mode, this prevents MWDebug from eating up
// all the memory from logging SQL queries on maintenance scripts
global $wgCommandLineMode;
if ( $wgDebugToolbar && !$wgCommandLineMode ) {
- wfProfileIn( $fname . '-debugtoolbar' );
MWDebug::init();
- wfProfileOut( $fname . '-debugtoolbar' );
}
if ( !class_exists( 'AutoLoader' ) ) {
require_once "$IP/includes/AutoLoader.php";
}
-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/normal/UtfNormalDefines.php";
-wfProfileOut( $fname . '-includes' );
+require_once "$IP/includes/libs/normal/UtfNormalUtil.php";
-wfProfileIn( $fname . '-defaults2' );
+$ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );
+
+if ( $wgScriptExtension !== '.php' || defined( 'MW_ENTRY_PHP5' ) ) {
+ wfWarn( 'Script extensions other than ".php" are deprecated.' );
+}
if ( $wgCanonicalServer === false ) {
$wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP );
@@ -504,16 +518,22 @@ if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
. 'HTTP or HTTPS. Disabling secure login.' );
}
-// Now that GlobalFunctions is loaded, set defaults that depend
-// on it.
+// Now that GlobalFunctions is loaded, set defaults that depend on it.
if ( $wgTmpDirectory === false ) {
- wfProfileIn( $fname . '-tempDir' );
+ $ps_tmpdir = Profiler::instance()->scopedProfileIn( $fname . '-tempDir' );
$wgTmpDirectory = wfTempDir();
- wfProfileOut( $fname . '-tempDir' );
+ Profiler::instance()->scopedProfileOut( $ps_tmpdir );
+}
+
+// We don't use counters anymore. Left here for extensions still
+// expecting this to exist. Should be removed sometime 1.26 or later.
+if ( !isset( $wgDisableCounters ) ) {
+ $wgDisableCounters = true;
}
-wfProfileOut( $fname . '-defaults2' );
-wfProfileIn( $fname . '-misc1' );
+Profiler::instance()->scopedProfileOut( $ps_default2 );
+
+$ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc1' );
// Raise the memory limit if it's too low
wfMemoryLimit();
@@ -555,24 +575,23 @@ if ( $wgCommandLineMode ) {
wfDebug( $debug );
}
-wfProfileOut( $fname . '-misc1' );
-wfProfileIn( $fname . '-memcached' );
+Profiler::instance()->scopedProfileOut( $ps_misc );
+$ps_memcached = Profiler::instance()->scopedProfileIn( $fname . '-memcached' );
$wgMemc = wfGetMainCache();
$messageMemc = wfGetMessageCacheStorage();
$parserMemc = wfGetParserCacheStorage();
-$wgLangConvMemc = wfGetLangConverterCacheStorage();
wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) .
', message: ' . get_class( $messageMemc ) .
', parser: ' . get_class( $parserMemc ) );
-wfProfileOut( $fname . '-memcached' );
+Profiler::instance()->scopedProfileOut( $ps_memcached );
// Most of the config is out, some might want to run hooks here.
-wfRunHooks( 'SetupAfterCache' );
+Hooks::run( 'SetupAfterCache' );
-wfProfileIn( $fname . '-session' );
+$ps_session = Profiler::instance()->scopedProfileIn( $fname . '-session' );
if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
// If session.auto_start is there, we can't touch session name
@@ -585,8 +604,8 @@ if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
}
}
-wfProfileOut( $fname . '-session' );
-wfProfileIn( $fname . '-globals' );
+Profiler::instance()->scopedProfileOut( $ps_session );
+$ps_globals = Profiler::instance()->scopedProfileIn( $fname . '-globals' );
/**
* @var Language $wgContLang
@@ -620,7 +639,7 @@ $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParser
if ( !is_object( $wgAuth ) ) {
$wgAuth = new AuthPlugin;
- wfRunHooks( 'AuthPluginSetup', array( &$wgAuth ) );
+ Hooks::run( 'AuthPluginSetup', array( &$wgAuth ) );
}
/**
@@ -634,8 +653,8 @@ $wgTitle = null;
*/
$wgDeferredUpdateList = array();
-wfProfileOut( $fname . '-globals' );
-wfProfileIn( $fname . '-extensions' );
+Profiler::instance()->scopedProfileOut( $ps_globals );
+$ps_extensions = Profiler::instance()->scopedProfileIn( $fname . '-extensions' );
// Extension setup functions for extensions other than skins
// Entries should be added to this variable during the inclusion
@@ -655,13 +674,14 @@ foreach ( $wgExtensionFunctions as $func ) {
$profName = $fname . '-extensions-' . strval( $func );
}
- wfProfileIn( $profName );
+ $ps_ext_func = Profiler::instance()->scopedProfileIn( $profName );
call_user_func( $func );
- wfProfileOut( $profName );
+ Profiler::instance()->scopedProfileOut( $ps_ext_func );
}
wfDebug( "Fully initialised\n" );
$wgFullyInitialised = true;
-wfProfileOut( $fname . '-extensions' );
-wfProfileOut( $fname );
+Profiler::instance()->scopedProfileOut( $ps_extensions );
+Profiler::instance()->scopedProfileOut( $ps_setup );
+