Have you seen...? Obviously not I'm only telling you now. This has been implemented in XF 2.2.7!
Installable add-ons (add-ons that are not installed / have been uninstalled) may now contain a "Delete files" button (with some exceptions).
Clicking "Delete files" enumerates the add-on's
hashes.json
file to work out which files belong to that add-on. It checks if they are deletable and lists the files that would be deleted if you proceed:
Clicking "Delete files" triggers a job which deletes those files and the add-on's directory.
No other directories are removed (this is by design to reduce the risk of other add-ons being affected) so this
will leave empty directories on your server but once complete the add-on will no longer appear in the "Installable add-ons" list.
In some cases, you may come across an add-on that shares files with another add-on. This is less common (many add-ons by
@Xon used to do this but not so much now) but theoretically could be used for nefarious means - for example a specially crafted
hashes.json
file might make it seem like another add-ons files belong to that add-on or even a core XF file.
So we flag it if an add-on you're deleting contains files that may be in use by another add-on:
Rather than blocking the deletion entirely, we simply ensure those files are skipped.
There are some situations where the "Delete files" button will not be available in the add-on list, particularly if the
src/addons
directory is not writable (this means the files within would not be deletable) or if the add-on contains files in an
_output
directory (used during development).