mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-12 00:38:23 +00:00
Merge "Remove temporary parameter"
This commit is contained in:
commit
3158a7ebc7
|
@ -210,11 +210,9 @@ class AbuseFilter {
|
|||
|
||||
/**
|
||||
* @param string[] $filters
|
||||
* @param bool $legacy TEMPORARY whether to get data in legacy format
|
||||
* @return (string|array)[][][]|array[][]
|
||||
* @phan-return array<string,array<string,array{action:string,parameters:string[]}>>|array[][]
|
||||
* @return array[][]
|
||||
*/
|
||||
public static function getConsequencesForFilters( $filters, $legacy = true ) {
|
||||
public static function getConsequencesForFilters( $filters ) {
|
||||
$globalFilters = [];
|
||||
$localFilters = [];
|
||||
|
||||
|
@ -234,15 +232,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
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -253,16 +250,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<string,array<string,array{action:string,parameters:string[]}>>|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] = [];
|
||||
|
@ -295,10 +285,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 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -447,7 +447,7 @@ class AbuseFilterRunner {
|
|||
global $wgAbuseFilterLocallyDisabledGlobalActions,
|
||||
$wgAbuseFilterBlockDuration, $wgAbuseFilterAnonBlockDuration;
|
||||
|
||||
$actionsByFilter = AbuseFilter::getConsequencesForFilters( $filters, false );
|
||||
$actionsByFilter = AbuseFilter::getConsequencesForFilters( $filters );
|
||||
$actionsTaken = array_fill_keys( $filters, [] );
|
||||
|
||||
$messages = [];
|
||||
|
|
Loading…
Reference in a new issue