MediaWiki REL1_41
Wikimedia\Rdbms\ReadOnlyMode Class Reference

Determine whether a site is currently in read-only mode. More...

Public Member Functions

 __construct (ConfiguredReadOnlyMode $cro, ILBFactory $lbFactory)
 
 getConfiguredReason ()
 
 getReason ( $domain=false)
 Check if the site is in read-only mode and return the message if so.
 
 isConfiguredReadOnly ()
 Check whether the site is configured to be in read-only mode.
 
 isReadOnly ( $domain=false)
 Check whether the site is in read-only mode.
 
 setReason ( $msg)
 Override 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 currently in read-only mode.

To obtain an instance, use \MediaWiki\MediaWikiServices::getReadOnlyMode().

Since
1.29

Definition at line 12 of file ReadOnlyMode.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Rdbms\ReadOnlyMode::__construct ( ConfiguredReadOnlyMode $cro,
ILBFactory $lbFactory )
Access: internal
For ServiceWiring only
Parameters
ConfiguredReadOnlyMode$cro
ILBFactory$lbFactory

Definition at line 24 of file ReadOnlyMode.php.

Member Function Documentation

◆ getConfiguredReason()

Wikimedia\Rdbms\ReadOnlyMode::getConfiguredReason ( )
Since
1.41
Returns
string|false String when site is configured to be in read-only mode; false otherwise

Definition at line 63 of file ReadOnlyMode.php.

Referenced by FileBackendGroup\__construct().

◆ getReason()

Wikimedia\Rdbms\ReadOnlyMode::getReason ( $domain = false)

Check if the site is in read-only mode and return the message if so.

This checks both statically configured read-only mode, and (cached) whether the primary database host accepting writes.

Calling this may result in database connection.

Parameters
string | false$domainDomain ID, or false for the current domain
Returns
string|false String when in read-only mode; false otherwise

Definition at line 50 of file ReadOnlyMode.php.

◆ isConfiguredReadOnly()

Wikimedia\Rdbms\ReadOnlyMode::isConfiguredReadOnly ( )

Check whether the site is configured to be in read-only mode.

Since
1.41
Returns
bool

Definition at line 73 of file ReadOnlyMode.php.

◆ isReadOnly()

Wikimedia\Rdbms\ReadOnlyMode::isReadOnly ( $domain = false)

Check whether the site is in read-only mode.

Parameters
string | false$domainDomain ID, or false for the current domain
Returns
bool

Definition at line 35 of file ReadOnlyMode.php.

◆ setReason()

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

Override 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 83 of file ReadOnlyMode.php.


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