| 1 |
<?php
|
| 2 |
// $Id: glossary.install,v 1.4 2007/12/17 19:23:11 nancyw Exp $
|
| 3 |
|
| 4 |
/* Implementation of hook_update_N.
|
| 5 |
* In order to make sure we don't turn off the search block, we'll change the blocks table.
|
| 6 |
*/
|
| 7 |
function glossary_update_5100() {
|
| 8 |
$ret = array();
|
| 9 |
$ret[] = update_sql("UPDATE {blocks} SET delta=0 WHERE module='glossary' AND delta=999");
|
| 10 |
|
| 11 |
return $ret;
|
| 12 |
}
|
| 13 |
|
| 14 |
/* Implementation of hook_update_N.
|
| 15 |
* We no longer support the old blocks, so let's delete them from the blocks table.
|
| 16 |
*/
|
| 17 |
function glossary_update_5101() {
|
| 18 |
$ret = array();
|
| 19 |
$ret[] = update_sql("DELETE FROM {blocks} WHERE module='glossary' AND (delta<999 AND delta>0)");
|
| 20 |
|
| 21 |
return $ret;
|
| 22 |
}
|
| 23 |
|
| 24 |
/* Implementation of hook_update_N.
|
| 25 |
* We have moved the settings, so we'll remind the user of this.
|
| 26 |
*/
|
| 27 |
function glossary_update_5102() {
|
| 28 |
$ret = array();
|
| 29 |
drupal_set_message('Note: The settings for the Glossary module have moved from the Input Formats page to a separate page under Administer » Site configuration » Glossary. Additionally, there are a few new settings.', 'warning');
|
| 30 |
|
| 31 |
return $ret;
|
| 32 |
}
|
| 33 |
|
| 34 |
/* Implementation of hook_uninstall.
|
| 35 |
* There are no tables, so we delete all variables and clear the filter cache.
|
| 36 |
* It is left to the user to dispose of any vocabularies that are no longer needed.
|
| 37 |
*/
|
| 38 |
function glossary_uninstall() {
|
| 39 |
// Find out how many input formats are set.
|
| 40 |
$filter_count = db_result(db_query('SELECT MAX( format ) FROM {filters}'));
|
| 41 |
|
| 42 |
// Delete all possible variables. Even if some don't exist, there is no harm in trying.
|
| 43 |
for ($i = 0; $i <= $filter_count; ++$i) {
|
| 44 |
variable_del('glossary_case_'. $i);
|
| 45 |
variable_del('glossary_icon_'. $i);
|
| 46 |
variable_del('glossary_match_'. $i);
|
| 47 |
variable_del('glossary_replace_'. $i);
|
| 48 |
variable_del('glossary_replace_all_'. $i);
|
| 49 |
variable_del('glossary_superscript_'. $i);
|
| 50 |
variable_del('glossary_vids_'. $i);
|
| 51 |
}
|
| 52 |
variable_del('glossary_page_per_letter');
|
| 53 |
variable_del('glossary_disable_indicator');
|
| 54 |
variable_del('glossary_need_to_clear_cache');
|
| 55 |
|
| 56 |
// Let's make sure the filter cache is cleared of our stuff.
|
| 57 |
cache_clear_all(NULL, 'cache_filter');
|
| 58 |
|
| 59 |
watchdog('Glossary', t('Glossary module uninstalled by uid !user.', array('!user' => $user->uid)));
|
| 60 |
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');
|
| 61 |
}
|