mandrill.install 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the mandrill module.
  5. */
  6. /**
  7. * Implements hook_uninstall().
  8. */
  9. function mandrill_uninstall() {
  10. // Delete other variables:
  11. variable_del('mandrill_analytics_campaign');
  12. variable_del('mandrill_analytics_domains');
  13. variable_del('mandrill_api_key');
  14. variable_del('mandrill_filter_format');
  15. variable_del('mandrill_from');
  16. variable_del('mandrill_from_name');
  17. variable_del('mandrill_mail_key_blacklist');
  18. variable_del('mandrill_test_address');
  19. variable_del('mandrill_test_body');
  20. variable_del('mandrill_track_clicks');
  21. variable_del('mandrill_track_opens');
  22. variable_del('mandrill_url_strip_qs');
  23. variable_del('mandrill_process_async');
  24. }
  25. /**
  26. * Implements hook_enable().
  27. */
  28. function mandrill_enable() {
  29. mailsystem_set(array('mandrill_test' => 'MandrillMailSystem'));
  30. }
  31. /**
  32. * Implements hook_disable().
  33. */
  34. function mandrill_disable() {
  35. // Tell mailsystem to remove mandrill and restore to defaults:
  36. mailsystem_clear(array('mandrill_test' => 'MandrillMailSystem'));
  37. watchdog('mandrill', 'Mandrill has been disabled.');
  38. }
  39. /**
  40. * Deletes obsolete variables.
  41. */
  42. function mandrill_update_7001() {
  43. variable_del('mandrill_status');
  44. }
  45. /**
  46. * Rebuilds the registry, as we've moved some files around.
  47. */
  48. function mandrill_update_7002() {
  49. // Rebuild the registry, we've moved some files around.
  50. registry_rebuild();
  51. }
  52. /**
  53. * Implements hook_requirements().
  54. */
  55. function mandrill_requirements($phase) {
  56. $requirements = array();
  57. // Ensure translations don't break at install time.
  58. $t = get_t();
  59. if ($phase == 'update') {
  60. if (!module_exists('mailsystem')) {
  61. $requirements['mandrill'] = array(
  62. 'title' => $t('Mandrill'),
  63. 'value' => '7.x-1.4',
  64. 'description' => $t('Mail System module is required for Mandrill 7.x-1.3 or higher.'),
  65. 'severity' => REQUIREMENT_ERROR,
  66. );
  67. }
  68. }
  69. return $requirements;
  70. }
  71. /**
  72. * Delete obsolete batch limit variable.
  73. */
  74. function mandrill_update_7003() {
  75. variable_del('mandrill_batch_limit');
  76. }
  77. /**
  78. * Clear cache to pick up new class name for DrupalMandrill class.
  79. */
  80. function mandrill_update_7004() {
  81. cache_clear_all();
  82. }