|
MediaWiki master
|
Provides rate limiting for a set of actions based on several counter buckets. More...
Public Member Functions | |
| __construct (ServiceOptions $options, WRStatsFactory $wrstatsFactory, ?CentralIdLookup $centralIdLookup, UserFactory $userFactory, UserGroupManager $userGroupManager, HookContainer $hookContainer) | |
| isExempt (RateLimitSubject $subject) | |
| Is this user exempt from rate limiting? | |
| isLimitable ( $action) | |
| Checks whether the given action may be limited. | |
| limit (RateLimitSubject $subject, string $action, int $incrBy=1) | |
| Implements simple rate limits: enforce maximum actions per time period to put a brake on flooding. | |
| setStats (StatsFactory $statsFactory) | |
Public Attributes | |
| const | CONSTRUCTOR_OPTIONS |
Provides rate limiting for a set of actions based on several counter buckets.
Definition at line 29 of file RateLimiter.php.
| MediaWiki\Permissions\RateLimiter::__construct | ( | ServiceOptions | $options, |
| WRStatsFactory | $wrstatsFactory, | ||
| ?CentralIdLookup | $centralIdLookup, | ||
| UserFactory | $userFactory, | ||
| UserGroupManager | $userGroupManager, | ||
| HookContainer | $hookContainer ) |
Definition at line 71 of file RateLimiter.php.
References MediaWiki\Config\ServiceOptions\assertRequiredOptions(), and MediaWiki\MainConfigNames\RateLimits.
| MediaWiki\Permissions\RateLimiter::isExempt | ( | RateLimitSubject | $subject | ) |
Is this user exempt from rate limiting?
| RateLimitSubject | $subject | The subject of the rate limit, representing the client performing the action. |
Definition at line 106 of file RateLimiter.php.
References MediaWiki\Permissions\RateLimitSubject\getIP(), MediaWiki\Permissions\RateLimitSubject\is(), and MediaWiki\MainConfigNames\RateLimitsExcludedIPs.
Referenced by MediaWiki\Permissions\RateLimiter\limit().
| MediaWiki\Permissions\RateLimiter::isLimitable | ( | $action | ) |
Checks whether the given action may be limited.
Can be used for optimization, to avoid calling limit() if we can know in advance that no limit will apply.
| string | $action |
Definition at line 129 of file RateLimiter.php.
| MediaWiki\Permissions\RateLimiter::limit | ( | RateLimitSubject | $subject, |
| string | $action, | ||
| int | $incrBy = 1 ) |
Implements simple rate limits: enforce maximum actions per time period to put a brake on flooding.
| RateLimitSubject | $subject | The subject of the rate limit, representing the client performing the action. |
| string | $action | Action to enforce |
| int | $incrBy | Positive amount to increment counter by, 1 by default. Use 0 to check the limit without bumping the counter. |
Definition at line 164 of file RateLimiter.php.
References MediaWiki\Permissions\RateLimitSubject\getIP(), MediaWiki\Permissions\RateLimitSubject\getUser(), MediaWiki\Permissions\RateLimitSubject\is(), and MediaWiki\Permissions\RateLimiter\isExempt().
| MediaWiki\Permissions\RateLimiter::setStats | ( | StatsFactory | $statsFactory | ) |
Definition at line 94 of file RateLimiter.php.
| const MediaWiki\Permissions\RateLimiter::CONSTRUCTOR_OPTIONS |
Definition at line 66 of file RateLimiter.php.