Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/359364 )

Change subject: Allow structured filters integration to be turned off
......................................................................

Allow structured filters integration to be turned off

Add $wgOresEnableStructuredFilters, defaulting to true. Setting it
to false will disable the structured filters integration, but not
the "classic" ORES integration.

Bug: T167908
Change-Id: I6471e0cc693b87c55ba07ffb3f153d86235cdbca
---
M extension.json
M includes/Hooks.php
2 files changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES 
refs/changes/64/359364/1

diff --git a/extension.json b/extension.json
index 6cd88a2..6344608 100644
--- a/extension.json
+++ b/extension.json
@@ -122,6 +122,7 @@
        },
        "config": {
                "OresExtensionStatus": "on",
+               "OresEnableStructuredFilters": true,
                "OresBaseUrl": "https://ores.wikimedia.org/";,
                "OresExcludeBots": true,
                "OresModels": {
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 4c8311c..df2e2ff 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -97,6 +97,7 @@
        public static function onChangesListSpecialPageStructuredFilters(
                ChangesListSpecialPage $clsp
        ) {
+               global $wgOresEnableStructuredFilters;
                // ORES is disabled on Recentchangeslinked: T163063
                if ( !self::oresEnabled( $clsp->getUser() ) || $clsp->getName() 
=== 'Recentchangeslinked' ) {
                        return;
@@ -107,7 +108,7 @@
                $changeTypeGroup = $clsp->getFilterGroup( 'changeType' );
                $logFilter = $changeTypeGroup->getFilter( 'hidelog' );
 
-               if ( self::isModelEnabled( 'damaging' ) ) {
+               if ( self::isModelEnabled( 'damaging' ) && 
$wgOresEnableStructuredFilters ) {
                        $damagingLevels = $stats->getThresholds( 'damaging' );
                        $filters = [];
                        if ( isset( $damagingLevels[ 'likelygood' ] ) ) {
@@ -213,7 +214,9 @@
 
                                $clsp->registerFilterGroup( $newDamagingGroup );
                        }
+               }
 
+               if ( self::isModelEnabled( 'damaging' ) ) {
                        if ( $clsp instanceof SpecialRecentChanges ) {
                                $damagingDefault = $clsp->getUser()->getOption( 
'oresRCHideNonDamaging' );
                        } elseif ( $clsp instanceof SpecialWatchlist ) {
@@ -249,7 +252,8 @@
 
                        $clsp->registerFilterGroup( $legacyDamagingGroup );
                }
-               if ( self::isModelEnabled( 'goodfaith' ) ) {
+
+               if ( self::isModelEnabled( 'goodfaith' ) && 
$wgOresEnableStructuredFilters ) {
                        $goodfaithLevels = $stats->getThresholds( 'goodfaith' );
                        $filters = [];
                        if ( isset( $goodfaithLevels['likelygood'] ) ) {
@@ -361,7 +365,7 @@
                $name, array &$tables, array &$fields, array &$conds,
                array &$query_options, array &$join_conds, FormOptions $opts
        ) {
-               global $wgUser;
+               global $wgUser, $wgOresEnableStructuredFilters;
 
                // ORES is disabled on Recentchangeslinked: T163063
                if ( !self::oresEnabled( $wgUser ) || $name === 
'Recentchangeslinked' ) {
@@ -377,7 +381,7 @@
                                $join_conds
                        );
                }
-               if ( self::isModelEnabled( 'goodfaith' ) ) {
+               if ( self::isModelEnabled( 'goodfaith' ) && 
$wgOresEnableStructuredFilters ) {
                        self::joinWithOresTables(
                                'goodfaith',
                                'rc_this_oldid',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6471e0cc693b87c55ba07ffb3f153d86235cdbca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

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

Reply via email to