You are here

function biblio_uninstall in Bibliography Module 6

Same name and namespace in other branches
  1. 5 biblio.install \biblio_uninstall()
  2. 6.2 biblio.install \biblio_uninstall()
  3. 7 biblio.install \biblio_uninstall()
  4. 7.2 biblio.install \biblio_uninstall()

File

./biblio.install, line 61
Install file for biblio module

Code

function biblio_uninstall() {
  if (module_exists('taxonomy')) {
    $voc = taxonomy_get_vocabularies();
    foreach ($voc as $vid => $vocabulary) {
      if ($vocabulary->module == 'biblio') {
        taxonomy_del_vocabulary($vid);
      }
    }
  }
  $result = db_query("SELECT * FROM {node} WHERE type='biblio' ");
  while ($node = db_fetch_object($result)) {
    db_query('DELETE FROM {node} WHERE nid = %d', $node->nid);
    db_query('DELETE FROM {node_revisions} WHERE nid = %d', $node->nid);

    // Remove this node from the search index if needed.
    if (function_exists('search_wipe')) {
      search_wipe($node->nid, 'node');
    }
  }
  drupal_uninstall_schema('biblio');
  $vars = db_query("SELECT * FROM {variable} WHERE name LIKE 'biblio_%'");
  while ($var = db_fetch_object($vars)) {
    variable_del($var->name);
  }
  cache_clear_all();
}