From MediaWiki.org
Jump to: navigation, search
While Phalanx definitely is the best thing since sliced bread, the code is not totally usable as-is for third-party websites and contains bits and pieces specific to ShoutWiki's setup. You might also be interested in the admin tools development page. --Jack Phoenix (Contact) 20:27, 10 August 2012 (UTC)
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png

Release status:Extension status unmaintained

Phalanx MediaWiki extension UI.png
ImplementationTemplate:Extension#type Special page
DescriptionTemplate:Extension#description Integrated spam control mechanism
Author(s)Template:Extension#username Bartek Łapiński
Łukasz Garczewski
Maciej Błaszkowski
Maciej Brencz
Jack Phoenix
Latest versionTemplate:Extension#version 1.4.0 (2014-04-02; 3 years ago (2014-04-02))
MediaWikiTemplate:Extension#mediawiki 1.19+
Database changesTemplate:Extension#needs-updatephp Yes
LicenseTemplate:Extension#license GNU General Public License 3.0 or later
  • $wgPhalanxDisableContent
Added rightsTemplate:Extension#rights
  • phalanx
  • phalanxexempt
  • phalanxemailblock
Hooks usedTemplate:Extension#hook

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

Check usage and version matrix.

The Phalanx extension is an integrated special control mechanism. The integrated means that it integrates several (mostly Wikia) extensions into one, ultimate anti-spam tool: BadWords, FilterWords, regexBlock, SpamBlacklist, spamRegex, TextRegex and TitleBlacklist.

Phalanx was originally developed by and for Wikia; this page documents the fork of Phalanx that ShoutWiki uses, which was originally forked in June 2010 and is currently based on r57731 of Wikia's SVN.


  • Download and place the file(s) in a directory called Phalanx in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/Phalanx/Phalanx.php";
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


The $wgPhalanxDisableContent global can be set to true to disable the ContentBlock module (checks related to page content, edit&move summaries).

User rights[edit]

Phalanx extension adds three new user rights, phalanx, phalanxexempt and phalanxemailblock.

The phalanx user right is required to access Special:Phalanx and Special:PhalanxStats; to add, modify and remove filters and to view statistics.

Users with phalanxexempt user right are exempt from Phalanx filters.

The phalanxemailblock user right is required to view blocked e-mail addresses on Special:Phalanx and Special:PhalanxStats, to block e-mail addresses and to view the log at Special:Log/phalanxemail.


Filter additions, modifications and deletions are logged at Special:Log/phalanx, which is a private log accessible by users with the phalanx user right.

E-mail address filter additions, modifications and deletions are logged at a separate log, Special:Log/phalanxemail. Accessing this log requires the phalanxemailblock user right.

Testing filters[edit]

Users with the phalanx user right can test currently active filters by choosing the "Test Filters" tab on Special:Phalanx, entering text (such as a spam phrase, a username or something else that is or should be blocked in Phalanx) and pressing the button.
If there is a match, you'll be informed what filter the text triggers; if there isn't a match (and you know there should be), try changing the options of a block.
One of the most common problems is using the "exact" option with text, such as content or summary blocks; you should almost always use the regex option, because the "exact" option is too dumb and it can easily be fooled.

Technical notes[edit]

Phalanx keeps statistics about filter triggers on Special:PhalanxStats/block-ID-goes-here
  • See Extension:Phalanx/Writing a new module for information on how to add additional blocking options to the extension
  • Number of i18n messages: 108 (as of 9 August 2012)
  • GUI for Special:Phalanx is in extensions/Phalanx/templates/phalanx.tmpl.php
  • CSS changs:
    • wikia-tabs has been renamed to phalanx-tabs
    • accent → phalanx-accent
    • clearfix styles copied from Monaco's root.css; required for proper GUI display
  • Requires jQuery 1.4.2 or higher
  • Actual blocking classes are in blocks/ (for example, ContentBlock.class.php) and are loaded in Phalanx.php for users who do not have the phalanxexempt right
  • Hooks used by Phalanx specific to the Wikia codebase, and which are not present in MediaWiki core:
    • AutoCreateWiki::checkBadWords
    • ApiCreateMultiplePagesBeforeCreation
    • CreateDefaultQuestionPageFilter
    • CreatePageTitleCheck
    • DefaultQuestion::filterWordsTest
    • ProblemReportsContentCheck
    • SpecialMovepageBeforeMove
      • the functionality hooked into this hook has been moved to ContentBlock module (extensions/Phalanx/blocks/ContentBlock.class.php, function onAbortMove); the hook used is AbortMove