summaryrefslogtreecommitdiff
path: root/includes/StubObject.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/StubObject.php')
-rw-r--r--includes/StubObject.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/includes/StubObject.php b/includes/StubObject.php
index 63945f27..1501d963 100644
--- a/includes/StubObject.php
+++ b/includes/StubObject.php
@@ -89,9 +89,16 @@ class StubUserLang extends StubObject {
function _newObject() {
global $wgContLanguageCode, $wgRequest, $wgUser, $wgContLang;
- $code = $wgRequest->getVal('uselang', '');
- if ($code == '')
- $code = $wgUser->getOption('language');
+ $code = $wgRequest->getVal('uselang', $wgUser->getOption('language') );
+
+ // if variant is explicitely selected, use it instead the one from wgUser
+ // see bug #7605
+ if($wgContLang->hasVariants()){
+ $variant = $wgContLang->getPreferredVariant();
+ if($variant != $wgContLanguageCode)
+ $code = $variant;
+ }
+
# Validate $code
if( empty( $code ) || !preg_match( '/^[a-z]+(-[a-z]+)?$/', $code ) ) {
$code = $wgContLanguageCode;
@@ -118,9 +125,8 @@ class StubUser extends StubObject {
global $wgCommandLineMode;
if( $wgCommandLineMode ) {
$user = new User;
- $user->setLoaded( true );
} else {
- $user = User::loadFromSession();
+ $user = User::newFromSession();
wfRunHooks('AutoAuthenticate',array(&$user));
}
return $user;