2 Aug 02, 2017 19:17
@achillis I know this is a very old post, and I'm sure you already figured it out, but I found it and wouldn't like to leave it unanswered.
PluginVersionChanged event is triggered when b2evolution finds a change between the version of the plugin currently registered in the database and the version in the code of the plugin. No idea when this event was introduced, and it's true, at the core, it's currently used by the Basic Antispam plugin only. Maybe it was implemented responding to a particular request of a third-party developer.
However, this event may be useful, considering the complexity of the plugin, because developers can control their own upgrade actions based upon those version changes. Use cases: some rows of a table at the database need to be created/modified/deleted, maybe it's the structure of a table what we need to change, or create a new one, create/modify/delete folders & files, you name it.
Using this mechanism, combined with some code logic, devs are able to control what actions are executed at the right moment. This way it's possible to emulate the logic behind the b2evolution upgrades, implemented in form of upgrade blocks at:
Main idea (as I see): assuming that there must be reasons that led developers to change their plugins' version, it's possible that they also need to manage their data / files on sites where those plugins were already installed, so they're being upgraded.