Xataface Email Module  0.3.2
Email/Mailmerge Module for Xataface
 All Data Structures Files Functions Variables Pages
installer.php
Go to the documentation of this file.
1 <?php
3 
4  function update_1003(){
5 
6  $sql[] = "create table if not exists `xataface__email_newsletters` (
7  `id` int(11) not null auto_increment,
8  `subject` varchar(128) not null,
9  `cc` varchar(128) default null,
10  `from` varchar(128) default null,
11  `template_id` int(11) default null,
12  `content` text,
13  `ignore_blacklist` tinyint(1) default 0,
14 
15  primary key (`id`))";
16 
17  $sql[] = "ALTER TABLE `xataface__email_newsletters` ADD `posted_by` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL";
18 
19 
20  $sql[] = "CREATE TABLE IF NOT EXISTS `xataface__email_templates` (
21  `template_id` int(11) NOT NULL auto_increment,
22  `table_name` varchar(255) default NULL,
23  `template_name` varchar(255) default NULL,
24  `email_subject` varchar(255) default NULL,
25  `email_body` text,
26  `template_instructions` text,
27  PRIMARY KEY (`template_id`),
28  UNIQUE KEY `template_name` (`template_name`)
29  )";
30 
31  $sql[] = "CREATE TABLE IF NOT EXISTS `xataface__email_jobs` (
32  job_id int(11) not null auto_increment primary key,
33  email_id int(11),
34  email_table varchar(255),
35  join_table varchar(255),
36  recipients_table varchar(255),
37  email_column varchar(255),
38  active tinyint(1) default 0,
39  complete tinyint(1) default 0,
40  total_emails int(11) default 0,
41  sent_emails int(11) default 0,
42  successful_emails int(11) default 0,
43  failed_emails int(11) default 0,
44  blacklisted_emails int(11) default 0,
45  start_time int(11) default 0,
46  end_time int(11) default 0,
47  unique key (email_id)
48  )";
49  foreach ($sql as $q){
50  try {
51  df_q($q);
52  } catch (Exception $ex){}
53  }
54  //df_q($sql);
55  df_clear_views();
56  df_clear_cache();
57 
58 
59  }
60 
61  function update_1004(){
62 
63 
64  $sql[] = "create table if not exists `xataface__email_log` (
65  `log_id` int(11) not null auto_increment primary key,
66  `messageid` int(11) not null,
67  `recipient_email` varchar(128) not null,
68  `sent` tinyint(1) default 0,
69  `date_created` datetime default null,
70  `date_sent` datetime default null,
71  `success` tinyint(1) default null,
72  `comment` varchar(255) default null,
73  key (`messageid`))";
74 
75  try {
76  df_q($sql);
77  } catch (Exception $ex){}
78  df_clear_views();
79  df_clear_cache();
80  }
81 
82  function update_1005(){
83 
84 
85  $sql[] = "alter table xataface__email_log add primary_key varchar(255) after recipient_email";
86 
87  try {
88  df_q($sql);
89  } catch (Exception $ex){}
90  df_clear_views();
91  df_clear_cache();
92  }
93 
94  function update_1006(){
95 
96 
97  $sql[] = "alter table xataface__email_jobs add cancelled tinyint(1) default 0 after `active`";
98 
99  try {
100  df_q($sql);
101  } catch (Exception $ex){}
102  df_clear_views();
103  df_clear_cache();
104  }
105 
106  function update_1007(){
107 
108 
109  $sql[] = "alter table xataface__email_templates add email_from varchar(255) after `email_subject`";
110  $sql[] = "alter table xataface__email_templates add email_cc varchar(255) after `email_from`";
111 
112  try {
113  df_q($sql);
114  } catch (Exception $ex){}
115  df_clear_views();
116  df_clear_cache();
117  }
118 
119  function update_1008(){
120 
121 
122  $sql[] = "alter table xataface__email_log add uniqid varchar(255) after `comment`";
123  $sql[] = "alter table xataface__email_log add key(`uniqid`)";
124  try {
125  df_q($sql);
126  } catch (Exception $ex){}
127  df_clear_views();
128  df_clear_cache();
129  }
130 
131  function update_3312(){
132 
133 
134  $sql[] = "create table if not exists xataface__email_attachments (
135  attachment_id int(11) not null auto_increment primary key,
136  email_id int(11),
137  file varchar(255),
138  key (`email_id`))";
139  try {
140  df_q($sql);
141  } catch (Exception $ex){ echo $ex->getMessage();}
142  df_clear_views();
143  df_clear_cache();
144 
145  }
146 
147 
148 
149 }