Extension:RegexBlock

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
RegexBlock

Release status:Extension status stable

RegexBlock.png
ImplementationTemplate:Extension#type User rights, Special page
DescriptionTemplate:Extension#description Adds a new special page for blocking, viewing and unblocking user names and IP addresses by given name, using regular expressions
Author(s)Template:Extension#username Bartek Łapiński
Tomasz Klim
Piotr Molski
Adrian Wieczorek
Alexandre Emsenhuber
Jack Phoenix
Latest versionTemplate:Extension#version 1.4 (4 December 2016)
MediaWikiTemplate:Extension#mediawiki 1.28+
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
ParametersTemplate:Extension#parameters

$wgContactLink
$wgRegexBlockDatabase

Added rightsTemplate:Extension#rights

regexblock
regexblock-exempt

Hooks usedTemplate:Extension#hook
GetBlockedStatusManual:Hooks/GetBlockedStatus
ContributionsToolLinksManual:Hooks/ContributionsToolLinks
LoadExtensionSchemaUpdatesManual:Hooks/LoadExtensionSchemaUpdates

Translate the RegexBlock extension if it is available at translatewiki.net

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.

Installation[edit]

This extension works best when used along with setting shared database and memcached.
  • Download and place the file(s) in a directory called RegexBlock in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'RegexBlock' );
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • Ensure that the regexblock user right is given to a group that exists; by default this user right is given to the staff user group (which does not exist in a default MediaWiki installation).
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

User rights[edit]

User right name Group which is given this right by default Description
regexblock staff User right required to view and thus use Special:RegexBlock for managing blocks.
regexblock-exempt staff Users who have this right are exempt from RegexBlock blocks.

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]

Configuration variable name Default value Description
$wgContactLink Special:Contact Displayed to regexblocked users in the regexblock-reason-* interface messages. You might want to customize it if the ContactPage extension isn't installed on your wiki.
$wgRegexBlockDatabase false 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

See also[edit]

  • Extension:SpamRegex — a similar extension for blocking expressions in page content (etc.) using regular expressions