function merci_uninstall in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6
Same name and namespace in other branches
- 6.2 merci.install \merci_uninstall()
- 7.2 merci.install \merci_uninstall()
Implementation of hook_uninstall().
File
- ./
merci.install, line 33 - merci Installer / Uninstaller
Code
function merci_uninstall() {
// Remove all MERCI variables.
$variables = db_query("SELECT name FROM {variable} WHERE name LIKE 'merci_%'");
while ($variable = db_fetch_object($variables)) {
variable_del($variable->name);
}
// Remove all MERCI all associated nodes
//No longer removes content types
$content_types = db_query("SELECT type FROM {merci_node_type} WHERE type_setting <> 'disabled'");
while ($content_type = db_fetch_object($content_types)) {
$nodes = db_query("SELECT nid FROM {node} WHERE type = '%s'", $content_type->type);
while ($node = db_fetch_object($nodes)) {
node_delete($node->nid);
}
//node_type_delete($content_type->type);
}
// Remove the programatically created reservation node type
// and all associated nodes.
$nodes = db_query("SELECT nid FROM {node} WHERE type = 'merci_reservation'");
while ($node = db_fetch_object($nodes)) {
node_delete($node->nid);
}
node_type_delete('merci_reservation');
// You'd think the uninstall submit function would take care of this
// but it doesn't look like it.
node_types_rebuild();
menu_rebuild();
// Remove field_merci_date.
module_load_include('inc', 'content', 'includes/content.crud');
content_field_instance_delete('field_merci_date', 'merci_reservation');
content_field_instance_delete('field_merci_commercial_cost', 'merci_reservation');
content_field_instance_delete('field_merci_member_cost', 'merci_reservation');
// Remove tables.
drupal_uninstall_schema('merci');
// Delete the vocabulary.
$vid = variable_get('merci_equipment_grouping_vid', '');
taxonomy_del_vocabulary($vid);
}