Open main menu

Extension:InternalWhitelist

MediaWiki extensions manual
OOjs UI icon advanced.svg
InternalWhitelist
Release status: stable
Implementation User rights
Description Provides the capability to maintain a listing of "whitelisted" articles in the MediaWiki namespace
Author(s) Lisa Ridley, Stanislav Pika
MediaWiki 1.25+
Database changes No
License GPL
Download
Translate the InternalWhitelist extension if it is available at translatewiki.net
Check usage and version matrix.

The InternalWhitelist extension provides the capability to maintain a listing of "whitelisted" articles in the MediaWiki namespace.

For wikis that choose to restrict pages that anonymous users can see, this extension provides the capability of maintaining the "whitelisted" pages from within the MediaWiki application in the MediaWiki namespace. For more information on "whitelisting", please see $wgWhitelistRead.

This extension will actually replace any previously applied settings for $wgWhitelistRead.

Installation & Setup / Changes to LocalSettings.phpEdit

  • Download and place the file(s) in a directory called InternalWhitelist in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'InternalWhitelist' );
    $wgGroupPermissions['*']['read'] = false;
    
  • Create a page titled "MediaWiki:Whitelist". List each page you wish to "whitelist" for anonymous users as a bulleted list. Comments can be added to the page by preceding each line that is a comment with a double slash ("//"). For example, to whitelist the Main Page, the discussion page for the Main Page, and the Recent Changes page, you would enter the following content in MediaWiki:Whitelist:
//Whitelisted pages
//Subject pages
* Main Page
//Discussion pages
* Talk:Main Page
//Special Pages
* Special:RecentChanges

The lines starting with "//" will be ignored, and the bulleted lines will become an array of whitelisted pages.

  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

NotesEdit

If you are currently maintaining a whitelist in your LocalSettings.php script file, this listing will be discarded and replaced with the pages listed on MediaWiki:Whitelist. If you install this extension and do not create MediaWiki:Whitelist then all pages except Special:Userlogin will be unavailable to anonymous visitors.

It is not necessary to set $wgGroupPermissions['*']['read'] = false; in the LocalSettings.php file as this extension will set those permissions during the initialization process; however it is good practice to keep your Group Permissions settings in one place for ease of maintenance.

Only "//" will work properly for commented lines.

Download the extension by using git on the command-line:

cd $IP/extensions
sudo git clone https://github.com/staspika/mediawiki-internalwhitelist.git InternalWhitelist