You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org

Configuration files

From Wikitech-static
Revision as of 20:47, 29 September 2014 by imported>BryanDavis (/a/common -> /srv/mediawiki-staging; /usr/local/apache/common -> /srv/mediawiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to 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

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 /home/wikipedia/common/all.dblist
  • There is a dblist for every wiki family (wikipedia, wikibooks, ...) as well as 'private' for private wikis and a few others. See /home/wikipedia/common/*.dblist to see what's available
    • After updating a dblist, run sync-dblist 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.

CommonSettings.php

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.

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.

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

$IP/extensions/AbuseFilter/AbuseFilter.php
$IP/extensions/AjaxTest/AjaxTest.php
$IP/extensions/AntiBot/AntiBot.php
...

ExtensionMessages-1.NNwmfMM.php is a PHP file that contains the actual workaround. mw-update-l10n rebuilds it from 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
  • checkers.php: code for blocking or logging all kinds of requests. Lots of old stuff has piled up here. The 403-for-no-User-Agent check lives here
  • 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
  • lucene.php: which wiki uses which search server and other Lucene-related settings
  • 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
    this is in SVN, just svn commit from fenari
  • reporting-setup.php: fundraiser stuff, no idea what it does
  • secret-projects.php: misc stuff, no idea
  • secure.php: configuration for the secure gateway
  • wgConf.php: setup code for the configuration system