MediaWiki master
MediaWiki\Config\EtcdConfig Class Reference

Interface for configuration instances. More...

Inherits MediaWiki\Config\Config, and LoggerAwareInterface.

Collaboration diagram for MediaWiki\Config\EtcdConfig:

Public Member Functions

 __construct (array $params)
 
 fetchAllFromEtcd ()
 
 get ( $name)
 Get a configuration variable such as "Sitename" or "UploadMaintenance.".
 
 getModifiedIndex ()
 
 has ( $name)
 Check whether a configuration option is set for the given name.
 
 setLogger (LoggerInterface $logger)
 

Protected Member Functions

 fetchAllFromEtcdServer (string $address, ?int $port=null)
 
 parseDirectory ( $dirName, $dirNode, &$config)
 Recursively parse a directory node and populate the array passed by reference, throwing EtcdConfigParseError if there is a validation error.
 
 parseResponse ( $rbody)
 Parse a response body, throwing EtcdConfigParseError if there is a validation error.
 

Detailed Description

Interface for configuration instances.

Since
1.29

Definition at line 38 of file EtcdConfig.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Config\EtcdConfig::__construct ( array $params)
Parameters
array$paramsParameter map:
  • host: the host address
  • directory: the etc "directory" were MediaWiki specific variables are located
  • service: service name used in SRV discovery. Defaults to 'etcd'. [optional]
  • port: custom host port [optional]
  • protocol: one of ("http", "https"). Defaults to http. [optional]
  • cache: BagOStuff instance or ObjectFactory spec thereof for a server cache. The cache will also be used as a fallback if etcd is down. [optional]
  • cacheTTL: logical cache TTL in seconds [optional]
  • skewTTL: maximum seconds to randomly lower the assigned TTL on cache save [optional]
  • timeout: seconds to wait for etcd before throwing an error [optional]

Definition at line 78 of file EtcdConfig.php.

References $params.

Member Function Documentation

◆ fetchAllFromEtcd()

MediaWiki\Config\EtcdConfig::fetchAllFromEtcd ( )
Returns
array (containing the keys config, error, retry, modifiedIndex)

Definition at line 241 of file EtcdConfig.php.

◆ fetchAllFromEtcdServer()

MediaWiki\Config\EtcdConfig::fetchAllFromEtcdServer ( string $address,
?int $port = null )
protected
Parameters
string$addressHost
?int$portPort
Returns
array (containing the keys config, error, retry, modifiedIndex)

Definition at line 260 of file EtcdConfig.php.

◆ get()

MediaWiki\Config\EtcdConfig::get ( $name)

Get a configuration variable such as "Sitename" or "UploadMaintenance.".

Parameters
string$nameName of configuration option
Returns
mixed Value configured
Exceptions
ConfigException

Implements MediaWiki\Config\Config.

Definition at line 143 of file EtcdConfig.php.

◆ getModifiedIndex()

MediaWiki\Config\EtcdConfig::getModifiedIndex ( )

Definition at line 153 of file EtcdConfig.php.

◆ has()

MediaWiki\Config\EtcdConfig::has ( $name)

Check whether a configuration option is set for the given name.

Parameters
string$nameName of configuration option
Returns
bool
Since
1.24

Implements MediaWiki\Config\Config.

Definition at line 137 of file EtcdConfig.php.

◆ parseDirectory()

MediaWiki\Config\EtcdConfig::parseDirectory ( $dirName,
$dirNode,
& $config )
protected

Recursively parse a directory node and populate the array passed by reference, throwing EtcdConfigParseError if there is a validation error.

Parameters
string$dirNameThe relative directory name
array$dirNodeThe decoded directory node
array&$configThe output array
Returns
int lastModifiedIndex The maximum last modified index across all keys in the directory

Definition at line 322 of file EtcdConfig.php.

◆ parseResponse()

MediaWiki\Config\EtcdConfig::parseResponse ( $rbody)
protected

Parse a response body, throwing EtcdConfigParseError if there is a validation error.

Parameters
string$rbody
Returns
array

Definition at line 299 of file EtcdConfig.php.

◆ setLogger()

MediaWiki\Config\EtcdConfig::setLogger ( LoggerInterface $logger)
Deprecated
since 1.41 No longer used and did not work in practice

Definition at line 133 of file EtcdConfig.php.


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