| 1 |
<?php
|
| 2 |
// $Id: smackdown.install,v 1.1 2007/09/23 00:40:47 sirkitree Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Install file for smackdown module.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_install().
|
| 11 |
*/
|
| 12 |
function smackdown_install() {
|
| 13 |
switch ($GLOBALS['db_type']) {
|
| 14 |
case 'mysql':
|
| 15 |
case 'mysqli':
|
| 16 |
db_query("
|
| 17 |
CREATE TABLE {smackdown} (
|
| 18 |
vid int(11) NOT NULL,
|
| 19 |
nid int(11) NOT NULL,
|
| 20 |
node_ref_1 int(11) NOT NULL,
|
| 21 |
node_ref_2 int(11) NOT NULL,
|
| 22 |
node_ref_type varchar(25) NOT NULL default ''
|
| 23 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
| 24 |
");
|
| 25 |
break;
|
| 26 |
case 'pgsql':
|
| 27 |
db_query("
|
| 28 |
CREATE TABLE {smackdown} (
|
| 29 |
vid int(11) NOT NULL,
|
| 30 |
nid int(11) NOT NULL,
|
| 31 |
node_ref_1 int(11) NOT NULL,
|
| 32 |
node_ref_2 int(11) NOT NULL,
|
| 33 |
node_ref_type varchar(25) NOT NULL default ''
|
| 34 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
| 35 |
");
|
| 36 |
break;
|
| 37 |
}
|
| 38 |
}
|
| 39 |
|
| 40 |
function activity_uninstall() {
|
| 41 |
if (db_table_exists('smackdown')) {
|
| 42 |
db_query("DROP TABLE {smackdown}");
|
| 43 |
}
|
| 44 |
// Delete any variables that have been set.
|
| 45 |
// We don't just DELETE FROM {variable}, even though we could.
|
| 46 |
$result = db_query("SELECT name FROM {variable} WHERE name LIKE 'smackdown_%'");
|
| 47 |
// Instead we use the API, because API's can change!
|
| 48 |
while ($row = db_fetch_object($result)) {
|
| 49 |
variable_del($row->name);
|
| 50 |
}
|
| 51 |
// Since smackdown stores it's results in votingapi, we should proly get rid of them too
|
| 52 |
db_query("DELETE FROM {votingapi_vote} WHERE tag = 'smackdown'");
|
| 53 |
}
|