Page MenuHomePhabricator

Add Wikibase Repository and Client extensions
Open, Needs TriagePublicFeature

Description

Event Timeline

AFAIK the comment at https://gitlab.wikimedia.org/repos/ci-tools/patchdemo/-/issues/552#note_48220 is still accurate, in that this would be the minimal configuration to load Wikibase repo and client:

wfLoadExtension( 'WikibaseRepository', "$IP/extensions/Wikibase/extension-repo.json" );
require_once "$IP/extensions/Wikibase/repo/ExampleSettings.php";
wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );

T291617, which is close to done, will make the middle line unnecessary; the rest of this will still have to be hard-coded in Patch Demo, I expect (the “knowledge” about those custom extension JSON paths has to live somewhere).

I also wonder if it makes sense to present Wikibase as one extension or two. Most single Wikibase wikis use both WikibaseRepo and WikibaseClient. A repo-only wiki is possible, I think, but hardly useful (there’s not really a reason to exclude client IMHO). A client-only wiki is only possible with custom configuration, so it doesn’t really make sense in Patch Demo. So perhaps it’s easiest to just offer users one checkbox for Wikibase and make that load both repo and client together (with the above snippet).

T291617, which is close to done, will make the middle line unnecessary; the rest of this will still have to be hard-coded in Patch Demo, I expect (the “knowledge” about those custom extension JSON paths has to live somewhere).

Slight complication here. Apparently the wfLoadExtension() calls for normal extensions aren’t actually written by Patch Demo; Patch Demo calls MediaWiki’s install.php with --with-extensions, and that generates a LocalSettings.php that loads all the extensions. So if we want to call wfLoadExtension() with custom JSON paths, that information might have to live in MediaWiki core.

Fortunately, MediaWiki still supports “legacy” extensions that have a PHP file instead; if you run install.php --with-extensions now, it’ll generate a LocalSettings.php with require_once "$IP/extensions/Wikibase/Wikibase.php";. Wikibase.php, in turn, contains the two wfLoadExtension() calls that we need. (I believe this is also how Wikibase is loaded in CI.)

Due to T291617, the resulting wiki doesn’t quite work yet (the entitySources setting is missing because Wikibase.php doesn’t load the example settings), but once that’s done, I think adding Wikibase support to Patch Demo should be as simple as adding it to the relevant lists (repository-lists/all.txt, some other files in that directory, and helm/patchdemo/files/repos.cfg, I think?). This would be the “one-extension” presentation mentioned in the previous comment – the interface would present one Wikibase extension which would load both extensions internally.