| 1 |
<?php |
<?php |
| 2 |
// $Id: comment_alter_taxonomy.install,v 1.2 2008/11/14 12:18:28 aclight Exp $ |
// $Id: comment_alter_taxonomy.install,v 1.3 2009/01/04 22:02:31 damz Exp $ |
| 3 |
|
|
| 4 |
|
/** |
| 5 |
|
* @file |
| 6 |
|
* Installation functions for comment_alter_taxonomy. |
| 7 |
|
*/ |
| 8 |
|
|
| 9 |
function comment_alter_taxonomy_install() { |
function comment_alter_taxonomy_install() { |
| 10 |
// TODO: add an index on nid,cid |
// Create the database tables. |
| 11 |
switch ($GLOBALS['db_type']) { |
drupal_install_schema('comment_alter_taxonomy'); |
|
case 'mysql': |
|
|
case 'mysqli': |
|
|
db_query("CREATE TABLE {comment_alter_taxonomy} ( |
|
|
nid int(10) unsigned NOT NULL default '0', |
|
|
cid int(10) unsigned NOT NULL default '0', |
|
|
tid int(10) unsigned NOT NULL default '0', |
|
|
PRIMARY KEY (nid,cid,tid) |
|
|
);"); |
|
|
break; |
|
|
case 'pgsql': |
|
|
db_query("CREATE TABLE {comment_alter_taxonomy} ( |
|
|
nid int NOT NULL default '0', |
|
|
cid int NOT NULL default '0', |
|
|
tid int NOT NULL default '0', |
|
|
PRIMARY KEY (nid,cid,tid) |
|
|
);"); |
|
|
db_query('CREATE INDEX {comment_alter_taxonomy}_nid_cid_idx ON {comment_alter_taxonomy} (nid, cid)'); |
|
|
break; |
|
|
} |
|
| 12 |
|
|
| 13 |
// Set weight of comment_alter_taxonomy module to be heavier than taxonomy module. |
// Set weight of comment_alter_taxonomy module to be heavier than taxonomy module. |
| 14 |
db_query("UPDATE {system} SET weight = 1 WHERE name = 'comment_alter_taxonomy'"); |
db_query("UPDATE {system} SET weight = 1 WHERE name = 'comment_alter_taxonomy'"); |
| 18 |
* Implementation of hook_uninstall(). |
* Implementation of hook_uninstall(). |
| 19 |
*/ |
*/ |
| 20 |
function comment_alter_taxonomy_uninstall() { |
function comment_alter_taxonomy_uninstall() { |
| 21 |
if (db_table_exists('comment_alter_taxonomy')) { |
// Remove the database tables. |
| 22 |
db_query("DROP TABLE {comment_alter_taxonomy}"); |
drupal_uninstall_schema('comment_alter_taxonomy'); |
|
} |
|
| 23 |
|
|
| 24 |
// Delete settings variables. |
// Delete settings variables. |
| 25 |
variable_del('comment_alter_taxonomy_vocabularies'); |
variable_del('comment_alter_taxonomy_vocabularies'); |
| 26 |
} |
} |
| 27 |
|
|
| 28 |
|
/** |
| 29 |
|
* Implementation of hook_schema(). |
| 30 |
|
*/ |
| 31 |
|
function comment_alter_taxonomy_schema() { |
| 32 |
|
$schema['comment_alter_taxonomy'] = array( |
| 33 |
|
'fields' => array( |
| 34 |
|
'nid' => array( |
| 35 |
|
'type' => 'int', |
| 36 |
|
'unsigned' => TRUE, |
| 37 |
|
'not null' => TRUE, |
| 38 |
|
'description' => 'The {node}.nid of the node.', |
| 39 |
|
), |
| 40 |
|
'cid' => array( |
| 41 |
|
'type' => 'int', |
| 42 |
|
'unsigned' => TRUE, |
| 43 |
|
'not null' => TRUE, |
| 44 |
|
'description' => 'The {comment}.cid of the comment.', |
| 45 |
|
), |
| 46 |
|
'tid' => array( |
| 47 |
|
'type' => 'int', |
| 48 |
|
'unsigned' => TRUE, |
| 49 |
|
'not null' => TRUE, |
| 50 |
|
'description' => 'The {term_data}.tid of a term.', |
| 51 |
|
), |
| 52 |
|
), |
| 53 |
|
'primary key' => array('nid', 'cid', 'tid'), |
| 54 |
|
); |
| 55 |
|
return $schema; |
| 56 |
|
} |
| 57 |
|
|