From 8426ece183e37dcc4e45197d4bb908fc2586769a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 16 Jun 2005 07:51:45 +0000 Subject: [PATCH] * (bug 1805) Initialise $wgContLang before $wgUser --- RELEASE-NOTES | 2 ++ includes/Setup.php | 57 +++++++++++++++++++++------------------------- includes/User.php | 14 +----------- 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 794ca59a9b..d8cbc2296d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -294,6 +294,8 @@ Various bugfixes, small features, and a few experimental things: * (bug 1702) Display a handy upload link instead of a useless blank link for [[media:]] links to nonexistent files. * (bug 873) Fix usage of createaccount permission; replaces $wgWhitelistAccount +* (bug 1805) Initialise $wgContLang before $wgUser + === Caveats === diff --git a/includes/Setup.php b/includes/Setup.php index e098396665..f7753f08b4 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -150,34 +150,6 @@ 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) { global $IP; @@ -210,11 +182,34 @@ $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 ) { + $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'); # Validate $wgLanguageCode, which will soon be sent to an eval() diff --git a/includes/User.php b/includes/User.php index e3287abb22..3520a2e30b 100644 --- a/includes/User.php +++ b/includes/User.php @@ -201,10 +201,7 @@ class User { $this->mPassword = $this->mNewpassword = ''; $this->mRights = array(); $this->mGroups = array(); - // Getting user defaults only if we have an available language - if( isset( $wgContLang ) ) { - $this->loadDefaultFromLanguage(); - } + $this->mOptions = User::getDefaultOptions(); foreach( $wgNamespacesToBeSearchedDefault as $nsnum => $val ) { $this->mOptions['searchNs'.$nsnum] = $val; @@ -224,15 +221,6 @@ class User { wfProfileOut( $fname ); } - - /** - * Used to load user options from a language. - * This is not in loadDefault() cause we sometime create user before having - * a language object. - */ - function loadDefaultFromLanguage(){ - $this->mOptions = User::getDefaultOptions(); - } /** * Combine the language default options with any site-specific options -- 2.20.1