-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve obsolete extension management #15352
Conversation
(Standard links)
|
@colemanw Just a small concern - uninstalling an extension is supposed to remove all data associated/created by that extension. Clearly in the case of api4 that won't be a problem and we are probably "vetting" each extension that is marked obsolete. But we should be aware of this risk |
How would this work with dependencies? Contact layout editor depends on APIv4 and stores data. |
Right. I had a similar thought recently when skimming the deactivation code. To be concrete - a hypothetical case raising that issue would be importing
Of course, we may never have to deal with this - it's just a hypothetical. The five actual cases to date have all been essentially-stateless extensions. And if/when we deal with it, other factors could have changed. In the spirit of "we should be aware"... we could add some sign-posting around |
@MegaphoneJon IIRC, the extension system would basically ignore the requirement declared in Tangentially, if we had more composer-ified builds doing ext downloads... then I'm pretty sure the correct thing would be for |
Those are valid concerns, although as Tim pointed out none of the 5 extensions currently listed as obsolete have any db tables so it hasn't been an issue yet. And yes dependencies are automatically ignored for obsolete extensions. The But for now how about if I add 2 flags for each extension to make it clear what the system will do (and how to turn off that behavior if a future extension needs to), so it looks like this:
|
@colemanw Agree with keep it simple until we need to :-) My comments are non-blocking and it seems we're all aware. I like the idea of adding the uninstall flag to the json as that makes it pretty clear to anyone planning on changing that file that something will/will not happen. |
a73468e
to
911c791
Compare
@totten we discussed a 3rd flag called something like "ignore". I've vote for a less ambiguous name (ignore what... the rest of the flags?). Perhaps "suppress" or "do_not_load" |
There is a compatibility problem when upgrading a system which has an old copy of api4: the top level `api4.php` indiscriminately declares the function `civicrm_api4()`, which eventually provokes a conflict with the copy that is now in `civicrm-core`. Using the normal disable/uninstall actions doesn't resolve this because the error arises too early during boot (before the upgrader gets a chance to remove the extension). The 'force-uninstall' option will make the system behave as if the extension is uninstalled, regardless of what files exist and what state may be stored in the `civicrm_extension` table. This commit technically does ~3 things: 1. Changes the policy for `org.civicrm.api4` to use `force-uninstall` 2. Makes the extension-cache version-dependent. During an upgrade, you might have a stale cache that claims that the old extension is active. This ensures that (as soon as you drop in new code) it begins working with a fresh cache. 3. Update any spots which query the table `civicrm_extensions` for extension status. Have it consult `extension-compatibility.json` for `force-uninstall`ed items.
@colemanw I've rebased (so that testing would be as realistic as possible) and added an extra commit to create the For
With the prior revision, these processes reproduced conflicts on |
@totten I started writing at length about how this works well with with stateless extensions like api4, but our original plan of LGTM 👍 |
I ran this through an upgrade test and am mostly happy with the results: Before: Fatal error when upgrading core + api 4.5.0 installed. Cannot upgrade. After: No fatal error, upgrade proceeds normally. However, the api4 extension remains in the |
This looks like it is ready to merge the testing Coleman and Tim have done lends me to think this is safe any concerns @mattwire @MegaphoneJon ? |
…ions Note: 1. This is more advisory than functional - the functionality is really in the runtime bits in the previous commits. 2. Technically, this is more of a disable, but we should keep the record around in `civicrm_extension` so that we know the old schema revision.
Updated to address the aesthetic issue about leaving an active row in |
@mattwire No concerns from me |
Overview
Before
Less thorough / verbose
After
Note that obsolete extensions are labeled on extension page and there is no button to install them. If you were to try installing it via
cv
you'd get an error.