X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSetup.php;h=c8bb810e96f1d3763cbd71ec94ffbb11cc7de22a;hb=97d93d850c1b66941f70c8df9a888d626264b488;hp=a9969ddedfd8ce90063b95c4d8982a36fd403d20;hpb=6944ef5b4e29da51a3ace541b9d63204f604a1e9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Setup.php b/includes/Setup.php index a9969ddedf..c8bb810e96 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -25,23 +25,24 @@ if( !isset( $wgProfiling ) ) $wgProfiling = false; if ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) { - require_once( 'Profiling.php' ); + 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]"); - } - function wfGetProfilingOutput( $s, $e ) {} - function wfProfileClose() {} + 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]"); + } + function wfGetProfilingOutput( $s, $e ) {} + function wfProfileClose() {} + function wfLogProfilingData() {} } $fname = 'Setup.php'; @@ -51,7 +52,7 @@ wfProfileIn( $fname.'-includes' ); require_once( 'GlobalFunctions.php' ); require_once( 'Hooks.php' ); require_once( 'Namespace.php' ); -require_once( 'RecentChange.php' ); +require_once( 'RecentChange.php' ); require_once( 'User.php' ); require_once( 'Skin.php' ); require_once( 'OutputPage.php' ); @@ -61,7 +62,6 @@ 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' ); @@ -79,7 +79,7 @@ if ( $wgUseDynamicDates ) { wfProfileOut( $fname.'-includes' ); wfProfileIn( $fname.'-misc1' ); -$wgIP = wfGetIP(); +$wgIP = false; # Load on demand $wgRequest = new WebRequest(); # Useful debug output @@ -97,15 +97,12 @@ if ( $wgCommandLineMode ) { wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n" ); } -# Disable linkscc except if the old existence check method is enabled -if (!$wgUseOldExistenceCheck) { - $wgEnablePersistentLC = false; -} - if ( $wgSkipSkin ) { $wgSkipSkins[] = $wgSkipSkin; } +$wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist; + wfProfileOut( $fname.'-misc1' ); wfProfileIn( $fname.'-memcached' ); @@ -113,8 +110,8 @@ $wgMemc =& wfGetMainCache(); $messageMemc =& wfGetMessageCacheStorage(); $parserMemc =& wfGetParserCacheStorage(); -wfDebug( 'Main cache: ' . get_class( $wgMemc ) . - "\nMessage cache: " . get_class( $messageMemc ) . +wfDebug( 'Main cache: ' . get_class( $wgMemc ) . + "\nMessage cache: " . get_class( $messageMemc ) . "\nParser cache: " . get_class( $parserMemc ) . "\n" ); wfProfileOut( $fname.'-memcached' ); @@ -137,7 +134,7 @@ wfProfileOut( $fname.'-SetupSession' ); wfProfileIn( $fname.'-database' ); if ( !$wgDBservers ) { - $wgDBservers = array(array( + $wgDBservers = array(array( 'host' => $wgDBserver, 'user' => $wgDBuser, 'password' => $wgDBpassword, @@ -155,35 +152,7 @@ wfProfileIn( $fname.'-language1' ); require_once( "$IP/languages/Language.php" ); -wfProfileOut( $fname.'-language1' ); -wfProfileIn( $fname.'-User' ); - -# Skin setup functions -# Entries can be added to this variable during the inclusion -# of the extension file. Skins can then perform any necessary initialisation. -foreach ( $wgSkinExtensionFunctions as $func ) { - $func(); -} - -if( !is_object( $wgAuth ) ) { - require_once( 'AuthPlugin.php' ); - $wgAuth = new AuthPlugin(); -} - -if( $wgCommandLineMode ) { - # Used for some maintenance scripts; user session cookies can screw things up - # when the database is in an in-between state. - $wgUser = new User(); - # Prevent loading User settings from the DB. - $wgUser->setLoaded( true ); -} else { - $wgUser = User::loadFromSession(); -} - -wfProfileOut( $fname.'-User' ); -wfProfileIn( $fname.'-language2' ); - -function setupLangObj(&$langclass) { +function setupLangObj($langclass) { global $IP; if( ! class_exists( $langclass ) ) { @@ -215,15 +184,40 @@ $wgContLangClass = 'Language' . str_replace( '-', '_', ucfirst( $wgContLanguageC $wgContLang = setupLangObj( $wgContLangClass ); $wgContLang->initEncoding(); -// set default user option from content language -if( !$wgUser->mDataLoaded ) { - $wgUser->loadDefaultFromLanguage(); +wfProfileOut( $fname.'-language1' ); +wfProfileIn( $fname.'-User' ); + +# Skin setup functions +# Entries can be added to this variable during the inclusion +# of the extension file. Skins can then perform any necessary initialisation. +foreach ( $wgSkinExtensionFunctions as $func ) { + call_user_func( $func ); +} + +if( !is_object( $wgAuth ) ) { + require_once( 'AuthPlugin.php' ); + $wgAuth = new AuthPlugin(); +} + +if( $wgCommandLineMode ) { + # Used for some maintenance scripts; user session cookies can screw things up + # when the database is in an in-between state. + $wgUser = new User(); + # Prevent loading User settings from the DB. + $wgUser->setLoaded( true ); +} else { + $wgUser = User::loadFromSession(); } +wfProfileOut( $fname.'-User' ); +wfProfileIn( $fname.'-language2' ); + // wgLanguageCode now specifically means the UI language -$wgLanguageCode = $wgUser->getOption('language'); +$wgLanguageCode = $wgRequest->getText('uselang', ''); +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; } @@ -239,7 +233,7 @@ if( $wgLangClass == $wgContLangClass ) { $wgLang = setupLangObj( $wgLangClass ); } -wfProfileOut( $fname.'-language' ); +wfProfileOut( $fname.'-language2' ); wfProfileIn( $fname.'-MessageCache' ); $wgMessageCache = new MessageCache; @@ -254,14 +248,14 @@ wfProfileOut( $fname.'-MessageCache' ); # SEARCH INDEX UPDATES, AND MANY MANY THINGS. # DO NOT USE THIS MODE EXCEPT FOR TESTING RIGHT NOW. # -# To disable it, the easiest thing could be to uncomment the +# To disable it, the easiest thing could be to uncomment the # following; they should effectively disable the UI switch functionality # # $wgLangClass = $wgContLangClass; # $wgLanguageCode = $wgContLanguageCode; # $wgLang = $wgContLang; # -# TODO: Need to change reference to $wgLang to $wgContLang at proper +# TODO: Need to change reference to $wgLang to $wgContLang at proper # places, including namespaces, dates in signatures, magic words, # and links # @@ -274,11 +268,6 @@ wfProfileIn( $fname.'-OutputPage' ); $wgOut = new OutputPage(); wfProfileOut( $fname.'-OutputPage' ); -wfProfileIn( $fname.'-BlockCache' ); - -$wgBlockCache = new BlockCache( true ); - -wfProfileOut( $fname.'-BlockCache' ); wfProfileIn( $fname.'-misc2' ); $wgDeferredUpdateList = array(); @@ -307,11 +296,11 @@ wfProfileOut( $fname.'-misc2' ); wfProfileIn( $fname.'-extensions' ); # Extension setup functions for extensions other than skins -# Entries should be added to this variable during the inclusion -# of the extension file. This allows the extension to perform +# 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 foreach ( $wgExtensionFunctions as $func ) { - $func(); + call_user_func( $func ); } wfDebug( "\n" );