Jump to content

Module Uninstall()


Blesta Addons

Recommended Posts

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 ?

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

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
        }
    }
...
}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...