Addshore has uploaded a new change for review.

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

Change subject: Add a betaFeature switch
......................................................................

Add a betaFeature switch

This config option allows the extension to be deployed
on a site that has the BF extension enabled while not using
it (ie, being a default feature)

Bug: T148644
Change-Id: I2539e4762d7c1c34ea24f98fdf24c2aecb3d27b0
---
M RevisionSlider.hooks.php
M extension.json
2 files changed, 10 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RevisionSlider 
refs/changes/20/317320/1

diff --git a/RevisionSlider.hooks.php b/RevisionSlider.hooks.php
index fc49f61..1f2b50d 100644
--- a/RevisionSlider.hooks.php
+++ b/RevisionSlider.hooks.php
@@ -15,14 +15,17 @@
                Revision $oldRev,
                Revision $newRev
        ) {
+               $config = MediaWikiServices::getInstance()->getMainConfig();
+
                /**
-                * If this extension is deployed with the BetaFeatures 
extension then require the
-                * current user to have it enabled as a BetaFeature.
+                * If this extension is configured to be a beta feature, and 
the BetaFeatures extension
+                * is loaded then require the current user to have ithe feature 
enabled.
                 */
                if (
+                       $config->get( 'RevisionSliderBetaFeature' ) &&
                        class_exists( BetaFeatures::class ) &&
-                       !BetaFeatures::isFeatureEnabled( $diff->getUser(), 
'revisionslider' ) )
-               {
+                       !BetaFeatures::isFeatureEnabled( $diff->getUser(), 
'revisionslider' )
+               ) {
                        return true;
                }
 
@@ -36,7 +39,6 @@
                $stats = 
MediaWikiServices::getInstance()->getStatsdDataFactory();
                $stats->increment( 'RevisionSlider.event.hookinit' );
 
-               $config = MediaWikiServices::getInstance()->getMainConfig();
                $timeOffset = $config->get( 'LocalTZoffset' );
                if ( is_null( $config->get( 'Localtimezone' ) ) ) {
                        $timeOffset = 0;
diff --git a/extension.json b/extension.json
index 4896979..6247fbe 100644
--- a/extension.json
+++ b/extension.json
@@ -14,6 +14,9 @@
        "license-name": "GPL-2.0+",
        "type": "other",
        "manifest_version": 1,
+       "config": {
+               "RevisionSliderBetaFeature": true
+       },
        "MessagesDirs": {
                "RevisionSlider": [
                        "i18n"

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2539e4762d7c1c34ea24f98fdf24c2aecb3d27b0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/RevisionSlider
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>

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

Reply via email to