Extension:AbuseFilter

Installation

 * Note: Requires Extension:AntiSpoof

As is standard with other MediaWiki extensions, you may install this extension by extracting the extension somewhere (usually the extensions folder), and adding require_once( '/path/to/AbuseFilter/AbuseFilter.php' ); to LocalSettings.php.

Format of rules
A rule may be a single condition, or a group.

Single Conditions

 * [modifier] variable operator [modifier] parameter


 * modifier is optional (hence the square brackets), and preprocesses ("modifies") the variable in some way before it is compared with the operator. Examples of modifiers are "norm" and "length", which are "normalise", and "length" respectively. See for more details.
 * variable is a variable, which is compared with the parameter using the operator. Variables for each request which trigger a filter are viewable on the details page for an abuse log entry.
 * operator is used with the parameter to match the variable. Examples of operators are "eq" and "lt": equals and less than respectively.
 * parameter is what the variable is compared with, can also be a variable.

An example of a singular condition: length USER_NAME gt 30 matches usernames with more than 30 characters.

Modifiers

 * norm</tt> &mdash; Normalises the text, performing unicode confusable character normalisation, removing double-letters, non-alphanumeric characters, and spaces.
 * supernorm</tt> &mdash; Super-normalisation. As above, and puts the letters in alphabetical order.
 * lcase</tt> &mdash; Converts the string to lower-case.
 * length</tt> &mdash; Returns the length of the string.
 * specialratio</tt> &mdash; Returns the fraction (on [0,1]) of the string which is non-alphanumeric.
 * urlencode</tt> Encodes a string for use in a URL.
 * urldecode</tt> Decodes a string from a URL.
 * htmlencode</tt> Escapes characters as HTML entities.
 * htmldecode</tt> Converts HTML entities into their respective characters.

Operators

 * eq</tt> &mdash; Returns true if the value is equal to the parameter.
 * neq</tt> &mdash; Returns true if the value is not equal to the parameter.
 * gt</tt> &mdash; Returns true if the value is greater than the parameter.
 * lt</tt> &mdash; Returns true if the value is less than the parameter.
 * regex</tt> &mdash; Returns true if the value matches the parameter (which is a regex).
 * <tt>contains</tt> &mdash; Returns true if the value contains the parameter.

Groups of conditions

 * <tt>(join condition: rule 1;rule 2; ... ; )</tt>


 * <tt>join condition</tt> is either <tt>&</tt> (and), <tt>|</tt> (or), or <tt>!</tt> not. This represents whether the rule is matched if and only if all (and), at least one (or), or no (not) sub-rules are matched.
 * Each rule can be either a single condition or a group.
 * Note that a semicolon is required after the last rule.

Example:
 * <tt>(&: USER_EDITCOUNT lt 50; length USER_NAME gt 10; )</tt>

Matches users whose editcount is less than 50, and whose name is longer than ten characters.

Throttle Groupings
You can specify one or more, separated by commas. The way it works is that, for instance, if you use creationdate,range, there is a separate rate-limit for every creationdate-range.
 * <tt>ip</tt> &mdash; IP address.
 * <tt>user</tt> &mdash; User account.
 * <tt>range</tt> &mdash; /16 range.
 * <tt>creationdate</tt> &mdash; Creation date, server time.
 * <tt>editcount</tt> &mdash; Edit count &mdash; hack so that you can detect distinct users.
 * <tt>site</tt> &mdash; The whole site.
 * <tt>page</tt> &mdash; Page