// Check to see if we are at the file scope
if ( !isset( $wgVersion ) ) {
- die( "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n" );
+ echo "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n";
+ die( -1 );
}
if( !isset( $wgProfiling ) )
$wgProfiling = false;
-if ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) {
+if ( function_exists( 'wfProfileIn' ) ) {
+ /* nada, everything should be done already */
+} elseif ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) {
require_once( 'Profiling.php' );
-} else {
- function wfProfileIn( $fn = '' ) {
- global $hackwhere, $wgDBname;
- $hackwhere[] = $fn;
- if (function_exists("setproctitle"))
- setproctitle($fn . " [$wgDBname]");
- }
- function wfProfileOut( $fn = '' ) {
- global $hackwhere, $wgDBname;
- if (count($hackwhere))
- array_pop($hackwhere);
- if (function_exists("setproctitle") && count($hackwhere))
- setproctitle($hackwhere[count($hackwhere)-1] . " [$wgDBname]");
+ $wgProfiling = true;
+ if ($wgProfilerType == "") {
+ $wgProfiler = new Profiler();
+ } else {
+ $prclass="Profiler{$wgProfilerType}";
+ require_once( $prclass.".php" );
+ $wgProfiler = new $prclass();
}
- function wfGetProfilingOutput( $s, $e ) {}
- function wfProfileClose() {}
- function wfLogProfilingData() {}
+} else {
+ require_once( 'ProfilerStub.php' );
}
$fname = 'Setup.php';
require_once( 'GlobalFunctions.php' );
require_once( 'Hooks.php' );
require_once( 'Namespace.php' );
-require_once( 'RecentChange.php' );
require_once( 'User.php' );
require_once( 'Skin.php' );
require_once( 'OutputPage.php' );
require_once( 'LinkCache.php' );
+require_once( 'LinkBatch.php' );
require_once( 'Title.php' );
require_once( 'Article.php' );
require_once( 'MagicWord.php' );
require_once( 'Block.php' );
require_once( 'MessageCache.php' );
-require_once( 'BlockCache.php' );
require_once( 'Parser.php' );
require_once( 'ParserCache.php' );
require_once( 'WebRequest.php' );
wfProfileOut( $fname.'-includes' );
wfProfileIn( $fname.'-misc1' );
-$wgIP = wfGetIP();
+$wgIP = false; # Load on demand
$wgRequest = new WebRequest();
-
+if ( function_exists( 'posix_uname' ) ) {
+ $wguname = posix_uname();
+}
# Useful debug output
if ( $wgCommandLineMode ) {
# wfDebug( '"' . implode( '" "', $argv ) . '"' );
}
if( !$wgCommandLineMode && ( isset( $_COOKIE[session_name()] ) || isset( $_COOKIE[$wgDBname.'Token'] ) ) ) {
+ wfIncrStats( 'request_with_session' );
User::SetupSession();
$wgSessionStarted = true;
} else {
+ wfIncrStats( 'request_without_session' );
$wgSessionStarted = false;
}
# Skin setup functions
# Entries can be added to this variable during the inclusion
# of the extension file. Skins can then perform any necessary initialisation.
+#
+# require_once is slow even on the second call, so this needs to be outside the loop
+if ( count( $wgSkinExtensionFunctions ) ) {
+ require_once( 'PersistentObject.php' );
+}
foreach ( $wgSkinExtensionFunctions as $func ) {
- $func();
+ call_user_func( $func );
}
if( !is_object( $wgAuth ) ) {
# Prevent loading User settings from the DB.
$wgUser->setLoaded( true );
} else {
- $wgUser = User::loadFromSession();
+ $wgUser = null;
+ wfRunHooks('AutoAuthenticate',array(&$wgUser));
+ if ($wgUser === null) {
+ $wgUser = User::loadFromSession();
+ }
}
wfProfileOut( $fname.'-User' );
if ($wgLanguageCode == '')
$wgLanguageCode = $wgUser->getOption('language');
# Validate $wgLanguageCode, which will soon be sent to an eval()
-if( empty( $wgLanguageCode ) || preg_match( '/^[^a-z-]*$/', $wgLanguageCode ) ) {
+if( empty( $wgLanguageCode ) || !preg_match( '/^[a-z]+(-[a-z]+)?$/', $wgLanguageCode ) ) {
$wgLanguageCode = $wgContLanguageCode;
}
$wgOut = new OutputPage();
wfProfileOut( $fname.'-OutputPage' );
-wfProfileIn( $fname.'-BlockCache' );
-
-$wgBlockCache = new BlockCache( true );
-
-wfProfileOut( $fname.'-BlockCache' );
wfProfileIn( $fname.'-misc2' );
$wgDeferredUpdateList = array();
$wgPostCommitUpdateList = array();
-$wgLinkCache = new LinkCache();
$wgMagicWords = array();
$wgMwRedir =& MagicWord::get( MAG_REDIRECT );
-$wgParserCache = new ParserCache( $messageMemc );
if ( $wgUseXMLparser ) {
require_once( 'ParserXML.php' );
# Entries should be added to this variable during the inclusion
# of the extension file. This allows the extension to perform
# any necessary initialisation in the fully initialised environment
+if ( count( $wgExtensionFunctions ) ) {
+ require_once( 'PersistentObject.php' );
+}
foreach ( $wgExtensionFunctions as $func ) {
- $func();
+ call_user_func( $func );
}
wfDebug( "\n" );