smtp.install 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * @file
  4. * The installation instructions for the SMTP Authentication Support.
  5. */
  6. /**
  7. * Implements hook_install().
  8. */
  9. function smtp_install() {
  10. variable_set('smtp_on', 0);
  11. }
  12. /**
  13. * Implements hook_uninstall().
  14. */
  15. function smtp_uninstall() {
  16. variable_del('smtp_from');
  17. variable_del('smtp_fromname');
  18. variable_del('smtp_host');
  19. variable_del('smtp_hostbackup');
  20. variable_del('smtp_on');
  21. variable_del('smtp_password');
  22. variable_del('smtp_port');
  23. variable_del('smtp_protocol');
  24. variable_del('smtp_test_address');
  25. variable_del('smtp_username');
  26. if (variable_get('smtp_library', '') == drupal_get_path('module', 'smtp') . '/smtp.module') {
  27. variable_del('smtp_library');
  28. }
  29. }
  30. /**
  31. * Implements hook_disable().
  32. */
  33. function smtp_disable() {
  34. $mail_modes = variable_get('mail_system');
  35. $mail_modes['default-system'] = 'DefaultMailSystem';
  36. variable_set('mail_system', $mail_modes);
  37. }
  38. /**
  39. * Implements hook_update_N().
  40. * Upgrade to Drupal 7.x
  41. */
  42. function smtp_update_7000() {
  43. if (variable_get('smtp_on', 0) != 0) {
  44. variable_set('mail_system', array('default-system' => 'SmtpMailSystem'));
  45. }
  46. }
  47. /**
  48. * Implements hook_update_N().
  49. *
  50. * Back to default mail system if the status flag is off.
  51. */
  52. function smtp_update_7100() {
  53. $mail_modes = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
  54. if ($mail_modes['default-system'] == 'SmtpMailSystem' && !variable_get('smtp_on', FALSE)) {
  55. $mail_modes['default-system'] = 'DefaultMailSystem';
  56. variable_set('mail_system', $mail_modes);
  57. }
  58. }