Rename the filterAction hook and add a parameter

The 'AbuseFilter-filterAction' hook is deprecated in favour of a new
'AbuseFilterAlterVariables' hook, which provides a User object and has a better name, since it reflects what it should be used for, and doesn't include the name of a function which will be removed. The hook will be hard deprecated in a subsequent patch, to avoid test failures.

Depends-On: Ic0ecc8746e2883c746bef815a0fee4131f1a0646
Change-Id: I212b1e09e9c05d487d96b2f4c28f2a613e6ff3cf
This commit is contained in:
Daimona Eaytoy 2019-01-27 11:23:13 +01:00
parent b7f1a7d459
commit 85b46268f2
2 changed files with 11 additions and 2 deletions

View file

@ -27,12 +27,20 @@ will be used for non-text content.
$content: The Content object
&$text: Set this to the desired text.
'AbuseFilter-filterAction': Allows overwriting of abusefilter variables in AbuseFilter::filterAction just
before they're checked against filters. Note that you may specify custom variables in a saner way using other hooks:
'AbuseFilter-filterAction': DEPRECATED! Use AbuseFilterAlterVariables instead.
Allows overwriting of abusefilter variables in AbuseFilter::filterAction just before they're
checked against filters. Note that you may specify custom variables in a saner way using other hooks:
AbuseFilter-generateTitleVars, AbuseFilter-generateUserVars and AbuseFilter-generateStaticVars.
$vars: AbuseFilterVariableHolder with variables
$title: Title object
'AbuseFilterAlterVariables': Allows overwriting of abusefilter variables just before they're
checked against filters. Note that you may specify custom variables in a saner way using other hooks:
AbuseFilter-generateTitleVars, AbuseFilter-generateUserVars and AbuseFilter-generateStaticVars.
$vars: AbuseFilterVariableHolder with variables
$title: Title object target of the action
$user: User object performer of the action
'AbuseFilter-generateTitleVars': Allows altering the variables generated for a title
$vars: AbuseFilterVariableHolder
$title: Title object

View file

@ -1158,6 +1158,7 @@ class AbuseFilter {
// Add vars from extensions
Hooks::run( 'AbuseFilter-filterAction', [ &$vars, $title ] );
Hooks::run( 'AbuseFilterAlterVariables', [ &$vars, $title, $user ] );
$vars->addHolders( self::generateStaticVars() );
$vars->forFilter = true;