You are here

function content_module_delete in Content Construction Kit (CCK) 6.2

Same name and namespace in other branches
  1. 6.3 includes/content.crud.inc \content_module_delete()
  2. 6 includes/content.crud.inc \content_module_delete()

Delete all data related to a module.

Parameters

string $module:

1 call to content_module_delete()
content_notify in ./content.module
Modules notify Content module when uninstalled, disabled, etc.

File

includes/content.crud.inc, line 597
Create/Read/Update/Delete functions for CCK-defined object types.

Code

function content_module_delete($module) {

  // Delete the field data.
  // If content module has been uninstalled first, all tables
  // have already been dropped, and running that code will raise errors.
  if (db_table_exists(content_instance_tablename())) {
    $results = db_query("SELECT field_name, type_name FROM {" . content_instance_tablename() . "} WHERE widget_module = '%s'", $module);
    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);
    menu_rebuild();
  }
}