|Wiki locking: $wgReadOnly|
|Disallows editing, displaying the string given as the reason.
|Introduced in version:||pre 1.1.0|
|Removed in version:||still in use|
|Allowed values:||(string), null/false|
false, prior to 1.5.7
|Other settings: Alphabetical | By function|
Functionally this setting is the same as
$wgReadOnlyFile, but uses a variable instead of a file.
If set to a string in "LocalSettings.php",
$wgReadOnly disallows editing, displaying the string given as the reason. The reason provided is preceded by the contents of MediaWiki:Readonlywarning.
$wgReadOnly = 'This wiki is currently being upgraded to a newer software version.';
The above example locks the database and provides a default statement on edit pages and also gives the included string
'This wiki is currently being upgraded to a newer software version.' as an explanation for why the database was locked. Wikitext is allowed in this string and will be rendered when the read-only warning is shown which can be used to provide links or highlight upgrade notifications.
Warning: In contrast to its name, this settings does not make the database read only! Even if $wgReadOnly is set, extensions, API scripts and other cachable events can write data nonetheless.
DB caching[edit source]
Caches that use the database cannot be written to during read only mode, which could prevent more than just editing (depending on the configuration, logging in or even viewing pages). This can be avoided by disabling cache, albeit at the cost of making your wiki slow. This can be accomplished with the following settings in LocalSettings.php:
$wgMessageCacheType = $wgMainCacheType = $wgParserCacheType = $wgSessionCacheType = CACHE_NONE; $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull';
If you want your wiki to be fast, while still not using the DB, you should consider using something like Memcached. See
$wgLocalisationCacheConf for details. If you want to enable logins while the database is readonly, at least
$wgSessionCacheType needs to be set to some real non-DB caching mechanism.
When in read-only mode, images which need to be transformed or scaled will be shown as an error message instead of as an image. To avoid this problem, put the following in LocalSettings.php: