Remove ULSEnableAnon
I am not aware of anyone using this niche configuration where ULS visible interface is enabled only for logged in users. Simplify code and updated comments. Change-Id: I9f0a5969fdc76ca790d961ee3035fdb27ece9c0c
This commit is contained in:
@@ -66,16 +66,12 @@
|
||||
"description": "Enable language selection, compact language links, input methods and webfonts for everyone, unless the behavior is overridden by the configuration variables below. Even if false the classes and resource loader modules are registered for the use of other extensions. Language changing via cookie or setlang query parameter is not possible.",
|
||||
"value": true
|
||||
},
|
||||
"ULSEnableAnon": {
|
||||
"description": "Equivalent to $wgULSEnable for anonymous users only. Does not have any effect if $wgULSEnable is false.",
|
||||
"value": true
|
||||
},
|
||||
"ULSAnonCanChangeLanguage": {
|
||||
"description": "Allow anonymous users to change language with cookie and setlang query parameter. Do not use if you are caching anonymous page views without taking cookies into account. Does not have any effect if either of $wgULSEnable or $wgULSEnableAnon is set to false. @since 2013.04",
|
||||
"description": "Allow anonymous users to change language with cookie and setlang query parameter. Do not use if you are caching anonymous page views without taking cookies into account. Does not have any effect if $wgULSEnable is set to false. @since 2013.04",
|
||||
"value": true
|
||||
},
|
||||
"ULSLanguageDetection": {
|
||||
"description": "Try to use preferred interface language for anonymous users. Do not use if you are caching anonymous page views without taking Accept-Language into account. Does not have any effect if any of $wgULSEnable, or $wgULSEnableAnon is set to false.",
|
||||
"description": "Try to use preferred interface language for anonymous users. Do not use if you are caching anonymous page views without taking Accept-Language into account. Does not have any effect if $wgULSEnable is set to false.",
|
||||
"value": true
|
||||
},
|
||||
"ULSIMEEnabled": {
|
||||
|
||||
@@ -42,22 +42,14 @@ class UniversalLanguageSelectorHooks {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether ULS user toolbar (language selection and settings) is enabled.
|
||||
*
|
||||
* @param User $user
|
||||
* Whether user visible ULS features are enabled (language changing, input methods, web
|
||||
* fonts, language change undo tooltip).
|
||||
* @return bool
|
||||
*/
|
||||
private static function isToolbarEnabled( User $user ) {
|
||||
global $wgULSEnable, $wgULSEnableAnon;
|
||||
private static function isEnabled(): bool {
|
||||
global $wgULSEnable;
|
||||
|
||||
if ( !$wgULSEnable ) {
|
||||
return false;
|
||||
}
|
||||
if ( !$wgULSEnableAnon && $user->isAnon() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return (bool)$wgULSEnable;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,7 +122,7 @@ class UniversalLanguageSelectorHooks {
|
||||
$out->addModules( 'ext.uls.geoclient' );
|
||||
}
|
||||
|
||||
if ( self::isToolbarEnabled( $out->getUser() ) ) {
|
||||
if ( self::isEnabled() ) {
|
||||
// Enable UI language selection for the user.
|
||||
$out->addModules( 'ext.uls.interface' );
|
||||
}
|
||||
@@ -224,7 +216,7 @@ class UniversalLanguageSelectorHooks {
|
||||
return $personal_urls;
|
||||
}
|
||||
|
||||
if ( !self::isToolbarEnabled( $context->getUser() ) ) {
|
||||
if ( !self::isEnabled() ) {
|
||||
return $personal_urls;
|
||||
}
|
||||
|
||||
@@ -285,7 +277,7 @@ class UniversalLanguageSelectorHooks {
|
||||
$context->getOutput()->addVaryHeader( 'Accept-Language' );
|
||||
}
|
||||
|
||||
if ( !self::isToolbarEnabled( $user ) ) {
|
||||
if ( !self::isEnabled() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -485,7 +477,7 @@ class UniversalLanguageSelectorHooks {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !self::isToolbarEnabled( $skin->getUser() ) ) {
|
||||
if ( !self::isEnabled() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user