| 1 |
<?php
|
| 2 |
/**
|
| 3 |
*$Id:
|
| 4 |
*@package Custom
|
| 5 |
*/
|
| 6 |
|
| 7 |
/**
|
| 8 |
* Implementation of hook_install().
|
| 9 |
*/
|
| 10 |
function account_expiry_install() {
|
| 11 |
switch ($GLOBALS['db_type']) {
|
| 12 |
case 'mysql':
|
| 13 |
case 'mysqli':
|
| 14 |
$query = db_query("CREATE TABLE {account_expiry} (
|
| 15 |
uid int(10) unsigned NOT NULL default '0',
|
| 16 |
expiry_date int(10) unsigned NOT NULL default '0',
|
| 17 |
PRIMARY KEY (uid)
|
| 18 |
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
|
| 19 |
break;
|
| 20 |
case 'pgsql':
|
| 21 |
$query = db_query("CREATE TABLE {account_expiry} (
|
| 22 |
uid int NOT NULL default '0',
|
| 23 |
expiry_date int NOT NULL default '0',
|
| 24 |
PRIMARY KEY (uid)
|
| 25 |
)");
|
| 26 |
break;
|
| 27 |
}
|
| 28 |
}
|
| 29 |
|
| 30 |
/**
|
| 31 |
* Implementation of hook_uninstall().
|
| 32 |
*/
|
| 33 |
function account_expiry_uninstall() {
|
| 34 |
$query = db_query('DROP TABLE {account_expiry}');
|
| 35 |
|
| 36 |
if ($query) {
|
| 37 |
drupal_set_message('The Account Expiry module was uninstalled successfully.');
|
| 38 |
}
|
| 39 |
else {
|
| 40 |
drupal_set_message('There was an error removing the Account Expiry database tables.', 'error');
|
| 41 |
}
|
| 42 |
}
|