Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/166363

Change subject: Add $wgGadgetsEnableLegacyGadgets to allow for disabling of 
legacy gadgets
......................................................................

Add $wgGadgetsEnableLegacyGadgets to allow for disabling of legacy gadgets

So we can turn them off in preparation of Gadgets 2.0, which
doesn't support them at all.

Change-Id: I98b4146579ccbbfcad8b83a51cc095da1fad673c
---
M GadgetHooks.php
M Gadgets.php
2 files changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gadgets 
refs/changes/63/166363/1

diff --git a/GadgetHooks.php b/GadgetHooks.php
index ee1f408..69175cc 100644
--- a/GadgetHooks.php
+++ b/GadgetHooks.php
@@ -167,6 +167,7 @@
         * @return bool
         */
        public static function beforePageDisplay( $out ) {
+               global $wgGadgetsEnableLegacyGadgets;
                wfProfileIn( __METHOD__ );
 
                $gadgets = Gadget::loadList();
@@ -197,9 +198,11 @@
                        }
                }
 
-
-               // Allow other extensions, e.g. MobileFrontend, to disallow 
legacy gadgets
-               if ( wfRunHooks( 'Gadgets::allowLegacy', array( 
$out->getContext() ) ) ) {
+               // Check if legacy gadgets are even enabled
+               if ( $wgGadgetsEnableLegacyGadgets &&
+                       // Allow other extensions, e.g. MobileFrontend, to 
disallow legacy gadgets
+                       wfRunHooks( 'Gadgets::allowLegacy', array( 
$out->getContext() ) )
+               ) {
                        $lb->execute( __METHOD__ );
 
                        $done = array();
diff --git a/Gadgets.php b/Gadgets.php
index de0b46c..a09095f 100644
--- a/Gadgets.php
+++ b/Gadgets.php
@@ -57,3 +57,8 @@
  * Whether the gadget list should be cached or recomputed every time
  */
 $wgGadgetsCaching = true;
+
+/**
+ * Whether Gadgets that don't support ResourceLoader should still be enabled
+ */
+$wgGadgetsEnableLegacyGadgets = true;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98b4146579ccbbfcad8b83a51cc095da1fad673c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gadgets
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

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

Reply via email to