You are here

function ad_uninstall in Advertisement 5.2

Same name and namespace in other branches
  1. 5 ad.install \ad_uninstall()
  2. 6.3 ad.install \ad_uninstall()
  3. 6 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 176

Code

function ad_uninstall() {

  // 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}");
  }

  // Drop all ad module tables.
  db_query('DROP TABLE {ad_clicks}');
  db_query('DROP TABLE {ad_statistics}');
  db_query('DROP TABLE {ads}');

  // 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);
  }

  // TODO: "ad_block_quantity_$delta"
}