Per site restriction is not possible by default in mediawiki, but there are many ways to create such environment mostly with using extensions. The most easy and flexible way without extensions is described on this page: http://meta.wikimedia.org/wiki/Regexp_wgWhitelistRead
It’s simply done by editing the file include/Title.php and find the line that looks like this in the function userCanRead(). In my version 1.16 it looked minimal different than at the link example:
|
$name = $this->getPrefixedText(); $dbName = $this->getPrefixedDBKey(); // Check with and without underscores if ( in_array( $name, $wgWhitelistRead, true ) || in_array( $dbName, $wgWhitelistRead, true ) ){ return true; } |
Replace them with the following lines:
|
$name = $this->getPrefixedText(); if ( is_array($wgWhitelistRead) ) { for ($i=0; $i<count($wgWhitelistRead); $i++) { if (preg_match($wgWhitelistRead[$i],$name)) { return true; } } } |
Then you are able to use regular expressions in your $wgWhitelistRead which offers great opportunities.
The following code allows non-namespaced pages, Special:Search, Special:Categories pages and several Namespaces like: Help:*, Image:*, User:* and Category:* to be seen by anonymous users.
|
$wgWhitelistRead = array ( "/^[^:]*$/", "/^Special:(Search|Categories)$/", "/^(Help|Image|User|Category):/" ); |
If you really have a private Wiki you might also want to remove Search and Categories, as they list also your private pages.