You are here

function faq_uninstall in Frequently Asked Questions 5

Same name and namespace in other branches
  1. 8 faq.install \faq_uninstall()
  2. 5.2 faq.install \faq_uninstall()
  3. 6 faq.install \faq_uninstall()
  4. 7 faq.install \faq_uninstall()

Implementation of hook_uninstall().

File

./faq.install, line 40

Code

function faq_uninstall() {

  // delete the variables we created.
  variable_del('faq_display');
  variable_del('faq_back_to_top');
  variable_del('faq_use_categories');
  variable_del('faq_category_display');
  variable_del('faq_block_recent_faq_count');
  variable_del('faq_block_random_faq_count');
  variable_del('faq_use_teaser');
  variable_del('faq_more_link');
  variable_del('faq_description');
  variable_del('faq_description_format');
  variable_del('faq_group_questions_top');
  variable_del('faq_answer_category_name');
  variable_del('faq_question_listing');
  variable_del('faq_qa_mark');
  variable_del('faq_question_label');
  variable_del('faq_answer_label');
  variable_del('faq_category_listing');
  variable_del('faq_count');

  // Remove all FAQ nodes.
  $result = db_query("SELECT nid FROM {node} WHERE type = 'faq'");
  while ($obj = db_fetch_object($result)) {
    node_delete($obj->nid);
  }
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $deleted = db_query("DROP TABLE IF EXISTS {faq_weights}");
      break;
    case 'pgsql':
      $deleted = db_query('DROP TABLE {faq_weights}');
      break;
  }

  // Remove the node type
  node_type_delete('FAQ');

  // clear the cache tables
  cache_clear_all('*', 'cache', TRUE);
  cache_clear_all('*', 'cache_filter', TRUE);
  cache_clear_all('*', 'cache_menu', TRUE);
  cache_clear_all('*', 'cache_page', TRUE);
  watchdog('FAQ', 'faq module removed');
}