Allow ULS toolbar to be disabled for anons only
Per Daniel's request on bug 42157 Change-Id: I5df826f0466bf20729c7969cb7b549e41016c194
This commit is contained in:
@@ -19,6 +19,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class UniversalLanguageSelectorHooks {
|
class UniversalLanguageSelectorHooks {
|
||||||
|
public static function isToolbarEnabled() {
|
||||||
|
global $wgULSEnable, $wgULSEnableAnon;
|
||||||
|
if ( !$wgULSEnable ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( !$wgULSEnableAnon ) {
|
||||||
|
$user = RequestContext::getMain()->getUser();
|
||||||
|
if ( $user->isAnon() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BeforePageDisplay hook handler.
|
* BeforePageDisplay hook handler.
|
||||||
* @param $out OutputPage
|
* @param $out OutputPage
|
||||||
@@ -26,8 +40,7 @@ class UniversalLanguageSelectorHooks {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function addModules( $out, $skin ) {
|
public static function addModules( $out, $skin ) {
|
||||||
global $wgULSEnable;
|
if ( !self::isToolbarEnabled() ) {
|
||||||
if ( !$wgULSEnable ) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,8 +72,8 @@ class UniversalLanguageSelectorHooks {
|
|||||||
* Hooks: SkinTemplateNavigation, SkinTemplateTabs
|
* Hooks: SkinTemplateNavigation, SkinTemplateTabs
|
||||||
*/
|
*/
|
||||||
static function addTrigger( array &$personal_urls, &$title ) {
|
static function addTrigger( array &$personal_urls, &$title ) {
|
||||||
global $wgULSEnable, $wgLang;
|
global $wgLang;
|
||||||
if ( !$wgULSEnable ) {
|
if ( !self::isToolbarEnabled() ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,9 +135,8 @@ class UniversalLanguageSelectorHooks {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function getLanguage( $user, &$code ) {
|
public static function getLanguage( $user, &$code ) {
|
||||||
global $wgULSEnable, $wgRequest, $wgULSLanguageDetection;
|
global $wgRequest, $wgULSLanguageDetection;
|
||||||
|
if ( !self::isToolbarEnabled() ) {
|
||||||
if ( !$wgULSEnable ) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,13 @@ $wgULSLanguageDetection = true;
|
|||||||
*/
|
*/
|
||||||
$wgULSEnable = true;
|
$wgULSEnable = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable ULS language selection for anonymous users. Equivalent to $wgULSEnable
|
||||||
|
* except that it only applies to anonymous users. Setting this to false will
|
||||||
|
* avoid breaking Squid caches (see bug 41451).
|
||||||
|
*/
|
||||||
|
$wgULSEnableAnon = true;
|
||||||
|
|
||||||
$dir = __DIR__;
|
$dir = __DIR__;
|
||||||
|
|
||||||
// Internationalization
|
// Internationalization
|
||||||
|
|||||||
Reference in New Issue
Block a user