jenkins-bot has submitted this change and it was merged.

Change subject: Don't enable the UI if CentralAuth is not installed
......................................................................


Don't enable the UI if CentralAuth is not installed

Bug: T90010
Change-Id: I7bc1cbf190e052d7e6226a87b71ac67d9db96def
---
M WikiGrok.php
M includes/Hooks.php
2 files changed, 12 insertions(+), 3 deletions(-)

Approvals:
  Kaldari: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/WikiGrok.php b/WikiGrok.php
index 959168b..e0f5453 100644
--- a/WikiGrok.php
+++ b/WikiGrok.php
@@ -165,6 +165,7 @@
 
 /**
  * Controls whether the WikiGrok UI is enabled
+ * For WikiGrok UI to show up CentralAuth needs to be installed too.
  */
 $wgWikiGrokUIEnable = false;
 
diff --git a/includes/Hooks.php b/includes/Hooks.php
index e3593a2..876d324 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -19,6 +19,14 @@
  * Hook handlers class
  */
 class Hooks {
+       /**
+        * Utility function for determining whether the UI is enabled
+        * @return bool
+        */
+       protected function isUIEnabled() {
+               $config = self::getConfig();
+               return $config->get( 'WikiGrokUIEnable') && class_exists( 
'ApiCentralAuthToken' );
+       }
 
        /**
         * OutputPageParserOutput hook handler
@@ -226,7 +234,7 @@
                $config = self::getConfig();
                $inBeta = MobileContext::singleton()->isBetaGroupMember();
 
-               if ( $config->get( 'WikiGrokUIEnable') ) {
+               if ( self::isUIEnabled() ) {
                        $out->addModules( 'ext.wikigrok.startup' );
 
                        if ( $inBeta && $config->get( 
'WikiGrokUIEnableInSidebar' ) ) {
@@ -247,8 +255,8 @@
        public static function onMinervaDiscoveryTools( &$items ) {
                $config = self::getConfig();
 
-               if ( MobileContext::singleton()->isBetaGroupMember() &&
-                       $config->get( 'WikiGrokUIEnable') &&
+               if ( self::isUIEnabled() &&
+                       MobileContext::singleton()->isBetaGroupMember() &&
                        $config->get( 'WikiGrokUIEnableInSidebar' )
                ) {
                        $items += array(

-- 
To view, visit https://gerrit.wikimedia.org/r/191779
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7bc1cbf190e052d7e6226a87b71ac67d9db96def
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/WikiGrok
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to