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:
Niklas Laxström
2021-07-23 10:10:21 +03:00
committed by Abijeet
parent f189e42801
commit 36d79be608
2 changed files with 11 additions and 23 deletions

View File

@@ -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;
}