MediaWiki REL1_37
ConfiguredReadOnlyMode Class Reference

A read-only mode service which does not depend on LoadBalancer. More...

Public Member Functions

 __construct ( $reason, $reasonFile=null)
 
 getReason ()
 Get the value of $wgReadOnly or the contents of $wgReadOnlyFile.
 
 isReadOnly ()
 Check whether the wiki 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.
 

Private Attributes

string bool null $reason
 
string null $reasonFile
 

Detailed Description

A read-only mode service which does not depend on LoadBalancer.

To obtain an instance, use MediaWikiServices::getInstance()->getConfiguredReadOnlyMode().

Since
1.29

Definition at line 9 of file ConfiguredReadOnlyMode.php.

Constructor & Destructor Documentation

◆ __construct()

ConfiguredReadOnlyMode::__construct (   $reason,
  $reasonFile = null 
)
Parameters
string | bool | 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 wiki is not read-only.

Definition at line 23 of file ConfiguredReadOnlyMode.php.

References $reason, and $reasonFile.

Member Function Documentation

◆ getReason()

ConfiguredReadOnlyMode::getReason ( )

Get the value of $wgReadOnly or the contents of $wgReadOnlyFile.

Returns
string|bool String when in read-only mode; false otherwise

Definition at line 42 of file ConfiguredReadOnlyMode.php.

Referenced by FileBackendGroup\__construct(), MWLBFactory\applyDefaultConfig(), and isReadOnly().

◆ isReadOnly()

ConfiguredReadOnlyMode::isReadOnly ( )

Check whether the wiki is in read-only mode.

Returns
bool

Definition at line 33 of file ConfiguredReadOnlyMode.php.

References getReason().

◆ setReason()

ConfiguredReadOnlyMode::setReason (   $msg)

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

Parameters
string | null$msg

Definition at line 64 of file ConfiguredReadOnlyMode.php.

Member Data Documentation

◆ $reason

string bool null ConfiguredReadOnlyMode::$reason
private

Definition at line 11 of file ConfiguredReadOnlyMode.php.

Referenced by __construct().

◆ $reasonFile

string null ConfiguredReadOnlyMode::$reasonFile
private

Definition at line 14 of file ConfiguredReadOnlyMode.php.

Referenced by __construct().


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