ploneupgradegenericsetup

Upgrade step to remove profile


We have one package that we identify that we don't need its profile (collective.js.cycle2) so I need to write an upgrade step to remove the existent profile.

Looking at the code I usually have to update profile, I found that in the end it calls: portal_setup.runAllImportStepsFromProfile(profile, purge_old=False)

Is it a good practice to run portal_setup.runAllImportStepsFromProfile(profile, purge_old=True) to remove the profile? ( I didn't find anything at plone.app.upgrade.utils.py to make it).


Solution

  • You need to add to the product an uninstall profile (and commonly is a good idea to add it to the original product, through a pull request). An uninstall profile must remove all the persistent changes done by the install ones, so look at it: https://github.com/collective/collective.js.cycle2/tree/master/src/collective/js/cycle2/profiles/default

    The only "dangerous" thing you must really care about is the browserlayer.xml. The registered CSS is not dangerous, but removing all is a good idea.

    See also How to make your Plone add-on products uninstall cleanly

    After that: commonly an uninstall profile is run when you uninstall the product, but you can keep it "installed" and manually run the uninstall profile from the portal_setup ZMI tool. The weird side effect doing this: you uninstalled but the add-on is still in the "installed add-on" list.