Chapter 12. Controlling Wiki Features

MediaWiki’s feature set is extremely configurable through the methods we saw in Chapter 11. In this chapter, we’ll configure users, rights, articles, the edit page, namespaces, file uploads, the search engine, and more. There’s no way we can cover every feature, but we’ll explore a good selection of common and useful settings and techniques. (Read Chapter 11 first to learn about configuration in general.)

Tip

Remember that all configuration settings, which are set in LocalSettings.php, are documented on www.mediawiki.org in the Manual namespace. Just search for Manual:$wgNameOfSettingHere (e.g., Manual:$wgLogo). The full set is documented here: http://www.mediawiki.org/wiki/Manual:Configuration_setting.

Users

As a wiki sysop or administrator, you may want to create, rename, and delete users. We’ll talk about those operations here.

Creating Users

To create a single user, simply create an account at Special:UserLogin. To create users in batches, try a script such as the one in Example 12-1. To use it, create a file of usernames and passwords, where each line consists of one username, a tab character, and the user’s password. Then, run:

php CreateUsersInBatch.php name-of-file

All users (which must not already exist) will be created in the MediaWiki database with the given passwords. Your AdminSettings.php file (see AdminSettings.php) must be set up for this script to work.

Example 12-1. CreateUsersInBatch.php

<?php # Run from MediaWiki's "maintenance" ...

Get MediaWiki now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.