Configuration files

From Wikitech
Jump to: navigation, search

See also: How to do a configuration change, Heterogeneous deployment.

Our configuration lives in /srv/mediawiki-staging/wmf-config on the deployment host 'tin', and tools such as scap sync this directory to /srv/mediawiki on cluster hosts. (The same common directory also has subdirectories for each live branch of the MediaWiki codebase.) Many configuration files are in the subdirectory wmf-config. Most files are maintained in the git repository operations/mediawiki-config.


InitialiseSettings.php contains a huge array of settings. The format, roughly, is

'wgDefaultSkin' => array( // Variable name, without the $
	'default' => 'vector', // Default value, use 'wiki' instead of 'default' to set the value for Wikipedias
	'nostalgiawiki' => 'nostalgia', // Value for a specific wiki
	'wikibooks' => 'monobook', // Value for all wikis listed in /home/wikipedia/common/wikibooks.dblist
	// etc.

Some random useful facts:

  • The wiki names used in the keys are database names and are listed in all.dblist
  • There is a dblist for every wiki family (wikipedia, wikibooks, ...) as well as 'private' for private wikis and a few others. See *.dblist to see what's available
    • After updating a dblist, run sync-file dblists/ to sync the change
  • When multiple values apply to one wiki, the most specific one wins (i.e. wiki name beats dblist beats 'default')
  • We often use variables starting with $wmg to trigger certain blocks of code in CommonSettings.php (e.g. enabling extensions with $wmgEnableMyExtension)
  • Extension configuration variables don't work here because the extension setup file will set them back to the defaults; when we do want to configure them here, we'll set 'wmgMyExtensionThingy' instead, then in CommonSettings.php set $wgMyExtensionThingy = $wmgMyExtensionThingy; after including the extension setup file.


This file includes "configuration code", i.e. configuration that can't be done with simple variable assignments. This includes extensions, dynamic things and a whole lot of other random things that have been piling up here in the past years.

When adding a new extension, you should put its setup code (require_once() plus any other settings) here in an if ( $wmgEnableMyExtension ) block (assuming it's not going to just be enabled everywhere).

extension-list and ExtensionMessages-XXX.php

All of our wikis share the same localization cache, but in normal setups this causes problems when the cache is shared between wikis with different sets of enabled extensions. We work around this by listing all extensions enabled on any wiki explicitly.

wmf-config/extension-list lists the paths to the extension setup file (NOT the i18n file!) of every extension enabled on any wiki (except wikitech). The paths start with $IP/extensions and $IP/skins and each path is on a line by itself:


ExtensionMessages-1.NNwmfMM.php is a PHP file that contains the actual workaround. mw-update-l10n rebuilds it from wmf-config/extension-list. You can run it yourself to check for errors. You must use wiki that is deployed to the correct version.

$ cd /srv/mediawiki-staging/wmf-config
$ mwscript mergeMessageFileList.php --wiki=testwiki --list-file=extension-list --output=/tmp/junkExtensionMessages.php

After running this, check the output for error messages, and diff it with the current ExtensionMessages.php to verify the changes are sane.

Other files

  • abusefilter.php: configuration for the AbuseFilter extension
  • db-*.php: Defines which wikis are in which section, which database servers are in which section, etc., etc., useful as a reference for DB-related facts like those. Don't mess with this file unless you know what you're doing
  • flaggedrevs.php: configuration for the FlaggedRevs extension
  • liquidthreads.php: configuration for the LiquidThreads extension
  • mc.php: configuration for memcached, mostly a list of available memcached servers
  • missing.php: generates the "This wiki doesn't exist" page. Not really a configuration file
  • wmf-config/PrivateSettings.php: passwords and other non-public things - the real git repository containing this file is on tin at /srv/mediawiki-staging/private. Please commit changes there.
  • wgConf.php: setup code for the configuration system