Manual:Lock the database

Since MediaWiki 1.5 you can add   to your LocalSettings.php and set this to a string describing the reason for read-only mode.

(Usual wiki markup is allowed in this string.)

This will prevent any editing on the wiki.

Example:

Alternatively, set  in LocalSettings.php to the name of a file, then put the reason for the lock inside the file. The contents of the file will be displayed to anyone trying to edit the wiki.

Note that the read-only mode does not prevent all writes to the database; if you need to prevent all writes, you need to do this on the database itself (e.g. revoke UPDATE, INSERT, DELETE from the wiki user, or put MySQL into read-only mode).

If you have the siteadmin permission, you can also use the special page Special:Lockdb to lock the database and Special:Unlockdb to unlock a previously locked database. Note that this is deprecated, and the siteadmin permission is not granted to any group per default. See Manual:User rights for information on granting permissions to groups. Also note that this works by writing resp. deleting the file specified by $wgReadOnlyFile, so make sure the file permissions are set appropriately.