Extension talk:Blacklist
For a stable and maintained extension, see Extension:SpamBlacklist
Contents |
[edit] Is there a simple way to blacklist a whole namespace
Is there a simple way to blacklist a whole namespace? -Brynte 22:11, 4 December 2007 (UTC)
- You can just do it in a regex --pynej
$wgBlacklistOps["useRegex"] = true;
$wgWhitelist['sysop']['read'] = $wgBlacklist['*']['read'] = array("^Special:.*$");
[edit] What options are possible?
In the article, only "write" and "edit" are mentioned. What else can one change? Move? --195.145.142.18 09:46, 2 April 2008 (UTC)
[edit] Can normal users SEE these pages?
The explanation of what this extension does it really poor. Please explain. Odessaukrain 00:55, 11 April 2008 (UTC)
- It depends on the second option of the array. If the edit permission is revoked then pages can't be edited. If the read permission is revoked then the page can't even be viewed. There are other permissions as well just as create. --pynej
[edit] Error message
Odd. When I load a page immediately after having installed Blacklist, I'm getting this error messages repeated many many times:
Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /mydir/wiki/extensions/blacklist/blacklist.php on line 78 Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /mydir/wiki/extensions/blacklist/blacklist.php on line 62
Any idea what I might have done wrong? I'm using MW 1.13.0. -- manu3d 03:17, 23 August 2008 (UTC) I am also getting this problem using the latest version of MW
- You may need to comment out a tweak they added in newer versions of MW to get this to work again. They added a statment to skip permission checking logic witch will fail when using this extension. Just comment out the following lines in includes/Title.php. --PyneJ
includes/Title.php Line 1383 if ($wgGroupPermissions['*']['read']) return true;
- You can edit the extension's file to fix this by adding a couple of simple tests. Replace line 62 with:
$testMyGroup = (is_array($wgBlacklist)) ? array_key_exists($myGroup, $wgBlacklist):false; $testAction = (is_array($wgBlacklist[$myGroup])) ? array_key_exists($action, $wgBlacklist[$myGroup]):false; if($testMyGroup && $testAction && is_array($wgBlacklist[$myGroup][$action]))
Replace line 78 with:
if($testMyGroup && $testAction && is_array($wgBlacklist[$myGroup][$action]))
--S3rvant
[edit] Modified Blacklist Extension
Here an prefix based version of this extension, working with MediaWiki 1.12.0: http://www.mwusers.com/forums/showthread.php?p=29876#post29876
[edit] Special Characters
Is there any way to restrict sites from viewing if special characters are used in the title? i.e "Spezial:Beiträge" in German. Thanks --FlyerWiki 11:15, 22 March 2009 (UTC)
- It should work for any language/character sets but doesn't do localization on its own. adding the localizations along with the English page titles and it should work fine. --pynej
- Can you give more details about how to "add the localizations" ? I am facing the same issues ...
- Alright, I might have found the solution : just make sure you use the UTF-8 encoding for your LocalSetting (instead of ANSI).
[edit] Doesn't work for me in MW14
Somebody knows if there are issues with this extension in 1.14?--Gregra 23:13, 14 August 2009 (UTC)
[edit] Working OK in 1.15
Got this working today in 1.15 What is probably making people think it isn't working is the warning messages that they receive if they install the code as it is given without first setting up their blacklist AND whitelist arrays in LocalSettings.php . This is because there is an array_key_exists call on the global blacklist and whitelist arrays, that may not have been initialised (this is a little slapdash really). There are a bunch of ways to fix blacklist.php to work whatever, but I prefer to put an 'is_array' check on the globals at the start of the function and set them to a blank array if they aren't set.
snippet below
function checkBlacklist(&$title, &$wgUser, $action, &$result) { global $wgBlacklist; global $wgWhitelist; global $wgBlacklistOps; if (! is_array($wgBlacklist)){ $wgBlacklist = array(); } if (! is_array($wgWhitelist) ){ $wgWhitelist = array(); } ...
Damn useful extension! Thanks.