function merci_inventory_uninstall in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6.2
Same name and namespace in other branches
- 6 modules/merci_inventory/merci_inventory.install \merci_inventory_uninstall()
- 7.3 merci_inventory/merci_inventory.install \merci_inventory_uninstall()
- 7.2 modules/merci_inventory/merci_inventory.install \merci_inventory_uninstall()
Implementation of hook_uninstall().
File
- modules/
merci_inventory/ merci_inventory.install, line 30 - merci inventory install / uninstall
Code
function merci_inventory_uninstall() {
// delete any merci_inventory_master nodes... even though there really shouldn't be any
$result = db_query(db_rewrite_sql("SELECT nid FROM {node} n WHERE type IN ('merci_inventory_master', 'merci_inventory')"));
while ($node = db_fetch_object($result)) {
node_delete($node->nid);
}
// Need to load the CCK include file where content_field_instance_create() is defined.
module_load_include('inc', 'content', 'includes/content.crud');
$results = db_query("SELECT field_name,type_name FROM {" . content_instance_tablename() . "} WHERE type_name IN ('merci_inventory_master', 'merci_inventory')");
while ($field = db_fetch_array($results)) {
content_field_instance_delete($field['field_name'], $field['type_name'], FALSE);
}
// Force the caches and static arrays to update to the new info.
content_clear_type_cache(TRUE);
// delete CCK content_types
$return = node_type_delete('merci_inventory_master');
// You'd think the uninstall submit function would take care of this
// but it doesn't look like it.
node_types_rebuild();
menu_rebuild();
drupal_set_message(t('MERCI Inventory module successfully uninstalled. merci_inventory_master content type and nodes deleted.'));
}