plonegenericsetup

Does Reinstalling a product run all the upgrade steps in Generic Setup?


It seems some steps are not being run. Am I missing the place where I should specify these?


Solution

  • No A reinstall of a package runs the uninstall profile an then the default profile.

    [START UPDATE]

    As @hvelarde commented: It does not automatically run a uninstall profile. It could do nothing or do the uninstallation in a different way.

    But usually if there is a profile the profile is named uninstall and gets called in the install.py's uninstall method.

    Example:

    from plone.addon.config import PROJECTNAME
    from Products.CMFCore.utils import getToolByName
    
    
    def uninstall(self):
        setup_tool = getToolByName(self, 'portal_setup')
        setup_tool.runAllImportStepsFromProfile(
            'profile-{0}:uninstall'.format(PROJECTNAME),
            ignore_dependencies=True)
    

    More Infos about a clean uninstall can be found on @keul's Blog post

    Keep in mind: A plone addon does not have a uninstall functionality for sure.

    [END UPDATE]

    If you apply the latest the default profile, the version is set to specified version in the metadata.xml - Plone can no longer determine if the package needs a upgrade or not, respectively it assumes your package is up to date, since the packe version on the filesystem is equal to the one stored in the DB.

    Install upgrade step

    As long as package upgrade code follows some guidelines, the upgrade appears in the Plone Control Panel -> AddOns (http://localhost:8080/Plone/prefs_install_products_form)

    You can now hit the upgrade button on the package, which has upgrades

    enter image description here

    Upgrade helpers

    There are several packages, which helps you track new updates and install them.