function domain_prefix_drop_records in Domain Access 5
Same name and namespace in other branches
- 6.2 domain_prefix/domain_prefix.admin.inc \domain_prefix_drop_records()
Drop tables created by this module.
Parameters
$domain_id: The domain_id taken from {domain}.
1 call to domain_prefix_drop_records()
- domain_prefix_domainupdate in domain_prefix/
domain_prefix.module - Implement hook_domainupdate().
File
- domain_prefix/
domain_prefix.module, line 754 - Interface for selective table prefixing for use with Domain Access. For this module to work correctly, you will need to follow the INSTALL.txt instructions for editing your settings.php file.
Code
function domain_prefix_drop_records($domain_id) {
$result = db_query("SELECT tablename FROM {domain_prefix} WHERE domain_id = %d AND status > 1", $domain_id);
$prefix = domain_prefix_string($domain_id);
while ($tables = db_fetch_array($result)) {
$table = db_escape_table($prefix . $tables['tablename']);
$exists = domain_prefix_table_exists($prefix, $tables['tablename']);
if ($exists > 0) {
db_query("DROP TABLE {%s}", $table);
drupal_set_message(t('!string table dropped.', array(
'!string' => $table,
)));
}
}
db_query("DELETE FROM {domain_prefix} WHERE domain_id = %d", $domain_id);
}