Update to match core changes in Idc11b547

Change-Id: I5481df33c7056cf2c661527f6ed3cf2374b6a0bf
This commit is contained in:
Niklas Laxström
2013-01-18 08:25:40 +00:00
parent 9b72969b07
commit dfcade7f69

View File

@@ -133,7 +133,7 @@ class UniversalLanguageSelectorHooks {
* @param $code String * @param $code String
* @return bool * @return bool
*/ */
public static function getLanguage( $user, &$code, $request = null ) { public static function getLanguage( $user, &$code, $context = null ) {
global $wgUser, $wgRequest, $wgULSLanguageDetection; global $wgUser, $wgRequest, $wgULSLanguageDetection;
if ( !self::isToolbarEnabled( $user ) ) { if ( !self::isToolbarEnabled( $user ) ) {
return true; return true;
@@ -142,13 +142,15 @@ class UniversalLanguageSelectorHooks {
/* Before $request is passed to this, check if the given user /* Before $request is passed to this, check if the given user
* name matches the current user name to detect if we are not * name matches the current user name to detect if we are not
* running in the primary request context. See bug 44010 */ * running in the primary request context. See bug 44010 */
if ( $request === null ) { if ( !$context instanceof RequestContext ) {
if ( $wgUser->getName() !== $user->getName() ) { if ( $wgUser->getName() !== $user->getName() ) {
return true; return true;
} }
// Should be safe to use the global request now // Should be safe to use the global request now
$request = $wgRequest; $request = $wgRequest;
} else {
$request = $context->getRequest();
} }
$languageToSave = $request->getVal( 'setlang' ); $languageToSave = $request->getVal( 'setlang' );