jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/403841 )
Change subject: Special:MobileOptions should only list features in beta but not
stable
......................................................................
Special:MobileOptions should only list features in beta but not stable
Change-Id: Ic99fc2505748945b9e22527f40a7d2247aa7a1f4
---
M includes/features/Feature.php
M includes/features/IFeature.php
M includes/specials/SpecialMobileOptions.php
3 files changed, 24 insertions(+), 3 deletions(-)
Approvals:
Pmiazga: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/features/Feature.php b/includes/features/Feature.php
index b29cd13..17cb862 100644
--- a/includes/features/Feature.php
+++ b/includes/features/Feature.php
@@ -37,6 +37,13 @@
/**
* @inheritDoc
*/
+ public function __toString() {
+ return $this->name;
+ }
+
+ /**
+ * @inheritDoc
+ */
public function isAvailable( $mode ) {
return array_key_exists( $mode, $this->options ) ?
$this->options[ $mode ] : self::DEFAULT_ENABLED_MODE;
diff --git a/includes/features/IFeature.php b/includes/features/IFeature.php
index 1efae64..af9fd75 100644
--- a/includes/features/IFeature.php
+++ b/includes/features/IFeature.php
@@ -29,6 +29,14 @@
public function getGroup();
/**
+ * Serialise the feature as a string so that the feature manager can
perform array_diff
+ * and array_intersect on results and identify where features are
available and where they are not.
+ * This should return the value of getId.
+ * @return string
+ */
+ public function __toString();
+
+ /**
* Check feature availability in given mode ( Stable, beta, alpha etc )
* @param string $mode Mode
* @return bool
diff --git a/includes/specials/SpecialMobileOptions.php
b/includes/specials/SpecialMobileOptions.php
index 80cf3df..4d1aed9 100644
--- a/includes/specials/SpecialMobileOptions.php
+++ b/includes/specials/SpecialMobileOptions.php
@@ -1,5 +1,7 @@
<?php
+use MobileFrontend\Features\IFeature;
+
/**
* Adds a special page with mobile specific preferences
*/
@@ -104,9 +106,13 @@
]
);
- $features = \MediaWiki\MediaWikiServices::getInstance()
- ->getService( 'MobileFrontend.FeaturesManager' )
- ->getAvailable( MobileContext::MODE_BETA );
+ $manager = \MediaWiki\MediaWikiServices::getInstance()
+ ->getService( 'MobileFrontend.FeaturesManager'
);
+
+ $features = array_diff(
+ $manager->getAvailable( IFeature::CONFIG_BETA ),
+ $manager->getAvailable( IFeature::CONFIG_STABLE
)
+ );
$classNames = [ 'mobile-options-beta-feature' ];
if ( $isInBeta ) {
--
To view, visit https://gerrit.wikimedia.org/r/403841
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic99fc2505748945b9e22527f40a7d2247aa7a1f4
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: specialpages
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Pmiazga <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits