1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Update functions for Nice menus.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_uninstall().
|
10
|
*/
|
11
|
function nice_menus_uninstall() {
|
12
|
// Remove all the configuration variables added by the module.
|
13
|
db_delete('variable')
|
14
|
->condition('name', 'nice_menus_%', 'LIKE')
|
15
|
->execute();
|
16
|
|
17
|
// Remove all the block configurations of the module.
|
18
|
if (module_exists('block')) {
|
19
|
db_delete('block')
|
20
|
->condition('module', 'nice_menus')
|
21
|
->execute();
|
22
|
db_delete('block_node_type')
|
23
|
->condition('module', 'nice_menus')
|
24
|
->execute();
|
25
|
db_delete('block_role')
|
26
|
->condition('module', 'nice_menus')
|
27
|
->execute();
|
28
|
}
|
29
|
|
30
|
cache_clear_all();
|
31
|
}
|
32
|
|
33
|
/**
|
34
|
* Implements hook_update_N().
|
35
|
*/
|
36
|
function nice_menus_update_6000() {
|
37
|
// Existing blocks need to be set to no caching.
|
38
|
$ret = array();
|
39
|
/*
|
40
|
* TODO update_sql has been removed. Use the database API for any
|
41
|
* schema or data changes.
|
42
|
* update_sql("UPDATE {block} SET cache = -1 WHERE module = 'nice_menus'").
|
43
|
*/
|
44
|
$ret[] = array();
|
45
|
/*
|
46
|
* hook_update_N() no longer returns a $ret array. Instead, return
|
47
|
* nothing or a translated string indicating the update ran successfully.
|
48
|
* See http://drupal.org/node/224333#update_sql.
|
49
|
*/
|
50
|
return t('TODO Add a descriptive string here to show in the UI.');
|
51
|
}
|
52
|
|
53
|
/**
|
54
|
* Implements hook_update_N().
|
55
|
*/
|
56
|
function nice_menus_update_6001() {
|
57
|
// Switch the JS toggle variable name.
|
58
|
$old_setting = variable_get('nice_menus_ie', 1);
|
59
|
variable_set('nice_menus_js', $old_setting);
|
60
|
variable_del('nice_menus_ie');
|
61
|
// hook_update_N() no longer returns a $ret array. Instead, return
|
62
|
// nothing or a translated string indicating the update ran successfully.
|
63
|
// See http://drupal.org/node/224333#update_sql.
|
64
|
return t('TODO Add a descriptive string here to show in the UI.');
|
65
|
}
|
66
|
|
67
|
/**
|
68
|
* Implements hook_update_N().
|
69
|
*
|
70
|
* Update the menu selection variables to match the new format that allows
|
71
|
* selection of the exact menu item to start the display from.
|
72
|
*/
|
73
|
function nice_menus_update_6002() {
|
74
|
for ($delta = 1; $delta <= variable_get('nice_menus_number', '2'); $delta++) {
|
75
|
$menu = variable_get('nice_menus_menu_' . $delta, 'navigation');
|
76
|
// If no menu item is selected.
|
77
|
if (strpos($menu, ':') === FALSE) {
|
78
|
variable_set('nice_menus_menu_' . $delta, $menu . ':0');
|
79
|
}
|
80
|
}
|
81
|
}
|