You are here

function classified_uninstall in Classified Ads 6.3

Same name and namespace in other branches
  1. 7.3 classified.install \classified_uninstall()

Implements hook_uninstall().

  • remove vocabulary and its terms
  • remove module variables

Should technically remove perms/role mapping, but this should really be handled by core, and already is in D7: http://drupal.org/node/306027

File

./classified.install, line 209
Install file for the Classified Ads module.

Code

function classified_uninstall() {
  drupal_load('module', 'classified');
  $vid = _classified_get('vid');
  $t = get_t();
  if ($vid) {

    // In some broken situations, the vocabulary may be already deleted, so we
    // avoid choking on its failed deletion.
    taxonomy_del_vocabulary($vid);
    drupal_set_message($t('Removed Classified Ads vocabulary and terms.'));
  }
  else {
    drupal_set_message($t('Could not find a Classified Ads vocabulary to remove.'), 'warning');
  }
  foreach (array_keys(_classified_get_vars()) as $var_name) {
    variable_del($var_name);
  }
  drupal_set_message($t('Removed Classified Ads variables.'));
  drupal_uninstall_schema('classified');
  cache_clear_all('classified:overview', 'cache');
}