function ad_uninstall in Advertisement 7
Same name and namespace in other branches
- 5.2 ad.install \ad_uninstall()
- 5 ad.install \ad_uninstall()
- 6.3 ad.install \ad_uninstall()
- 6 ad.install \ad_uninstall()
- 6.2 ad.install \ad_uninstall()
- 7.3 ad.install \ad_uninstall()
Allow complete uninstallation of the ad module.
File
- ./
ad.install, line 324 - Advertisement module database schema.
Code
function ad_uninstall() {
// Delete all ad content.
$result = db_query("SELECT nid FROM {node} WHERE type = 'ad'");
while ($node = $result
->fetch()) {
node_delete($node->nid);
variable_del("ad_autoactivate_warning_{$node->nid}");
}
// Delete all remaining ad module variables.
$variables = array(
'ad_cron_timestamp',
'ad_link_target',
'ad_cache',
'ad_cache_file',
'adserve',
'ad_group_vid',
'ad_groups',
'ad_validate_url',
'ad_display',
);
foreach ($variables as $variable) {
variable_del($variable);
}
db_query("DELETE FROM {variable} WHERE name LIKE 'ad_block_quantity_%'");
// Delete field instances
$fields = _ad_installed_instances();
foreach ($fields as $field) {
field_delete_instance($field);
}
// Delete field definitions
$fields = array_keys(_ad_installed_fields());
foreach ($fields as $field) {
field_delete_field($field);
}
// Purge all field infromation
field_purge_batch(1000);
}