The current configuration system in Wikibase depends on two global variables: $wgWBRepoSettings and $wgWBClientSettings and sysadmins can customize a wiki by modifying this global variable directly:
$wgWBRepoSettings['serializationFormat'] = 'application/json';
and in turn, WikibaseSettings tries to build a SettingsArray (this class has issues like being mutable meaning config can change on the fly, joy). This also means merging configuration can be tricky and complicated: T257447: Don’t load Repo settings in PHP entry point and T256252: Migrate wgWBClientDataTypes wgWBClientSettings loading out of Client PHP entry point.
The plausible solution is to migrate to config management in core: Documentation. But any sort of work requires lots of changes by sysadmins (like $wgWBRepoSettings['serializationFormat'] -> $wgWBRepoSettingsSerializationFormat ) and keeping backward compatibility is borderline impossible (what if one of them gets overriden by the sysadmin and not the other, what if they diverge drastically, etc..). So here's my proposed solution:
- Define a new implementation of Config in core, something like GlobalArrayConfig (vs. GlobalVarConfig). Which takes name of a global array (like $wgWBRepoSettings) and returns the configs as part of that array.
- Make ConfigFactory work with ObjectFactory, so we would be able to define such thing in extension.json and set the variable name for Wikibase:
{ "ConfigRegistry": { "wikibaseRepo": { "factory": "GlobalArrayConfig::newInstance", "args": ["wgWBRepoSettings"] } } }
- Build an adapter for Config to SettingsArray and use it in WikibaseSettings.
- Slowly migrate configs to extnesion.json
- Drop WikibaseSettings and other bits
Does this make sense?