Extension:TitleBlacklist

The Title Blacklist extension allows wiki administrators to block the creation, movement and upload of pages which title matches one or more regular expressions, as well as blocking creation of accounts with matching usernames.

Requirements
Extension requires MediaWiki 1.12.0 or above (it needs AbortMove hook).

Installation

 * 1) Check out all extension files from Subversion and place them in a TitleBlacklist subdirectory within your MediaWiki extensions directory
 * 2) Add the line   to your LocalSettings.php file
 * 3) Configure blacklist sources (see below)

Installation can be verified through the Special:Version page on the wiki.

Note: By default it only affects anonymous users. To make it default for all use.

Multiple blacklist sources
Title blacklist can be gathered from multiple sources except local message. For configuring blacklist sources use code like this:
 * Use TBLSRC_LOCALPAGE for using local page as title blacklist
 * Use TBLSRC_URL for using external URL as title blacklist
 * Use TBLSRC_FILE for using file as title blacklist

Editing the blacklist
The title blacklist is maintained as a system message MediaWiki:Titleblacklist.

This page consists of regular expressions, each on a separate line, for example:

Foo  [Bb]ar #No one should create article about it

Each entry may also contain optional attributes, enclosed in  and separated with
 * autoconfirmed - only autoconfirmed users are able to create/upload/move such pages
 * casesensitive - don't ignore case when checking title for being blacklisted
 * noedit - users are also unable to edit this article
 * moveonly - forbid moves but allow ordinary creation (35163)
 * newaccountonly - forbid creation of matching usernames, but allow page creation (38977)
 * reupload - allow reuploads of existing blacklisted files (33656)
 * errmsg - the name of the message that should be displayed instead of standard

Note that what is referred to here as regular expressions are not proper regular expressions, but rather subpatterns that are inserted into a hard-coded regular expression. i.e. the subpattern Foo from above would create a regular expression like /^Foo$/usi.

Underscores ("_") in regular expressions will be converted to spaces by the extension, because titles are matched against its text form ("Page title" instead of "Page_title").

Customising warning messages
When an attempt to create a page is blocked due to a blacklisted title, a warning message is shown to the user. This can be customised via system messages
 * MediaWiki:Titleblacklist-forbidden-edit: for page creation and editing,
 * MediaWiki:Titleblacklist-forbidden-move: for page moves,
 * MediaWiki:Titleblacklist-forbidden-upload: for image uploads.
 * MediaWiki:Titleblacklist-forbidden-new-account: for new accounts

Custom messages can be defined by using the errmsg attribute.

Whitelist
There is also a whitelist at MediaWiki:Titlewhitelist.

Change log
A complete log of changes to the extension code (including internationalisation updates from third parties) is available from the Subversion log, however, summarised information on changes between point releases is given below:

Resources on regular expressions

 * Brief Introduction to Regular Expressions
 * http://etext.lib.virginia.edu/services/helpsheets/unix/regex.html
 * The 30 Minute Regex. Tutorial
 * http://www.codeproject.com/KB/dotnet/regextutorial.aspx
 * PHP: PCRE regex syntax, the syntax of regular expressions used by PHP &mdash; and therefore this extension
 * http://php.net/manual/en/reference.pcre.pattern.syntax.php