when the autoloader of Wikibase is loaded the Mediawiki installer fails
Closed, ResolvedPublic1 Story Points

Description

When the autoloader of Wikibase is loaded the Mediawiki installer fails. I hit this when trying to use the composer merge plugin in our CI instead of cloning mediawiki/vendor and running composer once for each extension that needs it.

It seems Wikibase is automatically enabled when it is not explicitly disabled, but it can't cope with certain settings not being there.

Example from: https://integration.wikimedia.org/ci/job/mwext-WikidataQuality-repo-tests-mysql-zend/46/consoleFull

MWException from line 82 of /mnt/jenkins-workspace/workspace/mwext-WikidataQuality-repo-tests-mysql-zend/src/extensions/Wikibase/repo/Wikibase.hooks.php: Wikibase: Incomplete configuration: $wgWBRepoSettings["entityNamespaces"] has to be set to an array mapping content model IDs to namespace IDs. See ExampleSettings.php for details and examples.
Backtrace:
#0 [internal function]: Wikibase\RepoHooks::onSetupAfterCache()
#1 /mnt/jenkins-workspace/workspace/mwext-WikidataQuality-repo-tests-mysql-zend/src/includes/Hooks.php(209): call_user_func_array(string, array)
#2 /mnt/jenkins-workspace/workspace/mwext-WikidataQuality-repo-tests-mysql-zend/src/includes/Setup.php(604): Hooks::run(string)
#3 /mnt/jenkins-workspace/workspace/mwext-WikidataQuality-repo-tests-mysql-zend/src/maintenance/doMaintenance.php(97): require_once(string)
#4 /mnt/jenkins-workspace/workspace/mwext-WikidataQuality-repo-tests-mysql-zend/src/maintenance/install.php(158): require_once(string)
#5 {main}

JanZerebecki updated the task description. (Show Details)
JanZerebecki raised the priority of this task from to Needs Triage.
JanZerebecki added a subscriber: JanZerebecki.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 29 2015, 6:07 PM
JanZerebecki updated the task description. (Show Details)May 29 2015, 6:08 PM
JanZerebecki set Security to None.
JanZerebecki added subscribers: hoo, aude, JeroenDeDauw.

Quick hack I used to get around this: sed --in-place -e 's/||/\&\&/; s/!//' extensions/Wikibase/Wikibase.composer.php

hoo added a comment.May 29 2015, 10:05 PM

We also "work around" these globals in the travis setup and in the actual Wikidata build AFAIR. I think we should either remove them or make Wikibase run out of the box (if we can have sane enough defaults for that).

Lydia_Pintscher triaged this task as Normal priority.May 30 2015, 11:26 AM
Tobi_WMDE_SW edited a custom field.Jun 1 2015, 2:49 PM

And of course we ought to get to having one extension per repo like all other extensions at some point...

This bug could be solved by removing loading of the entry point from the autoloader. That however doesn't answer if the extension should be enabled automatically when the entry point is loaded (or with the new extension loading, after it was called on wikibase). This overlaps somewhat with T88258.

One way would be converting the sub-extensions in the Wikibase repo to extension.json (T88258) but having an extension point similar to Wikibase.composer.php but named Wikibase.php and instead of loading the entry point sub-extensions are loaded by calling wfLoadExtensions( array( ... ) );. All this needs to be made to work with the build and how configuration and extension loading is done in production.

Maybe we can also remove any knowledge/recognition of wgEnableWikibaseRepo/Client.

Probably need to use wfLoadExtension instead of wfLoadExtensions because the former takes a path. The later wouldn't find the sub-extensions.

Change 217947 had a related patch set uploaded (by JanZerebecki):
Remove extension initialization from autoloader.

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

JanZerebecki moved this task from Backlog to Doing on the Wikidata-Sprint-2015-06-02 board.

Change 217947 merged by jenkins-bot:
Remove extension initialization from autoloader.

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

Lydia_Pintscher closed this task as Resolved.

Change 220933 had a related patch set uploaded (by Hoo man):
Remove extension initialization from autoloader.

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

Change 220933 merged by jenkins-bot:
Remove extension initialization from autoloader.

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

Ricordisamoa edited subscribers, added: Ricordisamoa; removed: gerritbot.