Manual:$wgReadOnly

Details
If set to a string (e.g., in LocalSettings.php), $wgReadOnly disallows editing, displaying the string given as the reason. Functionally the same as $wgReadOnlyFile, but using a variable instead of a file.

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