94 lines
2.4 KiB
Plaintext
94 lines
2.4 KiB
Plaintext
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Provides the installation routines for the maillog module
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_install().
|
|
*/
|
|
function maillog_install() {
|
|
$config = \Drupal::configFactory()->getEditable('system.mail');
|
|
$config->set('interface.default', 'maillog');
|
|
$config->save();
|
|
}
|
|
|
|
/**
|
|
* Implements hook_uninstall().
|
|
*/
|
|
function maillog_uninstall() {
|
|
$config = \Drupal::configFactory()->getEditable('system.mail');
|
|
|
|
// Restore the mail configuration to php_mail if it currently uses maillog.
|
|
if ($config->get('interface.default') == 'maillog') {
|
|
$config->set('interface.default', 'php_mail');
|
|
$config->save();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_schema().
|
|
*/
|
|
function maillog_schema() {
|
|
$schema['maillog'] = array(
|
|
'description' => "Stores outgoing e-mail details for nodes of type 'maillog'.",
|
|
'fields' => array(
|
|
'idmaillog' => array(
|
|
'type' => 'serial',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'description' => "The mail_log {node}.nid",
|
|
),
|
|
'header_message_id' => array(
|
|
'type' => 'varchar',
|
|
'length' => 255,
|
|
'default' => '',
|
|
'description' => "The 'message-id' field of the e-mail.",
|
|
),
|
|
'header_from' => array(
|
|
'type' => 'text',
|
|
'not null' => TRUE,
|
|
'description' => "The 'From' field of the e-mail.",
|
|
),
|
|
'header_to' => array(
|
|
'type' => 'text',
|
|
'not null' => TRUE,
|
|
'description' => "The 'To' field of the e-mail.",
|
|
),
|
|
'header_reply_to' => array(
|
|
'type' => 'text',
|
|
'not null' => TRUE,
|
|
'description' => "The 'Reply-To' field of the e-mail.",
|
|
),
|
|
'header_all' => array(
|
|
'type' => 'text',
|
|
'not null' => TRUE,
|
|
'description' => "The 'Header' field of the e-mail.",
|
|
),
|
|
'subject' => array(
|
|
'description' => "The 'Subject' fieldof the e-mail.",
|
|
'type' => 'varchar',
|
|
'length' => 255,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
),
|
|
'body' => array(
|
|
'description' => 'The body of this version.',
|
|
'type' => 'text',
|
|
'not null' => TRUE,
|
|
'size' => 'big',
|
|
),
|
|
'sent_date' => array(
|
|
'description' => 'The Unix timestamp when the mail was sent.',
|
|
'type' => 'int',
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
),
|
|
),
|
|
'primary key' => array('idmaillog'),
|
|
);
|
|
|
|
return $schema;
|
|
}
|