1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * Implementation of hook_install(). |
---|
5 | */ |
---|
6 | function update_install() { |
---|
7 | // Create cache table. |
---|
8 | drupal_install_schema('update'); |
---|
9 | // Remove stale variables from update_status 5.x contrib, if any. |
---|
10 | _update_remove_update_status_variables(); |
---|
11 | } |
---|
12 | |
---|
13 | /** |
---|
14 | * Implementation of hook_uninstall(). |
---|
15 | */ |
---|
16 | function update_uninstall() { |
---|
17 | // Remove cache table. |
---|
18 | drupal_uninstall_schema('update'); |
---|
19 | // Clear any variables that might be in use |
---|
20 | $variables = array( |
---|
21 | 'update_check_frequency', |
---|
22 | 'update_fetch_url', |
---|
23 | 'update_last_check', |
---|
24 | 'update_notification_threshold', |
---|
25 | 'update_notify_emails', |
---|
26 | ); |
---|
27 | foreach ($variables as $variable) { |
---|
28 | variable_del($variable); |
---|
29 | } |
---|
30 | } |
---|
31 | |
---|
32 | /** |
---|
33 | * Implementation of hook_schema(). |
---|
34 | */ |
---|
35 | function update_schema() { |
---|
36 | $schema['cache_update'] = drupal_get_schema_unprocessed('system', 'cache'); |
---|
37 | $schema['cache_update']['description'] = 'Cache table for the Update module to store information about available releases, fetched from central server.'; |
---|
38 | return $schema; |
---|
39 | } |
---|
40 | |
---|
41 | /** |
---|
42 | * Private helper to clear out stale variables from update_status 5.x contrib. |
---|
43 | * |
---|
44 | * @see update_install() |
---|
45 | * @see update_update_6000() |
---|
46 | */ |
---|
47 | function _update_remove_update_status_variables() { |
---|
48 | variable_del('update_status_settings'); |
---|
49 | variable_del('update_status_notify_emails'); |
---|
50 | variable_del('update_status_check_frequency'); |
---|
51 | variable_del('update_status_notification_threshold'); |
---|
52 | variable_del('update_status_last'); |
---|
53 | variable_del('update_status_fetch_url'); |
---|
54 | } |
---|
55 | |
---|
56 | /** |
---|
57 | * Clear out stale variables from update_status. |
---|
58 | */ |
---|
59 | function update_update_6000() { |
---|
60 | _update_remove_update_status_variables(); |
---|
61 | return array(); |
---|
62 | } |
---|