You are here

function domain_prefix_uninstall in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain_prefix/domain_prefix.install \domain_prefix_uninstall()

Implement hook_uninstall()

File

domain_prefix/domain_prefix.install, line 42
Install file for the Domain Prefix module

Code

function domain_prefix_uninstall() {

  // We must drop all the created tables.
  $result = db_query("SELECT domain_id, tablename FROM {domain_prefix} WHERE status > 1");
  while ($table = db_fetch_array($result)) {
    $name = db_escape_table('domain_' . $table['domain_id'] . '_' . $table['tablename']);
    db_query("DROP TABLE {%s}", $name);
  }

  // If there are values in the sequences table, delete them.
  $result = db_query("SELECT DISTINCT(domain_id) FROM {domain_prefix} WHERE status > 1");
  while ($domain = db_fetch_array($result)) {
    db_query("DELETE FROM {sequences} WHERE name LIKE '{%s%}'", db_escape_table('domain_' . $domain['domain_id']));
  }

  // Now drop the storage table.
  db_query("DROP TABLE {domain_prefix}");
  variable_del('domain_prefix');
  variable_del('domain_prefix_options');
}