mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Move throttle range sizes to class constants
Change-Id: Iac436578f94022762b7f67959af894261c59fc66
This commit is contained in:
parent
dad1fff238
commit
4b6fff36e1
|
@ -36,6 +36,9 @@ class Throttle extends Consequence implements ConsequencesDisablerConsequence {
|
|||
/** @var bool|null */
|
||||
private $hitThrottle;
|
||||
|
||||
private const IPV4_RANGE = '16';
|
||||
private const IPV6_RANGE = '64';
|
||||
|
||||
/**
|
||||
* @param Parameters $parameters
|
||||
* @param array $throttleParams
|
||||
|
@ -180,7 +183,7 @@ class Throttle extends Consequence implements ConsequencesDisablerConsequence {
|
|||
$identifier = $user->getId();
|
||||
break;
|
||||
case 'range':
|
||||
$range = IPUtils::isIPv6( $this->requestIP ) ? 64 : 16;
|
||||
$range = IPUtils::isIPv6( $this->requestIP ) ? self::IPV6_RANGE : self::IPV4_RANGE;
|
||||
$identifier = IPUtils::sanitizeRange( "{$this->requestIP}/$range" );
|
||||
break;
|
||||
case 'creationdate':
|
||||
|
|
Loading…
Reference in a new issue