Check requirements before upgrading extensions via the UI #15450
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
If an extension introduces a requirement on another extension but is ALREADY installed it will download and (attempt) to install the extension without checking those dependencies. This can result in CiviCRM crashing if there is a hard dependence.
This happens quite often for example when upgrading Stripe from 5.4.1 to 6.x which introduces the mjwshared extension as a requirement.
Before
CiviCRM can stop working if an extension is "upgraded" via the UI and it's (new) requirements are not met.
After
CiviCRM allows you to click "upgrade" but then bounces back with an error message if any dependencies are not already installed.
Technical Details
We modify a couple of checkrequirements functions to allow us to pass through the info retrieved via the http feed (ie. the new extension we want to install) instead of using the local (old) versions.
Comments
It is always nice to extend these things further but any attempt to automatically download / install would require far more work - contributions welcome but let's get this fix in first.
@totten @MikeyMJCO @aydun