Page MenuHomePhabricator

Wikibase breaks schema update with "Class 'Onoi\MessageReporter\NullMessageReporter' not found"
Closed, ResolvedPublic

Description

[b044c19a718cc572f5c35d43] [no req]   Error: Class 'Onoi\MessageReporter\NullMessageReporter' not found
Backtrace:
from /vagrant/mediawiki/extensions/Wikibase/client/includes/Store/Sql/UnexpectedUnconnectedPagePrimer.php(61)
#0 /vagrant/mediawiki/extensions/Wikibase/client/includes/Hooks/LoadExtensionSchemaUpdatesHookHandler.php(45): Wikibase\Client\Store\Sql\UnexpectedUnconnectedPagePrimer->__construct()
#1 /vagrant/mediawiki/includes/installer/DatabaseUpdater.php(604): Wikibase\Client\Hooks\LoadExtensionSchemaUpdatesHookHandler::primeUnexpectedUnconnectedPage()
#2 /vagrant/mediawiki/includes/installer/DatabaseUpdater.php(563): MediaWiki\Installer\DatabaseUpdater->runUpdates()
#3 /vagrant/mediawiki/maintenance/update.php(189): MediaWiki\Installer\DatabaseUpdater->doUpdates()
#4 /vagrant/mediawiki/maintenance/includes/MaintenanceRunner.php(696): UpdateMediaWiki->execute()
#5 /vagrant/mediawiki/maintenance/run.php(51): MediaWiki\Maintenance\MaintenanceRunner->run()
#6 /var/www/w/MWScript.php(99): require_once(string)
#7 {main}

Seen in Vagrant after installing the mediainfo role. The file exists on disk so not quite sure what's going on. Adding

require_once( "/vagrant/mediawiki/extensions/Wikibase/vendor/onoi/message-reporter/src/MessageReporter.php" );
require_once( "/vagrant/mediawiki/extensions/Wikibase/vendor/onoi/message-reporter/src/NullMessageReporter.php" );
require_once( "/vagrant/mediawiki/extensions/Wikibase/vendor/onoi/message-reporter/src/CallbackMessageReporter.php" );

to the beginning of UnexpectedUnconnectedPagePrimer.php fixed the error, so clearly some kind of autoloading problem.

Details

Event Timeline

I can't reproduce it anymore (I guess I would have to undo the migration first) but I guess it's the thing where you have to tell extension.json you have composer dependencies, otherwise it might or might not break depending on how you use composer.

Change #1027561 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/Wikibase@master] Load composer autoloader

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

Yeah, “Onoi” issues in Wikibase generally mean something’s wrong with the autoloader.

If I understand the load_composer_autoloader flag correctly, it’s probably only needed if you’re not using the composer merge plugin? I think we generally recommend that instead, but specifying the flag as well seems reasonable. Thanks for the Gerrit change!

Change #1027561 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Load composer autoloader

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

Lucas_Werkmeister_WMDE assigned this task to Tgr.

Since the issue isn’t reproducible anymore, let’s just hope it’s fixed now and close the task.

If I understand the load_composer_autoloader flag correctly, it’s probably only needed if you’re not using the composer merge plugin?

Yeah, it loads the autoloader.php file in the extension's vendor folder if it exists.

I think we generally recommend [the composer merge plugin] instead

Though our README was a bit outdated in that regard – uploaded https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/1032720 to improve it.