You are here

function ed_classified_uninstall in Classified Ads 5.2

Same name and namespace in other branches
  1. 5 ed_classified.install \ed_classified_uninstall()
  2. 6.2 ed_classified.install \ed_classified_uninstall()
  3. 7.2 ed_classified.install \ed_classified_uninstall()

Implementation of hook_uninstall().

File

./ed_classified.install, line 108

Code

function ed_classified_uninstall() {
  switch (reset(explode('.', VERSION))) {
    case 5:
      db_query('DROP TABLE {edi_classified_nodes}');
      db_query('DELETE FROM {vocabulary} WHERE module = "%s"', ED_CLASSIFIED_MODULE_NAME);
      db_query('DELETE FROM {variable} WHERE name LIKE "ed_classified%";');
      break;
    case 6:
      drupal_uninstall_schema(ED_CLASSIFIED_MODULE_NAME);
      db_query('DELETE FROM {vocabulary} WHERE module = "%s"', ED_CLASSIFIED_MODULE_NAME);
      db_query('DELETE FROM {variable} WHERE name LIKE "ed_classified%";');
      break;
    case 7:

      // TODO: is the schema automagically uninstalled in Drupal 7?
      drupal_uninstall_schema(ED_CLASSIFIED_MODULE_NAME);

      // db_query('DELETE FROM {taxonomy_vocabulary} WHERE module = "%s"', ED_CLASSIFIED_MODULE_NAME);
      // db_query('DELETE FROM {variable} WHERE name LIKE "ed_classified%";');
      $fields = array(
        'module' => ED_CLASSIFIED_MODULE_NAME,
      );
      db_delete('taxonomy_vocabulary')
        ->fields($fields)
        ->execute();

      // TODO - Drupal 7 - set up the fields to do a LIKE % ...
      $fields = array(
        'name' => ED_CLASSIFIED_MODULE_NAME,
      );
      db_delete('variable')
        ->fields($fields)
        ->execute();
      break;
  }
}