update.install

  1. 7.x drupal-7.x/modules/update/update.install
  2. 6.x drupal-6.x/modules/update/update.install

File

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