mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-27 23:40:19 +00:00
Merge "Add hooks to AF that allow altering User and Title specific vars"
This commit is contained in:
commit
452b918203
|
@ -196,6 +196,8 @@ class AbuseFilter {
|
|||
$vars->setLazyLoadVar( 'user_blocked', 'simple-user-accessor',
|
||||
array( 'user' => $user->getName(), 'method' => 'isBlocked' ) );
|
||||
|
||||
wfRunHooks( 'AbuseFilter-generateUserVars', array( $vars, $user ) );
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
|
@ -294,6 +296,8 @@ class AbuseFilter {
|
|||
'namespace' => $title->getNamespace()
|
||||
) );
|
||||
|
||||
wfRunHooks( 'AbuseFilter-generateTitleVars', array( $vars, $title, $prefix ) );
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
|
|
25
hooks.txt
25
hooks.txt
|
@ -10,21 +10,30 @@ to add events to the AbuseFilter extension.
|
|||
'AbuseFilter-builder': Allows overwriting of the builder values returned by AbuseFilter::getBuilderValues
|
||||
&$realValues: Builder values
|
||||
|
||||
'AbuseFilter-computeVariable': Like AbuseFilter-interceptVariable but called if the requested method wasn't found.
|
||||
Return true to indicate that the method is known to the hook and was computed successful.
|
||||
$method: Method to generate the variable
|
||||
$vars: AbuseFilterVariableHolder
|
||||
$parameters: Parameters with data to compute the value
|
||||
&$result: Result of the computation
|
||||
|
||||
'AbuseFilter-filterAction': Allows overwriting of abusefilter variables in AbuseFilter::filterAction just
|
||||
before they're checked against filters.
|
||||
&$vars: AbuseFilterVariableHolder with variables
|
||||
$vars: AbuseFilterVariableHolder with variables
|
||||
$title: Title object
|
||||
|
||||
'AbuseFilter-generateTitleVars': Allows altering the variables generated for a title
|
||||
$vars: AbuseFilterVariableHolder
|
||||
$title: Title object
|
||||
$prefix: Variable name prefix
|
||||
|
||||
'AbuseFilter-generateUserVars': Allows altering the variables generated for a specific user
|
||||
$vars: AbuseFilterVariableHolder
|
||||
$user: User object
|
||||
|
||||
'AbuseFilter-interceptVariable': Called before a variable is set in AFComputedVariable::compute to be able to set
|
||||
it before the core code runs. Return false to make the function return right after.
|
||||
$method: Method to generate the variable
|
||||
$vars: AbuseFilterVariableHolder
|
||||
$parameters: Parameters with data to compute the value
|
||||
&$result: Result of the computation
|
||||
|
||||
'AbuseFilter-computeVariable': Like AbuseFilter-interceptVariable but called if the requested method wasn't found.
|
||||
Return true to indicate that the method is known to the hook and was computed successful.
|
||||
$method: Method to generate the variable
|
||||
$vars: AbuseFilterVariableHolder
|
||||
$parameters: Parameters with data to compute the value
|
||||
&$result: Result of the computation
|
||||
|
|
Loading…
Reference in a new issue