Jump to content

Manual:Combating spam/AbuseFilter examples

From mediawiki.org

Introduction

The following examples for Extension:AbuseFilter have proven useful in combating automated spam. Please change "your phrase or wiki markup" to something you see fit. The reason for not providing a standard phrase is to make it impossible for bot-creators to adapt to this filter (if a large number of wikis use the same filter, spammers can program their bots accordingly).

Examples

!("autoconfirmed" in user_groups)
& action == "edit"
& (page_id == 0|length(added_links) >= 1)
& !("your phrase" in summary | "your phrase or wiki markup" in new_wikitext)

This example will block anonymous edits (and those from user without the "autoconfirmed" status) if they are trying to create a new page or add a new link, but dont provide "your phrase" in the edit-summary or "your phrase or wiki markup" in the text they try to save.

!("autoconfirmed" in user_groups)
& action == "edit"
& page_id == 0
& length(added_links) >= 1
& (contains_any( page_title , "Http", "@@@", "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" ) | length(page_title) > 50 )

This example will not allow users without "autoconfirmed" status to create a new article with a name that either contains a number or "http", or is longer than 50 characters.

!("autoconfirmed" in user_groups)
& action == "edit"
& ( "REDIRECT" in removed_lines | "redirect" in removed_lines )
& edit_delta >= 100

In this example users without "autoconfirmed" status will be unable to change redirect-pages into articles.

!("autoconfirmed" in user_groups)
& action == "edit"
& removed_lines irlike "redirect"
& !(added_lines irlike "redirect")

In this example users without "autoconfirmed" status will be unable to remove the phrase "redirect" from a page.