Manual:$wgReadOnly

Details
Functionally this setting is the same as $wgReadOnlyFile, but uses a variable instead of a file.

If set to a string in "LocalSettings.php",  disallows editing, displaying the string given as the reason. The reason provided is preceded by the contents of MediaWiki:Readonlywarning.

The above example locks the database and provides a default statement on edit pages and also gives the included string  as an explanation for why the database was locked.