MediaWiki REL1_28
MediaWiki\Auth\Throttler Class Reference
Inheritance diagram for MediaWiki\Auth\Throttler:
Collaboration diagram for MediaWiki\Auth\Throttler:

Public Member Functions

 __construct (array $conditions=null, array $params=[])
 clear ( $username=null, $ip=null)
 Clear the throttle counter.
 increase ( $username=null, $ip=null, $caller=null)
 Increase the throttle counter and return whether the attempt should be throttled.
 setLogger (LoggerInterface $logger)

Protected Member Functions

 logRejection (array $context)

Static Protected Member Functions

static normalizeThrottleConditions ( $throttleConditions)
 Handles B/C for $wgPasswordAttemptThrottle.

Protected Attributes

BagOStuff $cache
array $conditions
 See documentation of $wgPasswordAttemptThrottle for format.
LoggerInterface $logger
string $type
int float $warningLimit

Detailed Description

Definition at line 36 of file Throttler.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Auth\Throttler::__construct ( array  $conditions = null,
array  $params = [] 
array$conditionsAn array of arrays describing throttling conditions. Defaults to $wgPasswordAttemptThrottle. See documentation of that variable for format.
array$paramsParameters (all optional):
  • type: throttle type, used as a namespace for counters,
  • cache: a BagOStuff object where throttle counters are stored.
  • warningLimit: the log level will be raised to warning when rejecting an attempt after no less than this many failures.

Definition at line 62 of file Throttler.php.

References MediaWiki\Auth\Throttler\$conditions, $params, cache, conditions, MediaWiki\Auth\Throttler\setLogger(), and type.

Member Function Documentation

◆ clear()

MediaWiki\Auth\Throttler::clear (   $username = null,
  $ip = null 

Clear the throttle counter.

Should be called after a successful authentication attempt.

string | null$username
string | null$ip


Definition at line 168 of file Throttler.php.

References $username, as, cache, conditions, type, and wfGlobalCacheKey().

◆ increase()

MediaWiki\Auth\Throttler::increase (   $username = null,
  $ip = null,
  $caller = null 

Increase the throttle counter and return whether the attempt should be throttled.

Should be called before an authentication attempt.

string | null$username
string | null$ip
string | null$callerThe authentication method from which we were called.
array|false False if the attempt should not be throttled, an associative array with three keys otherwise:
  • throttleIndex: which throttle condition was met (a key of the conditions array)
  • count: throttle count (ie. number of failed attempts)
  • wait: time in seconds until authentication can be attempted

Definition at line 112 of file Throttler.php.

References $count, $username, as, cache, conditions, MediaWiki\Auth\Throttler\logRejection(), type, and wfGlobalCacheKey().

◆ logRejection()

MediaWiki\Auth\Throttler::logRejection ( array  $context)

Definition at line 193 of file Throttler.php.

References $context.

Referenced by MediaWiki\Auth\Throttler\increase().

◆ normalizeThrottleConditions()

static MediaWiki\Auth\Throttler::normalizeThrottleConditions (   $throttleConditions)

Handles B/C for $wgPasswordAttemptThrottle.

See also
$wgPasswordAttemptThrottle for structure

Definition at line 183 of file Throttler.php.

◆ setLogger()

MediaWiki\Auth\Throttler::setLogger ( LoggerInterface  $logger)

Definition at line 94 of file Throttler.php.

References MediaWiki\Auth\Throttler\$logger.

Referenced by MediaWiki\Auth\Throttler\__construct().

Member Data Documentation

◆ $cache

BagOStuff MediaWiki\Auth\Throttler::$cache

Definition at line 47 of file Throttler.php.

◆ $conditions

array MediaWiki\Auth\Throttler::$conditions

See documentation of $wgPasswordAttemptThrottle for format.

Old (pre-1.27) format is not allowed here.

See also$wgPasswordAttemptThrottle

Definition at line 45 of file Throttler.php.

Referenced by MediaWiki\Auth\Throttler\__construct().

◆ $logger

LoggerInterface MediaWiki\Auth\Throttler::$logger

Definition at line 49 of file Throttler.php.

Referenced by MediaWiki\Auth\Throttler\setLogger().

◆ $type

string MediaWiki\Auth\Throttler::$type

Definition at line 38 of file Throttler.php.

◆ $warningLimit

int float MediaWiki\Auth\Throttler::$warningLimit

Definition at line 51 of file Throttler.php.

The documentation for this class was generated from the following file: