Page MenuHomePhabricator

Wikibase cannot find a class on REL1_32
Closed, ResolvedPublic

Description

Hi, since this change https://github.com/wikimedia/mediawiki-vendor/commit/90fef8279a44622b14cf9d84de7f051a4c50b9bd, wikibase has been failing with " Error from line 35 of /srv/mediawiki/w/extensions/Wikibase/lib/WikibaseLib.entitytypes.php: Class 'Wikibase\DataModel\Entity\ItemId' not found" (i've ran composer and that did not fix it)

Event Timeline

This is desired behaviour. Release branches of mediawiki-vendor shouldn't have random stuff that's needed for WMF prod. It should only have MW core and bundled extension dependancies

If running composer didn't fix it, chances are it's because you don't have the composer-merge-plugin setup correctly to comb the extensions for the libraries they need too

Nope, this works in REL1_31 so this has to be a problem in 1.32.

Change 472787 had a related patch set uploaded (by Zoranzoki21; owner: Zoranzoki21):
[mediawiki/vendor@REL1_32] Revert "Remove non-tarball dependencies from release branch"

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

Change 472787 abandoned by Zoranzoki21:
Revert "Remove non-tarball dependencies from release branch"

Reason:
Per Reedy`s comment in task

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

wikibase/data-model/src/Entity/Item.php
wikibase/data-model/src/Entity/ItemId.php
wikibase/data-model/src/Entity/ItemIdParser.php
wikibase/data-model/src/Entity/ItemIdSet.php

These files should be rollbacked,

So i found a hack, if you add require_once DIR ../vendor/autoload.php it works in WikibaseRepo.php.

So i guess that's what is needed?

Aha, they removed this

// This is the path to the autoloader generated by composer in case of a composer install.
if ( is_readable( __DIR__ . '/../vendor/autoload.php' ) ) {
        require_once __DIR__ . '/../vendor/autoload.php';
}

from WikibaseLib.php (it's in mw 1.31 but not 1.32)

Aha, they removed this

// This is the path to the autoloader generated by composer in case of a composer install.
if ( is_readable( __DIR__ . '/../vendor/autoload.php' ) ) {
        require_once __DIR__ . '/../vendor/autoload.php';
}

from WikibaseLib.php (it's in mw 1.31 but not 1.32)

They don’t have an extension.json then?

Nope, it seems they changed it to using the merge plugin (as you said earlier). But i would expect a extension to try to load it locally before using the mw core one.

Nope, it seems they changed it to using the merge plugin (as you said earlier). But i would expect a extension to try to load it locally before using the mw core one.

That’s why composer.json has the thing to mark that an extension has dependencies so you can have them locally in the extension or in the one for core

Wikibase et are complex

Aha, they removed this

// This is the path to the autoloader generated by composer in case of a composer install.
if ( is_readable( __DIR__ . '/../vendor/autoload.php' ) ) {
        require_once __DIR__ . '/../vendor/autoload.php';
}

from WikibaseLib.php (it's in mw 1.31 but not 1.32)

Do you know in which commit? And hence, why?

Yes, here https://github.com/wikimedia/mediawiki-extensions-Wikibase/commit/505e4860cc720e1a5098fd3272268448d3342074#diff-0bca4e0eecbdd09ab1c39db21d521610

(But dosent really explain why it had to be removed compared to checking if vendor/autoload.php exists in the extension root and then fallback to mw core vendor)

That would break running composer install/update in the extension dir and expecting it to work...

Wouldn't change running it in MW core root

That would break running composer install/update in the extension dir and expecting it to work...

Wouldn't change running it in MW core root

Indeed, Wikibase composer dependencies are meant to be installed by doing composer update / install in the root mediawiki dir and using the composer merge plugin.
This is documented in the extension readme https://github.com/wikimedia/mediawiki-extensions-Wikibase/blob/master/README.md#install

I wouldn't expect the wikibase deps to be in the tarballed mediawiki-vendor repo.

Nope, this works in REL1_31 so this has to be a problem in 1.32.

or something was done wrong in the REL1_31 branch / release?

That would break running composer install/update in the extension dir and expecting it to work...

Wouldn't change running it in MW core root

This is a problem on Vagrant, but that has its own task already: T201615: Wikibase on Vagrant: Class 'Wikibase\DataModel\Entity\ItemId' not found. Shouldn't be a problem in a manual Wikibase install in theory.

Note that CI should no more use mediawiki/vendor.git for release branch since today (was T225354 ).

There are phan jobs for MobileFrontend that fails with the same error apparently. T230451

REL1_32 is EOL. Is this a problem in any other branch, or can we Invalid it again?

Addshore claimed this task.

This isn't really an issue with wikibase.
Just things using Wikibase
I think we can close