Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\WikibaseSettings Class Reference

WikibaseSettings is a static access point to Wikibase settings defined as global state (typically in LocalSettings.php). More...

Static Public Member Functions

static isRepoEnabled ()
 
static getRepoSettings ()
 
static isClientEnabled ()
 
static getClientSettings ()
 

Static Private Member Functions

static mergeSettings (array $defaultSettings, array $customSettings, array $overrideArrays=[], array $twoDArrayMerge=[], array $falseMeansRemove=[])
 Merge two arrays of default and custom settings, so that it looks like the custom settings were added on top of the default settings.
 
static mergeComplexArrays (string $key, array $value, array $defaultValue, array $twoDArrayMerge, array $overrideArrays, array $falseMeansRemove)
 

Detailed Description

WikibaseSettings is a static access point to Wikibase settings defined as global state (typically in LocalSettings.php).

Note
WikibaseSettings is intended for internal use by bootstrapping code. Application service logic should have individual settings injected, static entry points to application logic should use top level factory methods such as WikibaseRepo::getSettings() and WikibaseClient::getSettings().
Todo
Move this to a separate component.
Author
Daniel Kinzler

Member Function Documentation

◆ getClientSettings()

static Wikibase\Lib\WikibaseSettings::getClientSettings ( )
static
Returns
SettingsArray

◆ getRepoSettings()

static Wikibase\Lib\WikibaseSettings::getRepoSettings ( )
static
Returns
SettingsArray

◆ isClientEnabled()

static Wikibase\Lib\WikibaseSettings::isClientEnabled ( )
static
Returns
bool True if and only if the Wikibase client component is enabled on this wiki.

◆ isRepoEnabled()

static Wikibase\Lib\WikibaseSettings::isRepoEnabled ( )
static
Returns
bool True if and only if the Wikibase repository component is enabled on this wiki.

◆ mergeComplexArrays()

static Wikibase\Lib\WikibaseSettings::mergeComplexArrays ( string $key,
array $value,
array $defaultValue,
array $twoDArrayMerge,
array $overrideArrays,
array $falseMeansRemove )
staticprivate

◆ mergeSettings()

static Wikibase\Lib\WikibaseSettings::mergeSettings ( array $defaultSettings,
array $customSettings,
array $overrideArrays = [],
array $twoDArrayMerge = [],
array $falseMeansRemove = [] )
staticprivate

Merge two arrays of default and custom settings, so that it looks like the custom settings were added on top of the default settings.

Originally, Wikibase extensions were loaded and configured somewhat like this:

require_once "$IP/extensions/Wikibase/client/WikibaseClient.php";
$wgWBClientSettings['repoUrl'] = 'https://pool.my.wiki';

Here, $wgWBClientSettings would be initialized by WikibaseClient.php. However, with the move to extension registration and wfLoadExtension(), this is no longer possible, and $wgWBClientSettings will start out empty. This method returns an array that looks like the custom settings were added on top of existing default settings as above, even though the default settings were in fact only loaded later.

Parameters
array$defaultSettingsThe default settings loaded from some other config file.
array$customSettingsThe custom settings from a configuration global.
string[]$overrideArrays
string[]$twoDArrayMerge
string[]$falseMeansRemove
Returns
SettingsArray The merged settings.

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