smtp.install 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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_enable().
  32. */
  33. function smtp_enable() {
  34. $mail_modes = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
  35. $mail_modes['default-system'] = 'SmtpMailSystem';
  36. variable_set('mail_system', $mail_modes);
  37. }
  38. /**
  39. * Implements hook_disable().
  40. */
  41. function smtp_disable() {
  42. $mail_modes = variable_get('mail_system');
  43. $mail_modes['default-system'] = 'DefaultMailSystem';
  44. variable_set('mail_system', $mail_modes);
  45. }
  46. /**
  47. * Implements hook_update_N().
  48. * Upgrade to Drupal 7.x
  49. */
  50. function smtp_update_7000() {
  51. if (variable_get('smtp_on', 0) != 0) {
  52. variable_set('mail_system', array('default-system' => 'SmtpMailSystem'));
  53. }
  54. }