From MediaWiki.org
Jump to navigation Jump to search


Install Extension:Usage Statistics[edit]

By default, the WhiteList extension will try to use pretty calendar entry shown in this screenshot. To enable the calendar widget in the Whitelist Access Editor, install Extension:Usage Statistics. Note: In the installation instructions for usage statistics, installing gnuplot is recommended, but not required. Since UsageStatistics is only needed for one function within Whitelist, you don't actually have to install the gnuplot extension if you don't want to. Moreover, the requirement for the Usage Statistics extension is optional and can be disabled via the $wgWhitelistUsePrettyCalendar variable (see below).

Update Common.css/.js[edit]

In your MediaWiki installation, verify that pages MediaWiki:Common.css and MediaWiki:Common.js contain the appropriate sections found on Manual:NavFrame. If those sections do not exist, copy the sections from Manual:NavFrame to your MediaWiki installation's MediaWiki:Common.css and MediaWiki:Common.js. (You can type MediaWiki:Common.css and MediaWiki:Common.js in your MediaWiki installation's search bar to open and edit the pages. Please take a look at the talk page if you have trouble with this).

If you edit these files, you will probably have to clear the cache on your browser, restart the browser, and possibly truncate the MySQL table storing the cached versions of the pages. Take a look at MediaWiki documentation on caching problems for more information.

Install Extension:Whitelist[edit]

Download all extension files from SVN and place them in the extensions/WhiteListEdit/ directory.

Create the MySQL table[edit]

To create a MySQL table, you need to have console access to your server. First, open up your console. Type:

use nameofyourdatabase

The database will now be selected. Paste the following text into the console and press enter. Make sure to use the appropriate $wgPrefix. In this example, we used wiki_ as the $wgPrefix. Note: Newer versions of mediawiki use $wgDBprefix instead of $wgPrefix. If you are unsure, take a look at your LocalSettings.php.

CREATE TABLE IF NOT EXISTS `wiki_whitelist` (
  `wl_id` int(8) NOT NULL auto_increment,
  `wl_user_id` int(5) NOT NULL,
  `wl_page_title` varchar(255) NOT NULL,
  `wl_allow_edit` int(1) NOT NULL,
  `wl_expires_on` varchar(19) default NULL,
  `wl_updated_by_user_id` int(5) NOT NULL,
  `wl_updated_on` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  PRIMARY KEY  (`wl_id`)

The MySQL code for this table is also defined in the WhiteListEdit.sql file in this extension.

Setup the system messages[edit]

Go to your Special:Allmessages page and set an appropriate message for

  • badaccess-group1
  • badaccess-group2
  • badaccess-groups

These are the messages displayed by MediaWiki when Extension:WhiteList denies page access to a restricted user.

Enable the extension[edit]

Add the following text to your LocalSettings.php

require_once( "$IP/extensions/WhiteListEdit/WhiteListEdit.php" );

If you receive an error message, that the class "SpecialPage" cannot be found, you should place a

require_once( "$IP/includes/SpecialPage.php" );

before this line.

Configure Users[edit]

Before the extension can be used, a sysop has to add the desired users to the manager group. Note, by default, a sysop will not have the necessary permissions to see the manager's Special:WhiteListEdit page. So, it might be a good idea to add your sysops to the manager group also.

Next, assign whomever you want to restrict to the restricted group. Now, your managers can create and modify the restricted users' whitelists using Special:WhitelistEdit.

Important Note[edit]

There have been numerous bug and backward compatibility improvements made to the extension. A number of topics discussed in the extension talk page are outdated. Use the material obtained there at your own risk!

Advanced Extension Configuration[edit]

The following variables can be defined in LocalSettings.php to modify the behavior of Extension:Whitelist:

Variable Default Value Description
$wgWhiteListRestrictedGroup 'restricted' Name of the restricted user user right.
$wgAvailableRights global array() adds the editwhitelist and restricttowhitelist rights
$wgWhiteListManagerGroup 'manager' Name of the manager user group.
$wgWhiteListOverride['always']['read'] array() List of pages which are always readable by restricted users, even if the page is not on the restricted user's whitelist. These are typically pages required for basic MediaWiki and user functionality.
$wgWhiteListOverride['always']['edit'] array() List of pages which are always editable by restricted users, even if the page is not on the restricted user's whitelist.
$wgWhiteListOverride['never']['read'] array() List of pages which are never viewable by restricted users, even if the page is on the restricted user's whitelist.
$wgWhiteListOverride['never']['edit'] array() List of pages which are never editable by restricted users, even if the page is on the restricted user's whitelist.
$wgWhiteListUsePrettyCalendar true Used to define if the extension should use pretty calendars for date entry (requires Extension:Usage Statistics - see above).
$wgWhiteListAllowUserPages true used to define if access to a restricted user's user/talk pages is allowed.