MediaWiki REL1_39
|
Utility for loading settings files. More...
Public Member Functions | |
__construct (string $baseDir, ExtensionRegistry $extensionRegistry, ConfigBuilder $configSink, PhpIniSink $phpIniSink, BagOStuff $cache=null) | |
apply () | |
Apply any settings loaded so far to the runtime environment. | |
assumeDirtyConfig () | |
Notify SettingsBuilder that it can no longer assume that is has full knowledge of all configuration variables that have been set. | |
detectDeprecatedConfig () | |
Detect usage of deprecated settings. | |
fileExists (string $path) | |
Checks whether the given file exists relative to the settings builder's base directory. | |
finalize () | |
Settings can't be loaded and applied after calling this method. | |
getConfig () | |
Returns the config loaded so far. | |
getConfigBuilder () | |
getConfigSchema () | |
Return the configuration schema. | |
getDefaultConfig () | |
Return a Config object with default for all settings from all schemas loaded so far. | |
getDefinedConfigKeys () | |
Returns the names of all defined configuration variables. | |
getWarnings () | |
Returns any warnings logged by calling warning(). | |
load (SettingsSource $source) | |
Load settings from a SettingsSource . | |
loadArray (array $newSettings) | |
Load settings from an array. | |
loadFile (string $path) | |
Load settings from a file. | |
overrideConfigValue (string $key, $value) | |
Override the value of a config variable. | |
overrideConfigValues (array $values) | |
Override the value of multiple config variables. | |
putConfigValue (string $key, $value) | |
Puts a value into a config variable. | |
putConfigValues (array $values) | |
Sets the value of multiple config variables. | |
validate () | |
Assert that the config loaded so far conforms the schema loaded so far. | |
warning (string $msg) | |
Log a settings related warning, such as a deprecated config variable. | |
MediaWiki\Settings\SettingsBuilder::__construct | ( | string | $baseDir, |
ExtensionRegistry | $extensionRegistry, | ||
ConfigBuilder | $configSink, | ||
PhpIniSink | $phpIniSink, | ||
BagOStuff | $cache = null ) |
string | $baseDir | |
ExtensionRegistry | $extensionRegistry | |
ConfigBuilder | $configSink | |
PhpIniSink | $phpIniSink | |
BagOStuff | null | $cache | BagOStuff used to cache settings loaded from each source. The caller should beware that secrets contained in any source passed to load or loadFile will be cached as well. |
Definition at line 96 of file SettingsBuilder.php.
References $cache, MediaWiki\MainConfigNames\ExtensionDirectory, and MediaWiki\MainConfigNames\StyleDirectory.
MediaWiki\Settings\SettingsBuilder::apply | ( | ) |
Apply any settings loaded so far to the runtime environment.
SettingsBuilderException |
Definition at line 279 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::assumeDirtyConfig | ( | ) |
Notify SettingsBuilder that it can no longer assume that is has full knowledge of all configuration variables that have been set.
This would be the case when other code (such as LocalSettings.php) is manipulating global variables which represent config values.
This is used for optimization: up until this method is called, default values can be set directly for any config values that have not been set yet. This avoids the need to run merge logic for all default values during initialization.
Definition at line 376 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::detectDeprecatedConfig | ( | ) |
Detect usage of deprecated settings.
A setting is counted as used if it has a value other than the default.
Definition at line 210 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::fileExists | ( | string | $path | ) |
Checks whether the given file exists relative to the settings builder's base directory.
string | $path |
Definition at line 159 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::finalize | ( | ) |
Settings can't be loaded and applied after calling this method.
Definition at line 602 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::getConfig | ( | ) |
Returns the config loaded so far.
Implicitly triggers apply() when needed.
Definition at line 571 of file SettingsBuilder.php.
Referenced by MediaWiki\Maintenance\MaintenanceRunner\overrideConfig().
MediaWiki\Settings\SettingsBuilder::getConfigBuilder | ( | ) |
Definition at line 611 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::getConfigSchema | ( | ) |
Return the configuration schema.
Definition at line 255 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::getDefaultConfig | ( | ) |
Return a Config object with default for all settings from all schemas loaded so far.
If the schema for a setting doesn't specify a default, null is assumed.
Definition at line 240 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::getDefinedConfigKeys | ( | ) |
Returns the names of all defined configuration variables.
Definition at line 265 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::getWarnings | ( | ) |
Returns any warnings logged by calling warning().
Definition at line 638 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::load | ( | SettingsSource | $source | ) |
Load settings from a SettingsSource
.
SettingsSource | $source |
Definition at line 122 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::loadArray | ( | array | $newSettings | ) |
Load settings from an array.
array | $newSettings |
Definition at line 138 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::loadFile | ( | string | $path | ) |
Load settings from a file.
string | $path |
Definition at line 148 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::overrideConfigValue | ( | string | $key, |
$value ) |
Override the value of a config variable.
This ignores any merge strategies and discards any previous value. This is a shorthand for overrideConfigValues( [ $key => $value ] ).
string | $key | the name of the config setting |
mixed | $value | The value to set |
Definition at line 545 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::overrideConfigValues | ( | array | $values | ) |
Override the value of multiple config variables.
This ignores any merge strategies and discards any previous value. This is a shorthand for loadArray( [ 'config-overrides' => $values ] ).
array | $values | An associative array mapping names to values. |
Definition at line 560 of file SettingsBuilder.php.
Referenced by Installer\overrideConfig().
MediaWiki\Settings\SettingsBuilder::putConfigValue | ( | string | $key, |
$value ) |
Puts a value into a config variable.
Depending on the variable's specification, the new value may be merged with the previous value, or may replace it. This is a shorthand for putConfigValues( [ $key => $value ] ).
string | $key | the name of the config setting |
mixed | $value | The value to set |
Definition at line 513 of file SettingsBuilder.php.
Referenced by MediaWiki\Maintenance\MaintenanceRunner\overrideConfig().
MediaWiki\Settings\SettingsBuilder::putConfigValues | ( | array | $values | ) |
Sets the value of multiple config variables.
Depending on the variables' specification, the new values may be merged with the previous values, or they may replace them. This is a shorthand for loadArray( [ 'config' => $values ] ).
array | $values | An associative array mapping names to values. |
Definition at line 529 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::validate | ( | ) |
Assert that the config loaded so far conforms the schema loaded so far.
Definition at line 196 of file SettingsBuilder.php.
MediaWiki\Settings\SettingsBuilder::warning | ( | string | $msg | ) |
Log a settings related warning, such as a deprecated config variable.
This can be used during bootstrapping, when the regular logger is not yet available. The warnings will be passed to a regular logger after bootstrapping is complete. In addition, the updater will fail if it finds any warnings. This allows us to warn about deprecated settings, and make sure they are replaced before the update proceeds.
string | $msg |
Definition at line 627 of file SettingsBuilder.php.