Page MenuHomePhabricator

MediaWiki installer doesn't create tables for extensions registering updates with new Hook handler
Closed, ResolvedPublic

Description

MediaWiki installer (maintenance/install.php) doesn't create AbuseFilter tables. All other extensions seem to work.

This seems to be a new problem, we noticed it when newly created wikis on https://patchdemo.wmflabs.org/ started showing database exceptions.

Running the MediaWiki updater afterwards (maintenance/update.php) creates the tables and fixes the issue.

Downstream report: https://github.com/MatmaRex/patchdemo/issues/166

Event Timeline

So the installer has some hacky code to load the schema update hooks defined by extensions without loading the rest of their code: https://github.com/wikimedia/mediawiki/blob/master/includes/installer/Installer.php#L1558

I suspect that needs handling for HookHandlers.

Yes, it has definitely worked correctly before.

I think there's a problem in core: https://gerrit.wikimedia.org/g/mediawiki/core/+/722b5a07d634dbc08de5fdc6439775db52b89aff/includes/installer/Installer.php#1559

This code seems a huge hack, and probably doesn't work with the new hook system. Haven't tested this theory.

Daimona triaged this task as High priority.Oct 28 2020, 4:37 PM

So the installer has some hacky code to load the schema update hooks defined by extensions without loading the rest of their code: https://github.com/wikimedia/mediawiki/blob/master/includes/installer/Installer.php#L1558

I suspect that needs handling for HookHandlers.

Ahah, indeed. Unsure about high vs UBN, given that core is seriously broken here...

This also affects the WikiLambda extension, which also uses HookHandlers, so that seems a likely thing that's broken, yes.

Ammarpad renamed this task from MediaWiki installer doesn't create AbuseFilter tables to MediaWiki installer doesn't create tables for extensions registering updates with new Hook handler.Oct 28 2020, 11:00 PM

In the original report at https://github.com/MatmaRex/patchdemo/issues/166 it is said FlaggedRevs is also affected, but FlaggedRevs is not using Hook handler system (extension.json) and so its callback should be working fine in theory because it would be loaded same ways as other extensions (that're not using Hook handler and not affected here)

Change 637076 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Installer: Support Hook handler-defined schema update hooks

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

Esanders raised the priority of this task from High to Unbreak Now!.Oct 29 2020, 3:50 PM
Esanders subscribed.

Given this affects multiple teams.

Change 638355 had a related patch set uploaded (by Tim Starling; owner: Tim Starling):
[mediawiki/core@master] Support new style hook registration on install and update

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

Change 637076 abandoned by Ammarpad:
[mediawiki/core@master] Installer: Support Hook handler-defined schema update hooks

Reason:
superseded by I2c41ece04aed11a176559d4364cea2f3320b9574

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

Change 638355 merged by jenkins-bot:
[mediawiki/core@master] Support new style hook registration on install and update

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

I guess this wants backporting too as this functionality won't work there, but the new hooks system is in 1.35..

And as inevitably other backports will potentially happen, plus things like the BlueSpice stuff which is actively worked on in release branches...

Change 639498 had a related patch set uploaded (by Jforrester; owner: Tim Starling):
[mediawiki/core@REL1_35] Support new style hook registration on install and update

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

Change 639498 merged by jenkins-bot:
[mediawiki/core@REL1_35] Support new style hook registration on install and update

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

matmarex assigned this task to tstarling.

This is fixed by those patches, right? It seems to be fixed for me. Thank you for working on it!