Page MenuHomePhabricator

Migrate wgWBClientDataTypes + wgWBClientSettings loading out of Client PHP entry point
Closed, ResolvedPublic

Description

We may be able to migrate away from wgWBClientSettings entirely, and move to MediaWiki’s standard Config interface instead.

Event Timeline

At least $wgWBClientDataTypes is, as far as I can tell, not used externally – other extensions that add data types use the WikibaseClientDataTypes hook for that instead of manipulating the global directly, which is very nice. (Though I imagine we could also use attributes instead, if we wanted to.)

Edit: and the same seems to be true for $wgWBRepoDataTypes, so I would try to get rid of both of those globals at once – otherwise there’s some documentation like “$wgWBRepoDataTypes resp. $wgWBClientDataTypes” which we’d have to awkwardly rephrase because the two settings would work differently.

Decided to create a separate subtask for $wgWBClientDataTypes so it’s clearer that I’m not picking up the $wgWBClientSettings part (yet) – that’s still free for anyone else to pick up.

Edit: and apparently new subtasks don’t show up in the task activity (between the comments) anymore? anyways it’s T256756: Remove $wgWBRepoDataTypes and $wgWBClientDataTypes global variables

Change 608663 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] WIP: Don’t load $wgWBClientSettings in WikibaseClient.php

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/ /608663

I quite like the appraoch. I wish we could rebuild the configs with config registry, it would have been awesome: https://www.mediawiki.org/wiki/Manual:Configuration_for_developers

But it's lot of work, specially since the Config object is immutable and our objects (SettingsArray) is not (which is not good, I don't want the configuration change dynamically at middle of code run).

Yeah, I don’t think using the config registry is feasible for this sprint. The most significant missing feature is probably lazy initialization of values – in Wikibase, a lot of the settings are callbacks that compute the setting on-demand, which isn’t supported by MediaWiki’s Config system as far as I’m aware.

I added a test to my change for $wgWBClientSettings, and removed a TODO. I think it’s ready for proper review now. (Still feels very risky, though, I’ll be honest.)

Change 608663 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Don’t load $wgWBClientSettings in WikibaseClient.php

https://gerrit.wikimedia.org/r/608663

Change 609794 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/vagrant@master] Remove $wgWBSharedSettings

https://gerrit.wikimedia.org/r/609794

Change 609794 merged by jenkins-bot:
[mediawiki/vagrant@master] Remove $wgWBSharedSettings

https://gerrit.wikimedia.org/r/609794