File: update.install

package info (click to toggle)
drupal6 6.6-3lenny6
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 4,868 kB
  • ctags: 372
  • sloc: pascal: 15,958; php: 4,294; sh: 1,562; perl: 126; makefile: 40
file content (64 lines) | stat: -rw-r--r-- 1,724 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
// $Id: update.install,v 1.4.2.1 2008/08/28 08:14:56 dries Exp $

/**
 * Implementation of hook_install().
 */
function update_install() {
  // Create cache table.
  drupal_install_schema('update');
  // Remove stale variables from update_status 5.x contrib, if any.
  _update_remove_update_status_variables();
}

/**
 * Implementation of hook_uninstall().
 */
function update_uninstall() {
  // Remove cache table.
  drupal_uninstall_schema('update');
  // Clear any variables that might be in use
  $variables = array(
    'update_check_frequency',
    'update_fetch_url',
    'update_last_check',
    'update_notification_threshold',
    'update_notify_emails',
  );
  foreach ($variables as $variable) {
    variable_del($variable);
  }
  menu_rebuild();
}

/**
 * Implementation of hook_schema().
 */
function update_schema() {
  $schema['cache_update'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_update']['description'] = t('Cache table for the Update module to store information about available releases, fetched from central server.');
  return $schema;
}

/**
 * Private helper to clear out stale variables from update_status 5.x contrib.
 *
 * @see update_install()
 * @see update_update_6000()
 */
function _update_remove_update_status_variables() {
  variable_del('update_status_settings');
  variable_del('update_status_notify_emails');
  variable_del('update_status_check_frequency');
  variable_del('update_status_notification_threshold');
  variable_del('update_status_last');
  variable_del('update_status_fetch_url');
}

/**
 * Clear out stale variables from update_status.
 */
function update_update_6000() {
  _update_remove_update_status_variables();
  return array();
}