* (bug 1805) Initialise $wgContLang before $wgUser
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 16 Jun 2005 07:51:45 +0000 (07:51 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 16 Jun 2005 07:51:45 +0000 (07:51 +0000)
RELEASE-NOTES
includes/Setup.php
includes/User.php

index 794ca59..d8cbc22 100644 (file)
@@ -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 ===
 
index e098396..f7753f0 100644 (file)
@@ -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()
index e3287ab..3520a2e 100644 (file)
@@ -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