MediaWiki master
Wikimedia\Rdbms\ConfiguredReadOnlyMode Class Reference

Determine whether a site is statically configured as read-only. More...

Public Member Functions

 __construct ( $reason, ?string $reasonFile=null)
 
 getReason ()
 
 isReadOnly ()
 Check whether the site is in read-only mode.
 
 setReason ( $msg)
 Set the read-only mode, which will apply for the remainder of the request or until a service reset.
 

Detailed Description

Determine whether a site is statically configured as read-only.

Unlike ReadOnlyMode, this only checks site configuration. It does not confirm whether the primary database host actively accepts writes.

To obtain an instance, use \MediaWiki\MediaWikiServices::getConfiguredReadOnlyMode(). This service can be configured via $wgReadOnly and $wgReadOnlyFile.

Since
1.29

Definition at line 16 of file ConfiguredReadOnlyMode.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Rdbms\ConfiguredReadOnlyMode::__construct ( $reason,
?string $reasonFile = null )
Parameters
string | false | null$reasonCurrent reason for read-only mode, if known. null means look in $reasonFile instead.
string | null$reasonFileA file to look in for a reason, if $reason is null. If it exists and is non-empty, its contents are treated as the reason for read-only mode. Otherwise, the site is not read-only.

Definition at line 30 of file ConfiguredReadOnlyMode.php.

Member Function Documentation

◆ getReason()

Wikimedia\Rdbms\ConfiguredReadOnlyMode::getReason ( )
Returns
string|false String when in read-only mode; false otherwise

Definition at line 47 of file ConfiguredReadOnlyMode.php.

◆ isReadOnly()

Wikimedia\Rdbms\ConfiguredReadOnlyMode::isReadOnly ( )

Check whether the site is in read-only mode.

Returns
bool

Definition at line 40 of file ConfiguredReadOnlyMode.php.

◆ setReason()

Wikimedia\Rdbms\ConfiguredReadOnlyMode::setReason ( $msg)

Set the read-only mode, which will apply for the remainder of the request or until a service reset.

Parameters
string | false | null$msg

Definition at line 69 of file ConfiguredReadOnlyMode.php.


The documentation for this class was generated from the following file: