mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-28 07:50:24 +00:00
d1728d62f8
These hooks can be called either when filtering the current action, or to check an action from recentchanges. While AbuseFilter already handles well these two cases, other extensions don't and need some context. Depends on the patch below because we're changing generateTitleVars, which already has a temporary extra parameter that I don't want to mess up with. Also follow-up I72933fcc9952fc1aabf6464b2fc0b04ec39c024b for a few remaining uppercase vars. Bug: T203166 Depends-On: If5f238cddb41ef92b141e36b4f2f15fd4cc86476 Change-Id: I1983b93bbadabd24d8bf94fa7bb14594d10e731e
56 lines
2.8 KiB
Plaintext
56 lines
2.8 KiB
Plaintext
This document describes how event hooks work in the AbuseFilter extension.
|
|
|
|
For a more comprehensive guide to hooks, navigate to your root MediaWiki
|
|
directory and read docs/hooks.txt.
|
|
|
|
== Events and parameters ==
|
|
This is a list of known events and parameters; please add to it if you're going
|
|
to add events to the AbuseFilter extension.
|
|
|
|
'AbuseFilter-builder': Allows overwriting of the builder values returned by AbuseFilter::getBuilderValues
|
|
&$realValues: Builder values
|
|
|
|
'AbuseFilter-deprecatedVariables': Allows adding deprecated variables. If a filter uses an old variable, the parser
|
|
will automatically translate it to the new one.
|
|
&$deprecatedVariables: array of deprecated variables, syntax: [ 'old_name' => 'new_name' ]
|
|
|
|
'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-contentToString': Called when converting a Content object to a string to which
|
|
filters can be applied. If the hook function returns true, Content::getTextForSearchIndex()
|
|
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-generateTitleVars, AbuseFilter-generateUserVars and AbuseFilter-generateStaticVars.
|
|
$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
|
|
$RCRow: If the variables should be generated for an RC row, this is the row. False if it's for the current action being filtered.
|
|
|
|
'AbuseFilter-generateUserVars': Allows altering the variables generated for a specific user
|
|
$vars: AbuseFilterVariableHolder
|
|
$user: User object
|
|
$RCRow: If the variables should be generated for an RC row, this is the row. False if it's for the current action being filtered.
|
|
|
|
'AbuseFilter-generateStaticVars': Allows altering static variables, i.e. independent from page and user
|
|
$vars: AbuseFilterVariableHolder
|
|
|
|
'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
|