You are here

function ad_uninstall in Advertisement 6

Same name and namespace in other branches
  1. 5.2 ad.install \ad_uninstall()
  2. 5 ad.install \ad_uninstall()
  3. 6.3 ad.install \ad_uninstall()
  4. 6.2 ad.install \ad_uninstall()
  5. 7.3 ad.install \ad_uninstall()
  6. 7 ad.install \ad_uninstall()

Allow complete uninstallation of the ad module.

File

./ad.install, line 342
Advertisement module database schema.

Code

function ad_uninstall() {

  // Remove tables.
  drupal_uninstall_schema('ad');

  // Delete all ad content.
  $result = db_query("SELECT nid FROM {node} WHERE type = 'ad'");
  while ($node = db_fetch_object($result)) {
    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_%'");
}