Searching for Default Settings
A Guide to Using MediaWiki in a Hosted Environment
An instructional website by the developer of mh370wiki.net - a MediaWiki site about Malaysia Airlines Flight MH370.
How To Find Default Configuration Settings
This article describes a method to find MediaWiki default configuration settings.
Note: MediaWiki settings should only be changed by adding or amending a configuration in LocalSettings.php.
Problem Example
The article Page Titles discusses a problem with a magic word DISPLAYTITLE not functioning correctly and the underlying issue is related to a variable $wgRestrictDisplayTitle. Applying a value to this variable in LocalSettings.php did not produce the expected outcome. So where in MediaWiki code was the default setting?
The answer is - in /w/includes/config-schema.php, but I didn't know that then. The search method described below is useful for finding a style (class) or any other key word within MediaWiki.
I decided to search for the string 'DisplayTitle', written like the variable names $wgAllowDisplayTitle and $wgRestrictDisplayTitle.
Method - Use findstr
It was simplest to search a local copy of MediaWiki on my PC. The The steps are:-
- In Windows open the Command Prompt.
- Navigate to the MediaWiki folder. Use a drive letter eg D: at the command prompt and cd to change directory. dir provides a directory listing.
- At the command prompt enter findstr /S "DisplayTitle" *.php /m
The output was more than a screen full, but two items stood out:-
The file config-schema.php is located in /w/includes. The two lines were then easy to find.
The article Page Titles suggested changing settings in config-schema.php, which is not good practice, but is a 'workaround'.
Command explanation:-
- findstr is an abbreviation of find string. For command help, type findstr /? at the command prompt.
- /S means to search subdirectories
- "DisplayTitle" is the search string.
- *.php means to search within all .php files only
- /m prints the filename if there is a match
Some Useless Information
Variables used by MediaWiki are listed in the file /w/docs/config-vars.php
Names, without the prefix $wg, are listed in /w/includes/MainConfigNames.php
DefaultSettings.php does not have any default settings, is 'deprecated' (since MediaWiki 1.39), meaning it isn't used anymore, but says that "Default settings are now defined in the MainConfigSchema class." To follow that, /w/includes/MainConfigSchema only contains "schema declarations for all configuration variables known to MediaWiki core.", not the default values.
Everything useful seems to be configured in /w/includes/config-schema.php and "This file is automatically generated using maintenance/generateConfigSchema.php."
For example, the CategoryPagingLimit, which I didn't know existed until exceeding the limit in the mh370wiki.net website, is set in config-schema.php
'CategoryMagicGallery' => true, 'CategoryPagingLimit' => 200, 'CategoryCollation' => 'uppercase',
Links
- Manual:Configuration settings
- (Listed by function)
https://www.mediawiki.org/wiki/Manual:Configuration_settings - Manual:Configuration settings (alphabetical)
- This is an index of all supported configuration settings based on the MainConfigSchema.php (or DefaultSettings.php before MediaWiki 1.39) file.
https://www.mediawiki.org/wiki/Manual:Configuration_settings_(alphabetical)
Related Articles
See Also: MediaWiki Default Styles