Search »

Uninstallation Function

Uninstallation function

Important! When the administrator uninstalls a module, by default the core script will automatically attempt to delete the module folder. While you're developing your own module, this probably won't be what you want! To override the setting, add a $g_delete_module_folder_on_uninstallation = false; setting to your /global/config.php file.

The uninstallation functions work in a similar manner to the installation function. It's called when the administrator clicks the "UNINSTALL" link. The function must be called my_module__uninstall (where my_module is your module folder name).

This function should contain all the custom code you need to execute to remove the module from the database. Again, if your module made no database changes, then you won't need to include this file in your module.

The uninstall function is structured just like the install function:

The module ID is passed to the function in case you need that information. Otherwise you can just ignore it.

The return array is necessary. You MUST return an arrbeenay with two indexes: [0] true/false, and [1] a message. If you want the core script to display the default "The module has been uninstalled" message, just pass an empty string for the second index.