You are here

glossary.install in Glossary 5

Same filename and directory in other branches
  1. 5.2 glossary.install
  2. 6 glossary.install
  3. 7 glossary.install

File

glossary.install
View source
<?php

/* Implementation of hook_update_N. 
 * In order to make sure we don't turn off the search block, we'll change the blocks table.
 */
function glossary_update_5100() {
  $ret = array();
  $ret[] = update_sql("UPDATE {blocks} SET delta=0 WHERE module='glossary' AND delta=999");
  return $ret;
}

/* Implementation of hook_update_N.
 * We no longer support the old blocks, so let's delete them from the blocks table.
 */
function glossary_update_5101() {
  $ret = array();
  $ret[] = update_sql("DELETE FROM {blocks} WHERE module='glossary' AND (delta<999 AND delta>0)");
  return $ret;
}

/* Implementation of hook_update_N.
 * We have moved the settings, so we'll remind the user of this.
 */
function glossary_update_5102() {
  $ret = array();
  drupal_set_message('Note: The settings for the Glossary module have moved from the Input Formats page to a separate page under Administer &raquo; Site configuration &raquo; Glossary. Additionally, there are a few new settings.', 'warning');
  return $ret;
}

/* Implementation of hook_uninstall.
 * There are no tables, so we delete all variables and clear the filter cache.
 * It is left to the user to dispose of any vocabularies that are no longer needed.
 */
function glossary_uninstall() {

  // Find out how many input formats are set.
  $filter_count = db_result(db_query('SELECT MAX( format ) FROM {filters}'));

  // Delete all possible variables. Even if some don't exist, there is no harm in trying.
  for ($i = 0; $i <= $filter_count; ++$i) {
    variable_del('glossary_case_' . $i);
    variable_del('glossary_icon_' . $i);
    variable_del('glossary_match_' . $i);
    variable_del('glossary_replace_' . $i);
    variable_del('glossary_replace_all_' . $i);
    variable_del('glossary_superscript_' . $i);
    variable_del('glossary_absolute_' . $i);
    variable_del('glossary_vids_' . $i);
    variable_del('glossary_blocking_tags_' . $i);
  }
  variable_del('glossary_page_per_letter');
  variable_del('glossary_disable_indicator');
  variable_del('glossary_need_to_clear_cache');
  variable_del('glossary_click_option');
  variable_del('glossary_allow_no_description');
  variable_del('glossary_alphabet');
  variable_del('glossary_digits');
  variable_del('glossary_hide_menus');
  variable_del('glossary_show_description');
  variable_del('glossary_suppress_unused');
  variable_del('glossary_alphabar_separator');

  // Let's make sure the filter cache is cleared of our stuff.
  cache_clear_all(NULL, 'cache_filter');
  watchdog('Glossary', t('Glossary module uninstalled by uid !user.', array(
    '!user' => $user->uid,
  )));
  drupal_set_message(t('The Glossary module has been uninstalled. You will still need to decide what to do with vocabularies that were used.'), 'warning');
}