Is there a hook that I can implement in my module so that I can run some clean up code when my module is uninstalled. I create a number of variables using variable_set()
and I would like to delete these variables when the module is uninstalled.
views:
26answers:
1
+5
A:
Yes there is.
Where you would write an install hook like this :
/**
* Implements hook_install().
*/
function annotate_install(){
// Use schema API to create database table
drupal_install_schema('annotate');
}
The uninstall would look like this :
/**
* Implements hook_uninstall().
*/
function annotate_uninstall(){
// Use scheme API to delete database table
drupal_uninstall_schema('annotate');
// Delete our module's variable from variables table
variable_del('annotate_node_types');
}
rlb.usa
2010-08-25 21:14:20
Thanks. I guess I wasn't looking in the right place for this hook.
MisterBigs
2010-08-25 21:18:05