Page MenuHomePhabricator

[RFC] wikibase (composer) libraries register resource loader modules during autoloader startup
Closed, InvalidPublic

Description

Wikibase (composer) libraries register resource loader modules during autoloader startup. This requires Mediawiki knowledge usually only extensions have. What should we do about that?

This even happens when the extension that requires these components is not loaded.

mediawiki/extensions/Wikidata (master=)$ ack MEDIAWIKI --nogroup
Wikidata.localisation.php:3:if ( !defined( 'MEDIAWIKI' ) ) {
Wikidata.php:2:if ( !defined( 'MEDIAWIKI' ) ) {
vendor/diff/diff/Diff.php:10:if ( defined( 'MEDIAWIKI' ) ) {
vendor/data-values/geo/Geo.php:20:if ( defined( 'MEDIAWIKI' ) ) {
vendor/data-values/validators/Validators.php:20:if ( defined( 'MEDIAWIKI' ) ) {
vendor/data-values/number/Number.php:20:if ( defined( 'MEDIAWIKI' ) ) {
vendor/data-values/time/Time.php:20:if ( defined( 'MEDIAWIKI' ) ) {
vendor/data-values/data-types/DataTypes.php:22:if ( defined( 'MEDIAWIKI' ) ) {
vendor/data-values/data-types/DataTypes.mw.php:12:if ( !defined( 'MEDIAWIKI' ) ) {
vendor/data-values/data-values/DataValues.php:22:if ( defined( 'MEDIAWIKI' ) ) {
vendor/data-values/common/Common.php:25:if ( defined( 'MEDIAWIKI' ) ) {
vendor/data-values/interfaces/Interfaces.php:25:if ( defined( 'MEDIAWIKI' ) ) {
vendor/wikibase/data-model/WikibaseDataModel.php:17:if ( defined( 'MEDIAWIKI' ) ) {
vendor/wikibase/internal-serialization/mediawiki.php:3:if ( defined( 'MEDIAWIKI' ) ) {
vendor/wikibase/data-model-javascript/init.php:5:if ( defined( 'MEDIAWIKI' ) ) {
vendor/wikibase/data-model-javascript/init.mw.php:3:if ( !defined( 'MEDIAWIKI' ) ) {
vendor/wikibase/javascript-api/WikibaseJavaScriptApi.php:15:if ( defined( 'MEDIAWIKI' ) ) {
vendor/wikibase/javascript-api/init.mw.php:3:if ( !defined( 'MEDIAWIKI' ) ) {
vendor/wikibase/data-model-serialization/mediawiki.php:3:if ( defined( 'MEDIAWIKI' ) ) {
vendor/wikibase/serialization-javascript/init.php:5:if ( defined( 'MEDIAWIKI' ) ) {
vendor/wikibase/serialization-javascript/init.mw.php:3:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/PropertySuggester/tests/evilMediaWikiBootstrap.php:5:define( 'MEDIAWIKI', true );
extensions/Wikidata.org/WikidataOrg.php:32:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/WikimediaBadges/WikimediaBadges.php:16:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/ValueView/ValueView.mw.php:10:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/ValueView/ValueView.php:20:if ( defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/client/WikibaseClient.php:39:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/lib/WikibaseLib.php:33:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/lib/includes/modules/SitesModuleWorker.php:169:             return $site->getType() === Site::TYPE_MEDIAWIKI && in_array( $site->getGroup(), $groups );
extensions/Wikibase/view/init.mw.php:3:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/view/WikibaseView.php:15:if ( defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/purtle/init.mw.php:3:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/purtle/Purtle.php:15:if ( defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/repo/tests/phpunit/includes/content/EntityHandlerTest.php:161:              $this->assertFalse( $handler->canBeUsedOn( Title::makeTitle( NS_MEDIAWIKI, "Foo" ) ),
extensions/Wikibase/repo/config/Wikibase.searchindex.php:24:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/repo/Wikibase.php:35:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/lib/includes/modules/SitesModuleWorker.php:169:             return $site->getType() === Site::TYPE_MEDIAWIKI && in_array( $site->getGroup(), $groups );
extensions/Wikibase/view/init.mw.php:3:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/view/WikibaseView.php:15:if ( defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/purtle/init.mw.php:3:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/purtle/Purtle.php:15:if ( defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/repo/tests/phpunit/includes/content/EntityHandlerTest.php:161:              $this->assertFalse( $handler->canBeUsedOn( Title::makeTitle( NS_MEDIAWIKI, "Foo" ) ),
extensions/Wikibase/repo/config/Wikibase.searchindex.php:24:if ( !defined( 'MEDIAWIKI' ) ) {
extensions/Wikibase/repo/Wikibase.php:35:if ( !defined( 'MEDIAWIKI' ) ) {

Related Objects

StatusAssignedTask
InvalidNone
ResolvedAddshore
ResolvedAddshore
DeclinedNone
Resolvedaude
ResolvedJeroenDeDauw
ResolvedWMDE-leszek
InvalidNone
InvalidNone
OpenNone
ResolvedVictorbarbu
ResolvedLucas_Werkmeister_WMDE
ResolvedMtDu
ResolvedLydia_Pintscher
DeclinedLydia_Pintscher
InvalidNone
InvalidNone
ResolvedReedy
ResolvedLegoktm
ResolvedLadsgroup
ResolvedNone
ResolvedJanZerebecki
OpenNone
ResolvedJanZerebecki
ResolvedKrinkle
InvalidNone
ResolvedJanZerebecki
ResolvedAddshore

Event Timeline

JanZerebecki raised the priority of this task from to Needs Triage.
JanZerebecki updated the task description. (Show Details)
JanZerebecki added a project: Wikidata.
JanZerebecki added a subscriber: JanZerebecki.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 15 2015, 9:46 AM
JanZerebecki updated the task description. (Show Details)Aug 16 2015, 9:37 AM
JanZerebecki set Security to None.
JanZerebecki added a subscriber: JeroenDeDauw.
JanZerebecki updated the task description. (Show Details)Aug 16 2015, 9:50 AM
JanZerebecki updated the task description. (Show Details)
Lydia_Pintscher renamed this task from wikibase (composer) libraries register resource loader modules during autoloader startup to [RFC] wikibase (composer) libraries register resource loader modules during autoloader startup.Aug 17 2015, 3:22 PM
daniel added a subscriber: daniel.Sep 10 2015, 3:26 PM

In my opinion, extensions should no *nothing* during autoload. Installing a component via composer should not activate an extension; this means that extensions should not register anything with mediawiki via the autoloader interface. This should only happen if and when the extension's entry point is loaded.

daniel triaged this task as Normal priority.EditedSep 10 2015, 3:29 PM

Setting prio to normal: this doesn't break anything for our setup. But it's a potential issue for third parties, and it's generally bad practice, compare the discussion at https://github.com/composer/composer/issues/4109

This should be relatively easy to fix.

Regarding that we won't remove the ResouceLoader dependency soon: That might work in practice ok even as a component. The downside of that is that we need some custom CI glue to run the QUnit tests. That might possibly look like: add a composer depencency on data-values/value-view into an installation of Mediawiki, run composer, run qunit tests as is normally done with Mediawiki.

What exactly is the problem we are trying to solve here?

Addshore closed this task as Invalid.Nov 15 2017, 9:09 PM
Addshore added a subscriber: Addshore.

None of the wikibase composer libs do this anymore

Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptNov 15 2017, 9:09 PM