This is an example configuration for a MediaWiki family from scratch. Existing wikis should use a different approach, such as CentralAuth. This document solely focuses on the configuration of MediaWiki. For a guide that also covers the other aspects, see this page on MediaWiki.org.
LocaLSettings.phpcontains the part that determines the database name, or redirects the user to an error page.CommonSettings.phpcontains the settings that are the same across all wikis.ConditionalCommonSettings.phpcontains the settings that are shared across many wikis, but may be toggled on or off on request. Their functionality depends on a configuration variable fromInitialiseSettings.php.InitialiseSettings.phpcontains the settings per wiki. The settings are set per wiki by database name, per group by suffix or tag, or with the special identifierdefault, which sets the default for all wikis, unless overridden.SharedExtensions.phpcontains the extensions that are loaded for all wikis and their configuration.LocalExtensions.phpcontains the extensions that may be shared across wikis, but may be toggled on or off on request. Their functionality depends on a configuration variable fromInitialiseSettings.php.Skins.phpcontains the skins that can be used by the wikis. Aside from the default skin, they may be toggled on or off on request. Their functionality depends on a configuration variable fromInitialiseSettings.php.PrivateSettings.phpcontains the settings that should remain private. An example can be found inPrivateSettings.php-examplesuffixes.listcontains the different suffixes wikis may have.WikiNotFound404.phpcontains an 404 page to be displayed when the requested wiki does not exist.
This directory contains all database lists. The file structure is 1 database per line.
all.dblistcontains all known databases. This file uses a different structure than the others as it also contains the site name and language code, separated by a pipe (|).
Database lists in this folder are in the same format as in the parent folder. Databases listed in one or more of these files are tagged. The tag, such as 'echo', from echo.dblist, indicates that the wiki uses the extension Echo. This is used for configuration variables or extensions that are used on many wikis. The file name indicates the name of the tag, excluding the file extension. So for the earlier example, the dblist echo.dblist lists wikis where the tag 'echo' applies. The tag is set as a group in InitialiseSettings.php, similar to wiki suffixes.
echo.dblistscontains all wikis that use the extension Echo.closed.dblistcontains all wikis that are closed, which means they cannot be edited by those who are not stewards.loginonly.dblistcontains all wikis that require an account to edit.restricted.dblistcontains all wikis that require being invited to edit, but the content may be viewed freely.private.dblistcontains all wikis that may only be read and edited by selected users, and stewards.
To use this example, there are a few things you must do:
- Clone this repository to a suitable location, such as the MediaWiki installation folder.
- Create a
PrivateSettings.phpfile. An example is provided, seePrivateSettings.php-example. - Install a fresh copy of MediaWiki to use as a template. Place the
LocalSettings.phpfile that is generated by the installer in the MediaWiki installation and edit the wiki to improve the template. Remove theLocalSettings.phpfile after you are done. It may contain some useful auto generated settings about your environment that you may want to put inCommonSettings.php. - Export the template with a backup or dump program, such as mysqldump or phpMyAdmin.
- Create the central wiki. For this example, this is
metawiki, if you use another name, you will need to adjust the configuration ($wgSharedDBname) to use that name! You can either reinstall MediaWiki or restore the template under a different database name. - Set the settings for the central wiki in
InitialiseSettings.php, where necessary. - Link
LocalSettings.phpfrom the main MediaWiki installation, either by creating a php file with the content<?php require_once( "$IP/config/LocalSettings.php" );, assuming the configuration folder is created in the MediaWiki installation, or by creating a symlink.
To add a new wiki, you need to take the following steps:
- Create a new database based on a template database for the new wiki. The database name should be the sub domain with a suffix, so for meta.example.org, this would be
metawiki. For a group of wikis that use a different domain, rather than your main domain, add the suffix toLocalSettings.php, and updatesuffixes.listwith the new suffix. - Add the database to all.dblist. The database name comes first, then the site name, and finally the language code. For meta.example.org, this would be
metawiki|Meta Wiki|en. - (Optional) Configure the site specific settings in
InitialiseSettings.php. - (Optional) If the wiki is login only, restricted or private, add the database to
loginonly.dblist,restricted.dblistorprivate.dblistrespectively.