Page MenuHomePhabricator

Make the web installer work without running any extension PHP code
Open, Needs TriagePublic


The web installer needs to load extension PHP code for two purposes:

  • the LoadExtensionSchemaUpdates hook which controls what extension schema updates need to be run
  • non-extension.json extensions that use the legacy PHP entry point

This system is pretty fragile, as we just autoload the PHP classes (AutoloadClasses & AutoloadNamespaces) and then trigger the hook, hoping that it doesn't call out anywhere else. This usually violates developers' expectations that whatever PHP code they put in the hook will run (e.g. having services available, etc.).

More importantly, there's no real good reason for this. For 90% of extensions, the content in LoadExtensionSchemaUpdates is static, it could be moved into extension.json. And then we could get all the information we needed to do schema updates from the JSON file instead of needing to run any PHP code.

Event Timeline

Probably a good time to disentangle installation from upgrade a bit? Installation only requires a predefined SQL schema 99% of the time; it would be easy to require extensions which want to be part of a tarball bundle, so they can be enabled at install time, to provide a static schema. The very few extensions that can't would still be possible to enable via the updater.

In terms of database schema, there isn't actually any concept of "installation", it's always treated as updates. I do think as part of T258852: Replace LoadExtensionSchemaUpdates hook with static data in extension.json we could implement that split - we have one declared schema definition, on install we run that, and then on updates we iterate through all the updates.

I posted a more detailed proposal on that task which would allow us to move in that direction.

Also just to clarify, when I refer to the web installer in the title, I mean both the web installer and updater.