...
If your plugin required code to install, it likely requires code to uninstall. Place that logic in your plugin's uninstall() method.
There are two parameters passed to the uninstall() method. The first ($plugin_id) is the ID of the plugin being uninstalled. Because a plugin can be installed independently under different companies you may need to perform uninstall logic for a single plugin instance. The second parameter ($last_instance) identifies whether or not this is the last instance of this type of plugin in the system. If true, be sure to remove all any remnants of the plugin.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<?php class MyPluginPlugin { ... public function uninstall($plugin_id, $last_instance) { # # TODO: Place uninstallation logic here # } } ?> |
...
Upgrade Logic
When the version of your code differs from that recorded within Blesta a user may initiate an upgrade, which will invoke your plugin's upgrade() method.
The $current_version is the version currently installed. That is, the version that will be upgraded from.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<?php class MyPluginPlugin { ... public function upgrade($current_version) { # # TODO: Place upgrade logic here # } } ?> |
...