maillog.install 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /**
  3. * @file
  4. * Provides the installation routines for the maillog module
  5. */
  6. /**
  7. * Implementation of hook_enable().
  8. */
  9. function maillog_enable() {
  10. $mail_system = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
  11. $mail_system['maillog'] = 'MaillogMailSystem';
  12. $mail_system['default-system'] = $mail_system['maillog'];
  13. variable_set('mail_system', $mail_system);
  14. }
  15. /**
  16. * Implementation of hook_disable().
  17. *
  18. * Removing smtp_libraries settings.
  19. *
  20. * If the smptp_library variable refers to the maillog_smtp_library the variable will be resetted. It does not make sense to backup the smtp_library
  21. * when enabling the maillog module, because before restoring when the maillog module gets disabled another module could changed the smtp variable.
  22. */
  23. function maillog_disable() {
  24. $mail_system = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
  25. unset($mail_system['maillog']);
  26. $mail_system['default-system'] = 'DefaultMailSystem';
  27. variable_set('mail_system', $mail_system);
  28. }
  29. /**
  30. * Implementation of hook_schema().
  31. */
  32. function maillog_schema() {
  33. $schema['maillog'] = array(
  34. 'description' => t("Stores outgoing e-mail details for nodes of type 'maillog'."),
  35. 'fields' => array(
  36. 'idmaillog' => array(
  37. 'type' => 'serial',
  38. 'unsigned' => TRUE,
  39. 'not null' => TRUE,
  40. 'description' => t("The mail_log {node}.nid"),
  41. ),
  42. 'header_message_id' => array(
  43. 'type' => 'varchar',
  44. 'length' => 255,
  45. 'not null' => TRUE,
  46. 'default' => '',
  47. 'description' => t("The 'message-id' field of the e-mail."),
  48. ),
  49. 'header_from' => array(
  50. 'type' => 'text',
  51. 'not null' => TRUE,
  52. 'description' => t("The 'From' field of the e-mail."),
  53. ),
  54. 'header_to' => array(
  55. 'type' => 'text',
  56. 'not null' => TRUE,
  57. 'description' => t("The 'To' field of the e-mail."),
  58. ),
  59. 'header_reply_to' => array(
  60. 'type' => 'text',
  61. 'not null' => TRUE,
  62. 'description' => t("The 'Reply-To' field of the e-mail."),
  63. ),
  64. 'header_all' => array(
  65. 'type' => 'text',
  66. 'not null' => TRUE,
  67. 'description' => t("The 'Header' field of the e-mail."),
  68. ),
  69. 'subject' => array(
  70. 'description' => t("The 'Subject' fieldof the e-mail."),
  71. 'type' => 'varchar',
  72. 'length' => 255,
  73. 'not null' => TRUE,
  74. 'default' => '',
  75. ),
  76. 'body' => array(
  77. 'description' => 'The body of this version.',
  78. 'type' => 'text',
  79. 'not null' => TRUE,
  80. 'size' => 'big'
  81. ),
  82. 'sent_date' => array(
  83. 'description' => 'The Unix timestamp when the mail was sent.',
  84. 'type' => 'int',
  85. 'not null' => TRUE,
  86. 'default' => 0,
  87. ),
  88. ),
  89. 'primary key' => array('idmaillog'),
  90. );
  91. return $schema;
  92. }