Blesta Addons Posted July 25, 2015 Report Posted July 25, 2015 when a plugin is uninstalled , the fucntion uninstall() is called . this function require 2 params , how we can determinate this two params in the module file ? /** * Performs any necessary cleanup actions * * @param int $plugin_id The ID of the plugin being uninstalled * @param boolean $last_instance True if $plugin_id is the last instance across all companies for this plugin, false otherwise */ public function uninstall($module_id, $last_instance) { // Delete All Packages Files !!! } how to get the module_id in the called function ? Quote
Adam Posted July 25, 2015 Report Posted July 25, 2015 how to get the module_id in the called function ? The caller of the function (blesta core) passes you that argument. It is more of a convince then anything. It is a variable that you can access within the function. -Adam Quote
Blesta Addons Posted July 25, 2015 Author Report Posted July 25, 2015 The caller of the function (blesta core) passes you that argument. It is more of a convince then anything. It is a variable that you can access within the function. -Adam but the $module_id, $last_instance is not defined in my module !! lo i can use public function uninstall($may_var_1, $may_var_1) in all the case is not working . i want to perform a action in the uninstall module . Quote
Tyson Posted July 25, 2015 Report Posted July 25, 2015 I'm not sure I understand the question. Your module should be able to define an uninstall method that overrides Module::uninstall($module_id, $last_instance): class MyModule extends Module { ... public function uninstall($module_id, $last_instance) { if ($last_instance) { // do something } } ... } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.