/[drupal]/contributions/modules/mailout/mailout.install
ViewVC logotype

Contents of /contributions/modules/mailout/mailout.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Mon Apr 14 04:10:43 2008 UTC (19 months, 1 week ago) by kingmoore
Branch: MAIN
CVS Tags: DRUPAL-5--0-0, HEAD
Branch point for: DRUPAL-5
File MIME type: text/x-php
initial malout module commit
1 <?php
2 // $Id$
3
4 /**
5 * @file mailout.install
6 * Install and uninstall all required databases.
7 * Also do incremental database updates.
8 */
9
10 /**
11 * Implementation of hook_install()
12 *
13 */
14 function mailout_install(){
15
16 switch($GLOBALS['db_type']){
17 case 'mysql':
18 case 'mysqli':
19 db_query("CREATE TABLE {mailout_template} (
20 nid int unsigned NOT NULL default '0',
21 vid int unsigned NOT NULL default '0',
22 email_header text,
23 email_footer text,
24 email_from tinytext,
25 email_subject tinytext,
26 PRIMARY KEY (nid,vid),
27 KEY nid (nid)
28 )");
29 db_query("CREATE TABLE {mailout_log} (
30 id INT( 16 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
31 mailout_template_id INT( 16 ) NOT NULL ,
32 email_subject TINYTEXT NOT NULL ,
33 email_from TINYTEXT NOT NULL ,
34 email_body TEXT NOT NULL ,
35 email_headers TEXT NOT NULL ,
36 scheduled INT(4) NOT NULL default '0',
37 timestamp TIMESTAMP NOT NULL
38 )");
39 db_query("CREATE TABLE {mailout_message_log} (
40 id INT( 16 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
41 mailout_log_id INT( 16 ) NOT NULL ,
42 email_to TINYTEXT NOT NULL ,
43 sent INT( 4 ) NOT NULL default '0',
44 opened INT( 2 ) NOT NULL DEFAULT '0'
45 )");
46 db_query("CREATE TABLE {mailout_list} (
47 id INT( 16 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
48 list_name TINYTEXT NOT NULL
49 )");
50 db_query("INSERT INTO {mailout_list} (list_name) VALUES ('Global opt out')");
51 db_query("INSERT INTO {mailout_list} (list_name) VALUES ('Mail Blast List')");
52 db_query("CREATE TABLE {mailout_list_address} (
53 id INT( 16 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
54 list_id INT( 16 ) NOT NULL ,
55 email TINYTEXT NOT NULL
56 )");
57 break;
58 }
59 }
60
61 /**
62 * Implementation of hook_uninstall()
63 *
64 */
65 function mailout_uninstall() {
66 switch($GLOBALS['db_type']){
67 case 'mysql':
68 case 'mysqli':
69 db_query("DROP TABLE {mailout_template}");
70 db_query("DROP TABLE {mailout_log}");
71 db_query("DROP TABLE {mailout_message_log}");
72 db_query("DROP TABLE {mailout_list}");
73 db_query("DROP TABLE {mailout_list_address}");
74 break;
75 }
76 }

  ViewVC Help
Powered by ViewVC 1.1.2