Move actions limit to a global variable

This opens the door to further customization and allows every wiki to
set its own value.

Bug: T132925
Change-Id: I63985f2809c3253b07b33caef30fcd8d4c62dfd4
This commit is contained in:
Daimona Eaytoy 2018-04-04 20:29:50 +02:00 committed by Huji
parent e4fa51e209
commit 55cac6f1b0
2 changed files with 6 additions and 2 deletions

View file

@ -332,6 +332,10 @@
"value": 500,
"description": "Runtime in milliseconds before a filter is considered slow."
},
"AbuseFilterProfileActionsCap": {
"value": 10000,
"description": "Number of action that determines when to reset profiling stats."
},
"AbuseFilterRangeBlockSize" : {
"value": {
"IPv4": 16,

View file

@ -1844,7 +1844,7 @@ class AbuseFilter {
* @param string $group The filter's group (as defined in $wgAbuseFilterValidGroups)
*/
public static function recordStats( $filters, $group = 'default' ) {
global $wgAbuseFilterConditionLimit;
global $wgAbuseFilterConditionLimit, $wgAbuseFilterProfileActionsCap;
$stash = ObjectCache::getMainStashInstance();
@ -1859,7 +1859,7 @@ class AbuseFilter {
$storage_period = self::$statsStoragePeriod;
if ( !$total || $total > 10000 ) {
if ( !$total || $total > $wgAbuseFilterProfileActionsCap ) {
// This is for if the total doesn't exist, or has gone past 10,000.
// Recreate all the keys at the same time, so they expire together.
$stash->set( $total_key, 0, $storage_period );