MediaWiki master
MediaWiki\Config\ConfigRepository Class Reference

Object which holds currently registered configuration options. More...

Inherits SalvageableService.

Collaboration diagram for MediaWiki\Config\ConfigRepository:

Public Member Functions

 __construct (ConfigFactory $configFactory)
 
 add ( $name, array $config)
 Adds the definition of a configuration to this repository.
 
 get ( $name)
 Returns the ConfigItem with the given name, if there's one.
 
 getAll ()
 Returns an array of all configuration items saved in this ConfigRepository.
 
 getDescriptionOf ( $name)
 Returns the description of the given config option, This can be either a localized description, if one such, or the (maybe english only) description provided in the definition of the configuration.
 
 getPublic ()
 Returns an array of all public configuration options saved in this ConfigRepository.
 
 has ( $name, $alsoPrivate=false)
 Returns true, if this repository contains a configuration with a specific name.
 
 isEmpty ( $includePrivate=false)
 Returns true, if there're no elements in this instance, otherwise false.
 
 salvage (SalvageableService $other)
 Re-uses existing Cache objects from $other.
 

Detailed Description

Object which holds currently registered configuration options.

Deprecated
since 1.42; Introduced but seems unused since inception.
Since
1.32

Definition at line 34 of file ConfigRepository.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Config\ConfigRepository::__construct ( ConfigFactory $configFactory)
Parameters
ConfigFactory$configFactory

Definition at line 47 of file ConfigRepository.php.

Member Function Documentation

◆ add()

MediaWiki\Config\ConfigRepository::add ( $name,
array $config )

Adds the definition of a configuration to this repository.

Parameters
string$namethe name of the config
array$configOptions of this config. Values are:
  • value: The default value of this configuration, required
  • providedby: The name of the provider of this config (an extension, core, ...), required
  • configregistry: The name of the config to retrieve the value with, required
  • public: whether this option is public or not, if not set, the option is considered as "private", optional
  • description: the not localized description of this config option, optional
  • descriptionmsg: The message key of the localized description of this configuration option, optional
Exceptions
ConfigException

Definition at line 136 of file ConfigRepository.php.

References MediaWiki\Config\ConfigRepository\has().

Referenced by MediaWiki\Config\ConfigRepository\salvage().

◆ get()

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

Returns the ConfigItem with the given name, if there's one.

Throws a ConfigException otherwise.

Parameters
string$nameThe name of the configuration option to get
Returns
array
Exceptions
ConfigException

Definition at line 71 of file ConfigRepository.php.

References MediaWiki\Config\ConfigRepository\has().

◆ getAll()

MediaWiki\Config\ConfigRepository::getAll ( )

Returns an array of all configuration items saved in this ConfigRepository.

This includes all configuration options, including the ones marked as private and public.

Note: This function does not do any permission checks or something similar. You should not use this function, if the output will be available to the public audience! Use ConfigRepository::getPublic() instead.

Returns
array

Definition at line 89 of file ConfigRepository.php.

◆ getDescriptionOf()

MediaWiki\Config\ConfigRepository::getDescriptionOf ( $name)

Returns the description of the given config option, This can be either a localized description, if one such, or the (maybe english only) description provided in the definition of the configuration.

If both is not provided an empty string is returned.

Parameters
string$nameThe name of the configuration option to get the description of
Returns
string HTML-escaped string

Definition at line 110 of file ConfigRepository.php.

References wfMessage().

◆ getPublic()

MediaWiki\Config\ConfigRepository::getPublic ( )

Returns an array of all public configuration options saved in this ConfigRepository.

Returns
array

Definition at line 98 of file ConfigRepository.php.

◆ has()

MediaWiki\Config\ConfigRepository::has ( $name,
$alsoPrivate = false )

Returns true, if this repository contains a configuration with a specific name.

Parameters
string$nameThe name of the config to check the existence of
bool$alsoPrivateIf set to true, will check the private config options, too
Returns
bool

Definition at line 58 of file ConfigRepository.php.

Referenced by MediaWiki\Config\ConfigRepository\add(), and MediaWiki\Config\ConfigRepository\get().

◆ isEmpty()

MediaWiki\Config\ConfigRepository::isEmpty ( $includePrivate = false)

Returns true, if there're no elements in this instance, otherwise false.

Parameters
bool$includePrivateWhether configuration options, that are marked as private should be included in this check.
Returns
bool

Definition at line 156 of file ConfigRepository.php.

◆ salvage()

MediaWiki\Config\ConfigRepository::salvage ( SalvageableService $other)

Re-uses existing Cache objects from $other.

Cache objects are only re-used if the registered factory function for both is the same.

See also
SalvageableService::salvage()
Parameters
SalvageableService$otherThe object to salvage state from. $other must have the exact same type as $this.

Definition at line 173 of file ConfigRepository.php.

References MediaWiki\Config\ConfigRepository\add().


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