Manual:Hooks/PingLimiter

From Linux Web Expert

PingLimiter
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
Allows extensions to override the results of User::pingLimiter()
<translate> Define function:</translate>
public static function onPingLimiter( &$user, $action, &$result ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"PingLimiter": "MediaWiki\\Extension\\MyExtension\\Hooks::onPingLimiter"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> user/User.php
<translate> Interface:</translate> PingLimiterHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:PingLimiter extensions</tvar>.</translate>

Details

  • &$user : User performing the action.
  • $action : Action being performed.
  • &$result : Whether or not the action should be prevented. Change $result and return false to give a definitive answer, otherwise the built-in rate limiting checks are used, if enabled.