Extension:Configure

The Configure extension allows bureaucrats (by default) to modify configuration settings of the wiki.

Installation

 * Download the latest snapshot and extract it to your extensions directory.
 * Edit LocalSettings.php and add the following lines:

as mentioned, you have to call  function in LocalSettings.php because you may want to customize some settings of the extension and to prevent an attack, the settings have to be always defined (this is done by including the Configure.php file), even if they won't be changed because they can arbitrary be set if the register_globals feature of PHP is turned on.

Configuration settings
This extension add some configuration settings. They are not editable through Special:Configure or Special:Extensions. You need to change them in LocalSettings.php.

$wgConfigureFilesPath
The extension will require a directory to store the configuration and this directory have to be writable by the web server. The default path is the directory. You can use this setting to change it. Don't forget to override this variable between the time you include the Configure.php file and the time you call efConfigureSetup, otherwise your changes won't be used.

serialized directory may be publicly viewable (if using MediaWiki < 1.13 or a web server other than Apache), and users will be able to see the whole configuration, so please make it unreadable by web interface or change it to a directory that isn't accessible via the web.

$wgConfigureWikis
Allows foreign wiki configuration. Can be either:
 * : allow any wiki
 * : don't allow any wiki (default)
 * an array: array of allowed wikis (e.g. $wgConfigureWikis = $wgLocalDatabases)

Users will need *-interwiki right to edit foreign wiki configuration (configure-interwiki, extensions-interwiki, viewconfig-interwiki)

$wgConfigureAdditionalExtensions
Array of custom extensions (keys have no importance, it has the same format as $extensions in Configure.settings-ext.php)

Each value of this array should be an array with the following keys:
 * name: name of the extension (required)
 * dir: dir name of the extension, if different than extension's name
 * file: main file name, if different that name.php
 * settings: array of settings mapping setting's name to its type (see for the list of allowed types)
 * array: array types for settings defined as  above
 * schema: set it to true if the extension requires a database schema change
 * url: url to the documentation page

Example: In this case, the file to include is

$wgConfigureViewRestrictions
Array of supplementary view restrictions. Format is if multiple rights are given, the user must have all of them to see the setting.

$wgConfigureEditRestrictions
Array of supplementary edit restrictions. Format is if multiple rights are given, the user must have all of them to edit the setting.

$wgConfigureNotEditableSettings
Array of not editable settings, by anyone. They won't be saved in conf-now.ser.

$wgConfigureUpdateCacheEpoch
Whether to update $wgCacheEpoch when saving changes in Special:Configure.

$wgConfigureStyleVersion
Like $wgStyleVersion but for Configure itself. You shouldn't change it.

Special pages
This extension adds three special pages:

Special:Configure

 * Right needed to access this page: configure (given by default to bureaucrats)

It allows to configure settings of MediaWiki itself. That page shows all settings available for MediaWiki, they are groupped by function, like Manual:Configuration settings. Each setting has a link to its description page on this wiki. The list of old versions is displayed at the top of the page, by clicking on a version, it will show the configuration as it was at that time, so that the configuration can be reverted to any version.

Some settings are restricted and can only be changed by users with configure-all right. This include the following settings:
 * paths/files (because they require also "external" changes, i.e. server rewrite rules, squid configuration, ...)
 * database
 * settings containing password such as $wgSMTP
 * access (to not allow users with only configure right to grant themself configure-all right)
 * $wgSecretKey and $wgProxyKey (they contain sensitive data)

Special:Extensions

 * Right needed to access this page: extensions (given by default to bureaucrats)

Same as Special:Configure, but for extensions. You need to put extensions in the extensions directory of your MediaWiki install or this extension won't detect them.

Special:ViewConfig

 * Right needed to access this page: viewconfig (given by default to sysops)

This special page allows sysop (by default) to see the current configuration of the wiki. You can see any version of the configuration, diffs between versions and edit specific versions.

Users with configure or extensions rights will also see links to Special:Configure and/or Special:Extensions if they can access these pages.

Maintenance scripts
This extension has three maintenance scripts. They assume that the extension is installed in the extensions directory of the MediaWiki software (i.e. files are in the extensions/Configure directory), if this is not the case, you can set the  environment variable to the path of your MediaWiki installation and the scripts will use it.

findSettings.php
This script helps to develop the extension and maintain Manual:Configuration settings. It search for settings in  and compares them with the ones registred in the extension, Manual:Configuration settings (if the   option is passed to the script) or Manual:Configuration settings (alphabetical) (if the   options are passed to the script). May have some false positives if not using the latest development version.

manage.php
This script helps to manage configuration files. It should work even if the current version is broken. You can:
 * list all versions with the  option
 * delete a specific version with the  option (warning: you cannot undelete that version anymore).
 * revert to a specific version with the  option (i.e. set that version as working version)

writePHP.php
This script writes settings stored in serialized format in PHP script. Options:
 * : write  for all wikis, if not passed it will writes variables as in the default LocalSettings.php
 * : write settings of a specific wiki (not used if you pass )
 * : write settings taken from a specific version (default: current)
 * : file used to store the ouput of the script (default: STDOUT)

Hints
Although this extension allows you to configure all settings, it's recommended to keep the original LocalSettings.php file. You can simply add the extension after the default settings. If you don't want a setting to be modified, simply redeclare it after calling efConfigureSetup, it will still be customizable in Special:Configure but changes won't have any effect.

This extension uses an extended class of SiteConfiguration, for "normal" installation, it isn't useful, but for some wiki farms, it will allow to configure multiple wikis with only one copy of the software. To change the configuration you want to load, pass an argument to. A user with 'configure-interwiki' right will also be able to change any configuration.

Troubleshooting
If an admin changed the settings in a way that the wiki can't work anymore, you can simply drop the conf-now.ser file you'll find in $wgConfigureFilesPath directory. Then it will fall back to the default configuration that is in LocalSettings.php. It's why it's important to keep that file.

You can also use the manage.php maintenance script to revert it to an older version. This script should work even if the configuration is broken.

Read only mode
This extension has also a read only mode. To use this, install the extension as stated above, but don't call the  function.

In that mode, Special:Configure and Special:Extension will display an error, but Special:ViewConfig will show the current configuration without history or wiki selection.

Bugs
Please report bugs on bugzilla, with Product=MediaWiki extensions and Component=Configure. Thank you.

Settings types
List of allowed values for settings types (e.g.  key of $wgConfigureAdditionalExtensions):


 * : boolean
 * : string
 * : integer
 * An array: array of allowed values (will produce radio buttons). The format is  where value1 and value2 are the values to use if the radio is checked and desc1 and desc2 the description of the radion button, as displayed to th user.
 * : arrays (see below)

Arrays
Arrays need more a more specific type too. This is not declared at the same place than the type (e.g. in  for $wgConfigureAdditionalExtensions)
 * : array of strings where keys have no importance
 * : like simple, but values are array with 2 values (for $wgImageLimits).
 * : associative arrays, values are strings
 * : single dimension array with namespaces numbers in the key and a boolean value
 * : same as ns-bool but with a string in the value
 * : same as ne-text, but the value is an array of strings
 * : like simple, but values are restricted to namespaces index
 * two dimensions array with group name in first key, right name in the second and boolean value (for $wgGroupPermissions)
 * : two dimensions array with group name in first key and then a 'simple' array
 * : other types of arrays not currenty supported

To do

 * Some settings are still uneditable because of their array usage, this will need to develop some specific method to change them.