Tech:Mw-config

mw-config is where Miraheze’s MediaWiki configuration (and more!) is stored. It is publicly available on GitHub, and anyone can submit a PR to change things around, install custom hook handlers for their wiki, and more.

Where everything is

mw-config is split up into multiple files, in sharp contrast with the all-encompasing LocalSettings.php you would normally have in typical MediaWiki installations. You should know the following terminology:

  • Global means either affecting all wikis in Miraheze or affecting Miraheze in general, nor specifically targeting wikis.
  • Local means affecting one or more wikis in Miraheze, but not all of them.

| + Files and their purpose |

FilePurpose
Database.phpDatabase-related configuration, for all the farm
FileBackend.phpFile storage-related configuration, for all the farm
GlobalCache.phpCache related-configuration, for all the farm
GlobalExtensions.phpExtensions loaded on all of Miraheze’s wikis. These ones cannot be disabled via ManageWiki
GlobalLogging.phpMiraheze’s logging configuration
GlobalSettings.phpA bit of a mess. Contains all of our globally-installed hooks, handles loading some wiki-specific extensions, as well as loading dependencies of some extensions (unused?) some globally-applied configs, and much more
GlobalSkins.phpSkins loaded in all of our wikis. These ones cannot be disabled via ManageWiki
InterwikiSortOrders.phpConfiguration for $wgInterwikiSortingInterwikiSortOrders, from the InterwikiSorting extension
LocalSettings.phpThe entry point. Loads the rest of the files, has some configs, but is mostly used for configurating variables the same way you’d do in standard MediaWiki, but through wgConf instead.
LocalWiki.phpWiki-specific settings that cannot be done through ManageWiki or LocalSettings.php’s wgConf, as well as custom hook handlers for the wikis
ManageWikiExtensions.phpEntries for all the extensions that can be configured through ManageWiki
ManageWikiNamespaces.phpConfiguration related to namespaces
ManageWikiSettings.phpConfiguration for all the variables that can be configured via ManageWiki
SemanticMediaWiki.phpConfiguration specific to the Semantic MediaWiki extension
Wikibase.phpConfiguration specific to the Wikibase extensions

How to do some typical changes

A lot of the changes done to this repo are just the same thing but for different wikis each time.

Extended confirmed protection or other custom protection levels

Example PR: T11506: Setup extendedconfirmed protection for mypediawiki

TODO

Removing ManageWiki extensions or configurations

TODO

Installing new extensions and their configuration

See also: User:PixDeVl/TC 101#mediawiki-repos.yaml & ManageWikiExtensions.php

TODO

Writing a custom hook handler for a wiki

Example PR: T9101: Redirect USER_WIKI_TALK to USER_TALK for polandballruwiki

Assuming you know how to write hook handlers on regular MediaWiki LocalSettings.php, here it is very similar but you do them on LocalWiki.php instead.

  • Go to LocalWiki.php.
  • Write a case statement for your wiki’s database name (you can see this on ManageWiki if you don’t know it).
  • Attach your hook via $wgHooks.

Go to Source →