Extension talk:Blacklist

From mediawiki.org

For a stable and maintained extension, see Extension:SpamBlacklist

Is there a simple way to blacklist a whole namespace[edit]

Is there a simple way to blacklist a whole namespace? -Brynte 22:11, 4 December 2007 (UTC)Reply

  • You can just do it in a regex --pynej
 $wgBlacklistOps["useRegex"] = true;
 $wgWhitelist['sysop']['read'] = $wgBlacklist['*']['read'] = array("^Special:.*$");

What options are possible?[edit]

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)Reply

Can normal users SEE these pages?[edit]

The explanation of what this extension does it really poor. Please explain. Odessaukrain 00:55, 11 April 2008 (UTC)Reply

  • 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

Error message[edit]

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 MWReply

  • 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

Modified Blacklist Extension[edit]

Here an prefix based version of this extension, working with MediaWiki 1.12.0: http://www.mwusers.com/forums/showthread.php?p=29876#post29876

Special Characters[edit]

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)Reply

  • 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).

Doesn't work for me in MW14[edit]

Somebody knows if there are issues with this extension in 1.14?--Gregra 23:13, 14 August 2009 (UTC)Reply

Working OK in 1.15[edit]

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.

Problems to set own created groups to blacklist. MW1.24.2 Resolved![edit]

Hi,

I created own namespaces and own Groups and I couldn't set them on blacklist, It didn't work! I use the extension FlaggedRev, and I couldn't even set the user group 'reviewer' on whitelist...

I resolved the problem. I simply changed blacklist.php:

	$groupPower = array(
		0 => "*",
		1 => "user",
		2 => "autoconfirmed",
		3 => "emailconfirmed",
		4 => "bot",
		5 => "sysop",
		6 => "bureaucrat",
		7 => "NewGroup",      // My new created group
		8 => "reviewer");     // This is a user group of FlaggedRev

On LocalSettings.php:

# Blacklist
include_once("extensions/blacklist.php");
$wgBlacklistOps["useRegex"] = true;
$wgWhitelist['sysop']['read'] =   $wgWhitelist['reviewer']['read'] = $wgBlacklist['NewGroup']['read'] = array("^MSH:.*$");


--Zerano8 (talk) 09:24, 10 March 2015 (UTC)Reply

Restrict different Namespaces for different Users MW 1.24.2[edit]

Hi,

I want to restrict some Namespaces for * and other Namespaces from group "customer".

I set read permission -> whitelist for sysop, reviewer, autoreviewer, and * in blacklist for the namespaces Support:, Template: and Special:ListUsers.

$wgWhitelist['sysop']['read'] = $wgWhitelist['reviewer']['read'] = $wgWhitelist['autoreview']['read'] = $wgBlacklist['*']['read'] = array("^Support:.*$", "^Template:.*$", "Special:ListUsers");

My problem is now, I want to set Namespace VAS: read permissions only for sysop, reviewer, autoreviewer AND customer, but NOT for *.

So I can't simply add VAS: in the Array!

If I try to define a new row like this, the first will be overwritten:

$wgWhitelist['sysop']['read'] = $wgWhitelist['reviewer']['read'] = $wgWhitelist['autoreview']['read'] = $wgWhitelist['customer']['read'] = $wgBlacklist['*']['read'] = array("^VAS:.*$");

Can you please help...

--Zerano8 (talk) 07:58, 27 April 2015 (UTC)Reply


Hello,

Extension works fine with MW 1.24.2, but I can't define more Blacklists consecutively.

So now I'm using Extension PermissionACL which works fine with MW 1.24.2.

--Zerano8 (talk) 13:23, 29 April 2015 (UTC)Reply