I've wrote a little thing for mediawiki. I need an open wiki where an
anonymous user can read all pages but a few ones.
I've seen there is an array called $wgWhitelistRead where you can say
what pages can be viewed when an anonymous user can not view all pages.
Thus, this is exactle tne inverse I need.
I've made a patch for includes/Title.php, that allows to view all pages
to an anonymous user but the few ones called in $wgBlacklistRead.
(the patch is from mediawiki-1.4.5, but it's easy to port, I suppose)
The diff -u outputs, if anyone thinks it may be interesting:
--- /root/paquetes/mediawiki-1.4.5/includes/Title.php 2005-05-06
05:25:43.000000000 +0200
+++ ./includes/Title.php 2005-07-28 19:13:52.000000000 +0200
@@ -858,6 +858,14 @@
global $wgUser;
if( $wgUser->isAllowed('read') ) {
+ global $wgBlacklistRead;
+
+ /** some pages are explicitly disallowed */
+ $name = $this->getPrefixedText();
+ if( in_array( $name, $wgBlacklistRead ) ) {
+ return false;
+ }
+
return true;
} else {
global $wgWhitelistRead;
and includes/DefaultSettings.php:
--- /root/paquetes/mediawiki-1.4.5/includes/DefaultSettings.php
2005-06-03 16:51:06.000000000 +0200
+++ ./includes/DefaultSettings.php 2005-07-28 19:25:21.000000000 +0200
@@ -452,6 +452,7 @@
$wgWhitelistEdit = false; # true = user must login to edit.
$wgWhitelistRead = false; # Pages anonymous user may see, like: =
array ( "Main Page", "Special:Userlogin",
"Wikipedia:Help");
+$wgBlacklistRead = false; # Pages anonymous users shouldn't see
$wgWhitelistAccount = array ( 'user' => 1, 'sysop' => 1,
'developer'
=> 1 );
$wgAllowAnonymousMinor = false; # Allow anonymous users to mark
changes as 'minor'
Remember this is for mediawiki-1.4.5, and this is the first time I send
code to an open-source project
Show replies by date