Extension:RegexBlock

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
RegexBlock

Release status: stable

RegexBlock.png
Implementation User rights, Special page
Description Adds a new special page for blocking, viewing and unblocking user names and IP addresses by given name, using regular expressions
Author(s) Bartek Łapiński, Tomasz Klim, Piotr Molski, Adrian Wieczorek, Alexandre Emsenhuber, Jack Phoenix
Last version 1.2.1 (13th of March, 2009)
MediaWiki 1.11+
License GNU General Public License 2.0 or later
Download
README
Parameters

$wgContactLink
$wgRegexBlockDatabase

Added rights

regexblock

Hooks used
GetBlockedStatus

ContributionsToolLinks

Check usage and version matrix

RegexBlock is an extension that adds special page with the interface for blocking, viewing and unblocking user names and IP addresses using regular expressions. It was originally written by Bartek Łapiński for Wikia.

Contents

Installation [edit]

Note: this extension works best when used along with setting shared database and memcached.

  1. Copy the /regexBlock folder into the $IP/extensions folder
  2. Create the 2 required tables (see schema.sql).
  3. Add require_once("$IP/extensions/regexBlock/regexBlock.php"); to your GlobalSettings.php file.
  4. Set $wgSharedDB to the name of a shared database of your choice (in GlobalSettings.php).
  5. Set $wgMainCacheType to 'CACHE_MEMCACHED' and $wgMemCachedServers. The latter could look like this: $wgMemCachedServers = array ("127.0.0.1:11000"); (for a memcached server running on IP 127.0.0.1 and port 11000).

Use [edit]

  1. Go to Special:RegexBlock
  2. Enter the IP address or the username to be blocked to the "IP address or username" field
  3. Enter an optional reason. If no reason is provided by the blocker, a generic reason will be shown to the blocked user.
  4. Select expiry time
  5. Select if you want to block the creation of new accounts and if the match needs to be exact or regex one
  6. Press "Block this user"

Parameters [edit]

  • $wgContactLink — displayed to regexblocked users in the regexblock-reason-* interface messages. The default value is Special:Contact, but you might want to customize it if ContactPage extension isn't installed on your wiki.
  • $wgRegexBlockDatabase — set this to the database to use for blockedby and stats_blockedby tables. If you want to use the local database, set this to false. Otherwise you could set this to $wgSharedDB, for example.

Examples [edit]

To block all users except local ones (192.168.xx.xx): \b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?([0]|[2-9])[0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b

Note for users using pre-1.2 version [edit]

If you are upgrading from a pre-1.2 (r45428) version of regexBlock, you'll need to apply the patch-upgrade.sql patch against your database.

Licensing and downloads [edit]

The extension is available under the GNU General Public License 2.0 or later, and can be downloaded from Subversion, or accessed via the web-based viewer.

The software is provided as-is. Updates will be made according to the needs of Wikimedia wikis; or where critical vulnerabilities are discovered.