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 getSettings ( $var)
 Returns settings for a wikibase component based on global state.
 
static mergeSettings (array $defaultSettings, array $customSettings)
 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 buildEntityNamespaceConfigurations (SettingsArray $settings)
 
static getEntityNamespacesFromRepositorySettings (array $repositorySettings)
 
static applyEntityNamespacesToSettings (SettingsArray $settings, array $entityNamespaces)
 

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

◆ applyEntityNamespacesToSettings()

static Wikibase\Lib\WikibaseSettings::applyEntityNamespacesToSettings ( SettingsArray  $settings,
array  $entityNamespaces 
)
staticprivate

◆ buildEntityNamespaceConfigurations()

static Wikibase\Lib\WikibaseSettings::buildEntityNamespaceConfigurations ( SettingsArray  $settings)
staticprivate
Exceptions
MWExceptionin case of a misconfiguration
Returns
int[] An array mapping entity type identifiers to namespace numbers.

◆ getClientSettings()

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

◆ getEntityNamespacesFromRepositorySettings()

static Wikibase\Lib\WikibaseSettings::getEntityNamespacesFromRepositorySettings ( array  $repositorySettings)
staticprivate

◆ getRepoSettings()

static Wikibase\Lib\WikibaseSettings::getRepoSettings ( )
static
Note
This runs the WikibaseRepoEntityNamespaces hook to allow extensions to modify the repo 'entityNamespaces' setting.
Exceptions
MWException
Returns
SettingsArray

◆ getSettings()

static Wikibase\Lib\WikibaseSettings::getSettings (   $var)
staticprivate

Returns settings for a wikibase component based on global state.

This is intended to be used to access settings specified in LocalSettings.php.

Parameters
string$varThe name of a global variable.
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.

◆ mergeSettings()

static Wikibase\Lib\WikibaseSettings::mergeSettings ( array  $defaultSettings,
array  $customSettings 
)
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.
Returns
SettingsArray The merged settings.

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