| 1 |
<?php
|
| 2 |
|
| 3 |
$Id$
|
| 4 |
|
| 5 |
/**
|
| 6 |
* Install the database schema
|
| 7 |
*/
|
| 8 |
function autoresponder_install() {
|
| 9 |
variable_set('emails_sent', '0');
|
| 10 |
switch($GLOBALS['db_type']) {
|
| 11 |
case 'mysql':
|
| 12 |
case 'mysqli':
|
| 13 |
db_query("CREATE TABLE {autoresponder_users} (
|
| 14 |
id int(11) NOT NULL default '0',
|
| 15 |
email char(50) NOT NULL,
|
| 16 |
reg_date int(11) NOT NULL,
|
| 17 |
PRIMARY KEY (id)
|
| 18 |
);");
|
| 19 |
db_query("CREATE TABLE {autoresponder_messages} (
|
| 20 |
id int(11) NOT NULL default '0',
|
| 21 |
subject char(50) NOT NULL,
|
| 22 |
body text NOT NULL,
|
| 23 |
day int(11) default NULL,
|
| 24 |
mset int(11) default NULL,
|
| 25 |
PRIMARY KEY (id)
|
| 26 |
);");
|
| 27 |
db_query("CREATE TABLE {autoresponder_sets} (
|
| 28 |
id int(11) NOT NULL default '0',
|
| 29 |
name char(50) NOT NULL,
|
| 30 |
active bool NOT NULL,
|
| 31 |
PRIMARY KEY (id)
|
| 32 |
);");
|
| 33 |
db_query("CREATE TABLE {autoresponder} (
|
| 34 |
id int(11) NOT NULL default '0',
|
| 35 |
uid int(11) NOT NULL,
|
| 36 |
setid int(11) NOT NULL,
|
| 37 |
PRIMARY KEY (id)
|
| 38 |
);");
|
| 39 |
drupal_set_message(t("The database schema for the autoresponder module was created."));
|
| 40 |
break;
|
| 41 |
}
|
| 42 |
}
|
| 43 |
|
| 44 |
/**
|
| 45 |
* Uninstall the database schema
|
| 46 |
*/
|
| 47 |
function autoresponder_uninstall() {
|
| 48 |
variable_del('emails_sent');
|
| 49 |
switch($GLOBALS['db_type']) {
|
| 50 |
case 'mysql':
|
| 51 |
case 'mysqli':
|
| 52 |
db_query("DROP TABLE {autoresponder_users}");
|
| 53 |
db_query("DROP TABLE {autoresponder_messages}");
|
| 54 |
db_query("DROP TABLE {autoresponder_sets}");
|
| 55 |
db_query("DROP TABLE {autoresponder}");
|
| 56 |
drupal_set_message(t("Autoresponder module successfully uninstalled."));
|
| 57 |
break;
|
| 58 |
}
|
| 59 |
}
|
| 60 |
?>
|