newsletter.install in Newsletter 7.2
Same filename and directory in other branches
Contains install,uninstall and update functions for Newsletter module.
File
newsletter.installView source
<?php
/**
* @file
* Contains install,uninstall and update functions for Newsletter module.
*/
/**
* Implements hook_install().
*/
function newsletter_install() {
$mail_modes = variable_get('mail_system', array(
'default-system' => 'DefaultMailSystem',
));
$mail_modes['newsletter'] = 'NewsletterMailSystem';
variable_set('mail_system', $mail_modes);
}
/**
* Implements hook_uninstall().
*/
function newsletter_uninstall() {
db_query("DELETE FROM {variable} WHERE name LIKE 'newsletter_%'");
$mail_modes = variable_get('mail_system');
unset($mail_modes['newsletter']);
variable_set('mail_system', $mail_modes);
}
/**
* Implements hook_schema().
*/
function newsletter_schema() {
$schema = array();
$schema['newsletter'] = array(
'description' => 'Contains the newsletters that are sent.',
'fields' => array(
'newsletter_id' => array(
'description' => 'The primary identifier for a newsletter.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'send_id' => array(
'description' => 'The # of sent times.',
'type' => 'int',
'not null' => FALSE,
'default' => 0,
),
'list_id' => array(
'description' => 'The {newsletter_list}.list_id this newsletter was sent to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'description' => 'The {node}.nid of the newsletter issue.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'subject' => array(
'description' => 'The newsletter\'s subject.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'sent' => array(
'description' => 'The sent timestamp of this newsletter.',
'type' => 'int',
'not null' => FALSE,
'default' => 0,
),
),
'indexes' => array(
'newsletter_send_id' => array(
'send_id',
),
),
'foreign keys' => array(
'tracked_list' => array(
'table' => 'newsletter_list',
'columns' => array(
'list_id' => 'list_id',
),
),
'tracked_node' => array(
'table' => 'node',
'columns' => array(
'nid' => 'nid',
),
),
),
'primary key' => array(
'newsletter_id',
),
);
return $schema;
}
Functions
Name![]() |
Description |
---|---|
newsletter_install | Implements hook_install(). |
newsletter_schema | Implements hook_schema(). |
newsletter_uninstall | Implements hook_uninstall(). |