| 1 |
<?php
|
| 2 |
// $Id: annotate_ed.install,v 1.1.2.1 2007/12/07 08:51:46 clemenstolboom Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install()
|
| 6 |
*/
|
| 7 |
function annotate_ed_install() {
|
| 8 |
drupal_set_message(t('Beginning installation of editorial annotation module.'));
|
| 9 |
|
| 10 |
switch ($GLOBALS['db_type']) {
|
| 11 |
case 'mysql':
|
| 12 |
case 'mysqli':
|
| 13 |
db_query("CREATE TABLE {annotate_ed} (
|
| 14 |
nid int NOT NULL default 0,
|
| 15 |
note longtext NOT NULL,
|
| 16 |
locked int NOT NULL default 0,
|
| 17 |
timestamp int NOT NULL default 0,
|
| 18 |
PRIMARY KEY (nid)
|
| 19 |
) /*!40100 DEFAULT CHARACTER SET utf8 */;"
|
| 20 |
);
|
| 21 |
$success = TRUE;
|
| 22 |
break;
|
| 23 |
case 'pgsql':
|
| 24 |
db_query("CREATE TABLE {annotate_ed} (
|
| 25 |
nid int NOT NULL DEFAULT 0,
|
| 26 |
note text NOT NULL,
|
| 27 |
locked int NOT NULL default 0,
|
| 28 |
timestamp int NOT NULL DEFAULT 0,
|
| 29 |
PRIMARY KEY (nid)
|
| 30 |
);"
|
| 31 |
);
|
| 32 |
$success = TRUE;
|
| 33 |
break;
|
| 34 |
default:
|
| 35 |
drupal_set_message( t('Unsupported database.'));
|
| 36 |
}
|
| 37 |
|
| 38 |
if ($success) {
|
| 39 |
drupal_set_message( t('Congratulations! The installation of
|
| 40 |
the editorial annotation module and database tables were successful.'));
|
| 41 |
}
|
| 42 |
else {
|
| 43 |
drupal_set_message( t('The installation of the editorial annotation module
|
| 44 |
and database tables were unsuccessful.'),'error');
|
| 45 |
}
|
| 46 |
}
|
| 47 |
|
| 48 |
/**
|
| 49 |
* Implementation of hook_uninstall()
|
| 50 |
*/
|
| 51 |
|
| 52 |
function annotate_ed_uninstall() {
|
| 53 |
db_query("DROP TABLE {annotate_ed}");
|
| 54 |
|
| 55 |
variable_del('annotate_ed_nodetypes');
|
| 56 |
variable_del('annotate_ed_format');
|
| 57 |
}
|