WikibaseSettings is a static access point to Wikibase settings defined as global state (typically in LocalSettings.php).
More...
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.
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
◆ applyEntityNamespacesToSettings()
static Wikibase\Lib\WikibaseSettings::applyEntityNamespacesToSettings |
( |
SettingsArray |
$settings, |
|
|
array |
$entityNamespaces |
|
) |
| |
|
staticprivate |
◆ buildEntityNamespaceConfigurations()
static Wikibase\Lib\WikibaseSettings::buildEntityNamespaceConfigurations |
( |
SettingsArray |
$settings | ) |
|
|
staticprivate |
- Exceptions
-
MWException | in case of a misconfiguration |
- Returns
- int[] An array mapping entity type identifiers to namespace numbers.
◆ getClientSettings()
static Wikibase\Lib\WikibaseSettings::getClientSettings |
( |
| ) |
|
|
static |
- Exceptions
-
- 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
-
- 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 | $var | The 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 | $defaultSettings | The default settings loaded from some other config file. |
array | $customSettings | The custom settings from a configuration global. |
- Returns
- SettingsArray The merged settings.
The documentation for this class was generated from the following file: