From e8947970ce4aba60a99151bab1efc6734d0fb7be Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Sun, 17 Mar 2019 16:43:19 +0100 Subject: [PATCH] Remove temporary parameter The only usage outside of AbuseFilter (in ContentTranslation) was fixed with Ifc9ede277791398290786cdb6743137004b5c713. Change-Id: I22cf9c76ef3b007502045a02c82255ba6c9fd0f2 --- includes/AbuseFilter.php | 28 ++++++++-------------------- includes/AbuseFilterRunner.php | 2 +- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/includes/AbuseFilter.php b/includes/AbuseFilter.php index 1897991e7..e8b814067 100644 --- a/includes/AbuseFilter.php +++ b/includes/AbuseFilter.php @@ -225,11 +225,9 @@ class AbuseFilter { /** * @param string[] $filters - * @param bool $legacy TEMPORARY whether to get data in legacy format - * @return (string|array)[][][]|array[][] - * @phan-return array>|array[][] + * @return array[][] */ - public static function getConsequencesForFilters( $filters, $legacy = true ) { + public static function getConsequencesForFilters( $filters ) { $globalFilters = []; $localFilters = []; @@ -249,15 +247,14 @@ class AbuseFilter { $consequences = []; if ( count( $localFilters ) ) { - $consequences = self::loadConsequencesFromDB( $dbr, $localFilters, '', $legacy ); + $consequences = self::loadConsequencesFromDB( $dbr, $localFilters, '' ); } if ( count( $globalFilters ) ) { $consequences += self::loadConsequencesFromDB( AbuseFilterServices::getCentralDBManager()->getConnection( DB_REPLICA ), $globalFilters, - self::GLOBAL_FILTER_PREFIX, - $legacy + self::GLOBAL_FILTER_PREFIX ); } @@ -268,16 +265,9 @@ class AbuseFilter { * @param IDatabase $dbr * @param string[] $filters * @param string $prefix - * @param bool $legacy TEMPORARY whether to get data in legacy format - * @return (string|array)[][][]|array[][] - * @phan-return array>|array[][] + * @return array[][] */ - private static function loadConsequencesFromDB( - IDatabase $dbr, - $filters, - $prefix = '', - $legacy = true - ) { + private static function loadConsequencesFromDB( IDatabase $dbr, $filters, $prefix = '' ) { $actionsByFilter = []; foreach ( $filters as $filter ) { $actionsByFilter[$prefix . $filter] = []; @@ -310,10 +300,8 @@ class AbuseFilter { // We probably got a NULL, as it's a LEFT JOIN. Don't add it. continue; } else { - $params = array_filter( explode( "\n", $row->afa_parameters ) ); - $actionsByFilter[$prefix . $row->afa_filter][$row->afa_consequence] = $legacy - ? [ 'action' => $row->afa_consequence, 'parameters' => $params ] - : $params; + $actionsByFilter[$prefix . $row->afa_filter][$row->afa_consequence] = + array_filter( explode( "\n", $row->afa_parameters ) ); } } diff --git a/includes/AbuseFilterRunner.php b/includes/AbuseFilterRunner.php index faf0e6ace..c913e92ac 100644 --- a/includes/AbuseFilterRunner.php +++ b/includes/AbuseFilterRunner.php @@ -492,7 +492,7 @@ class AbuseFilterRunner { global $wgAbuseFilterLocallyDisabledGlobalActions, $wgAbuseFilterBlockDuration, $wgAbuseFilterAnonBlockDuration; - $actionsByFilter = AbuseFilter::getConsequencesForFilters( $filters, false ); + $actionsByFilter = AbuseFilter::getConsequencesForFilters( $filters ); $actionsTaken = array_fill_keys( $filters, [] ); $messages = [];