Xataface Email Module 0.2
Email/Mailmerge Module for Xataface
installer.php
Go to the documentation of this file.
00001 <?php
00002 class modules_Email_installer {
00003         
00004         function update_1003(){
00005         
00006                 $sql[] = "create table if not exists `xataface__email_newsletters` (
00007                         `id` int(11) not null auto_increment,
00008                         `subject` varchar(128) not null,
00009                         `cc` varchar(128) default null,
00010                         `from` varchar(128) default null,
00011                         `template_id` int(11) default null,
00012                         `content` text,
00013                         `ignore_blacklist` tinyint(1) default 0,
00014                         
00015                         primary key (`id`)) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
00016                         
00017                 $sql[] = "ALTER TABLE  `xataface__email_newsletters` ADD  `posted_by` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL";
00018                 
00019         
00020                 $sql[] = "CREATE TABLE IF NOT EXISTS `xataface__email_templates` (
00021                   `template_id` int(11) NOT NULL auto_increment,
00022                   `table_name` varchar(255) default NULL,
00023                   `template_name` varchar(255)  default NULL,
00024                   `email_subject` varchar(255)  default NULL,
00025                   `email_body` text,
00026                   `template_instructions` text,
00027                   PRIMARY KEY  (`template_id`),
00028                   UNIQUE KEY `template_name` (`template_name`)
00029                 ) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
00030                 
00031                 $sql[] = "CREATE TABLE IF NOT EXISTS `xataface__email_jobs` (
00032                         job_id int(11) not null auto_increment primary key,
00033                         email_id int(11),
00034                         email_table varchar(255),
00035                         join_table varchar(255),
00036                         recipients_table varchar(255),
00037                         email_column varchar(255),
00038                         active tinyint(1) default 0,
00039                         complete tinyint(1) default 0,
00040                         total_emails int(11) default 0,
00041                         sent_emails int(11) default 0,
00042                         successful_emails int(11) default 0,
00043                         failed_emails int(11) default 0,
00044                         blacklisted_emails int(11) default 0,
00045                         start_time int(11) default 0,
00046                         end_time int(11) default 0,
00047                         unique key (email_id)
00048                 )";
00049                 foreach ($sql as $q){
00050                         try {
00051                                 df_q($q);
00052                         } catch (Exception $ex){}
00053                 }
00054                 //df_q($sql);
00055                 df_clear_views();
00056                 df_clear_cache();
00057                 
00058 
00059         }
00060         
00061         function update_1004(){
00062         
00063         
00064                 $sql[] = "create table if not exists `xataface__email_log` (
00065                         `log_id` int(11) not null auto_increment primary key,
00066                         `messageid` int(11) not null,
00067                         `recipient_email` varchar(128) not null,
00068                         `sent` tinyint(1) default 0,
00069                         `date_created` datetime default null,
00070                         `date_sent` datetime default null,
00071                         `success` tinyint(1) default null,
00072                         `comment` varchar(255) default null,
00073                         key (`messageid`))";
00074                         
00075                 try {
00076                         df_q($sql);
00077                 } catch (Exception $ex){}
00078                 df_clear_views();
00079                 df_clear_cache();
00080         }
00081         
00082         function update_1005(){
00083         
00084         
00085                 $sql[] = "alter table xataface__email_log add primary_key varchar(255) after recipient_email";
00086                         
00087                 try {
00088                         df_q($sql);
00089                 } catch (Exception $ex){}
00090                 df_clear_views();
00091                 df_clear_cache();
00092         }
00093         
00094         function update_1006(){
00095         
00096         
00097                 $sql[] = "alter table xataface__email_jobs add cancelled tinyint(1) default 0 after `active`";
00098                         
00099                 try {
00100                         df_q($sql);
00101                 } catch (Exception $ex){}
00102                 df_clear_views();
00103                 df_clear_cache();
00104         }
00105         
00106         function update_1007(){
00107         
00108         
00109                 $sql[] = "alter table xataface__email_templates add email_from varchar(255)  after `email_subject`";
00110                 $sql[] = "alter table xataface__email_templates add email_cc varchar(255)  after `email_from`";
00111                         
00112                 try {
00113                         df_q($sql);
00114                 } catch (Exception $ex){}
00115                 df_clear_views();
00116                 df_clear_cache();
00117         }
00118         
00119         function update_1008(){
00120         
00121         
00122                 $sql[] = "alter table xataface__email_log add uniqid varchar(255)  after `comment`";
00123                 $sql[] = "alter table xataface__email_log add key(`uniqid`)";   
00124                 try {
00125                         df_q($sql);
00126                 } catch (Exception $ex){}
00127                 df_clear_views();
00128                 df_clear_cache();
00129         }
00130         
00131         
00132 
00133 }
 All Data Structures Files Functions Variables Enumerations