Writing an upgrade script for an addon

SheepCow

Well-known member
Is there a tutorial / sample anywhere on how to write an upgrade script for an addon?

Basically I need to remove event listeners not used any more, simply updating with the XML file adds the new ones but doesn't seem to remove existing?

Also will need to delete old addon files ...

In the addon you can define install/uninstall, does the existing uninstall get called before the new install function?
 
Your updated XML should not include old event listeners if you removed them prior to generating it. Could be it's callback method hasn't been updated to exclude the old classes?

Deleting files, imo, isn't the job of the install/uninstaller. However, you can Google around for the appropriate functions.

Install gets called on install and upgrade, uninstall only gets called on uninstall.
 
Your updated XML should not include old event listeners if you removed them prior to generating it. Could be it's callback method hasn't been updated to exclude the old classes?

Yeah it looks like I had managed to export the XML before I'd actually finished!

For anyone interested, the install() function gets called with 2 parameters during an upgrade. The first parameter is the existing addon information (an array from the model, or boolean false if not already installed) and the second is the addon information of the one being installed.
 
Top Bottom