| 1 |
<?php
|
| 2 |
//$Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function flag_friend_install() {
|
| 8 |
drupal_set_message(t('Beginning installation of the flag_friend Module.'));
|
| 9 |
switch($GLOBALS['db_type']) {
|
| 10 |
case 'mysql': // use same as mysqli
|
| 11 |
case 'mysqli':
|
| 12 |
db_query("CREATE TABLE IF NOT EXISTS {flag_friend} (
|
| 13 |
uid int(10) unsigned NOT NULL,
|
| 14 |
friend_uid int(10) unsigned NOT NULL,
|
| 15 |
created int(11) default NULL,
|
| 16 |
PRIMARY KEY(uid, friend_uid)
|
| 17 |
) /*!40100 DEFAULT CHARACTER SET utf8 */;");
|
| 18 |
|
| 19 |
db_query("CREATE TABLE IF NOT EXISTS {flag_friend_message} (
|
| 20 |
fcid smallint unsigned NOT NULL default '0',
|
| 21 |
message text NOT NULL,
|
| 22 |
PRIMARY KEY(fcid)
|
| 23 |
) /*!40100 DEFAULT CHARACTER SET utf8 */;");
|
| 24 |
|
| 25 |
$success = TRUE;
|
| 26 |
break;
|
| 27 |
}
|
| 28 |
if ($success) {
|
| 29 |
drupal_set_message(t('The flag_friend module installed its tables successfully.'));
|
| 30 |
}
|
| 31 |
else {
|
| 32 |
drupal_set_message(t('The installation of the flag_friend module got borked, yo.'), 'error');
|
| 33 |
}
|
| 34 |
}
|
| 35 |
|
| 36 |
/**
|
| 37 |
* Implementation of hook_uninstall().
|
| 38 |
*/
|
| 39 |
function flag_friend_uninstall() {
|
| 40 |
db_query("DROP TABLE {flag_friend}");
|
| 41 |
db_query("DROP TABLE {flag_friend_message}");
|
| 42 |
drupal_set_message(t('flag_friend module successfully uninstalled.'));
|
| 43 |
}
|