| 1 |
<?php
|
| 2 |
// $Id: community_tags.install,v 1.7.2.2 2007/08/01 22:38:49 unconed Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* The install file for the community_tags module.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_install().
|
| 11 |
*/
|
| 12 |
function community_tags_install() {
|
| 13 |
// Install schema
|
| 14 |
drupal_install_schema('community_tags');
|
| 15 |
|
| 16 |
// Drop module weight so we act after taxonomy.
|
| 17 |
$weight = (int)db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'"));
|
| 18 |
db_query("UPDATE {system} SET weight = %d WHERE name = 'community_tags'", $weight + 1);
|
| 19 |
}
|
| 20 |
|
| 21 |
/**
|
| 22 |
* Implementation of hook_uninstall().
|
| 23 |
*/
|
| 24 |
function community_tags_uninstall() {
|
| 25 |
drupal_uninstall_schema('community_tags');
|
| 26 |
}
|
| 27 |
|
| 28 |
/**
|
| 29 |
* Implementation of hook_schema().
|
| 30 |
*/
|
| 31 |
function community_tags_schema() {
|
| 32 |
$schema['community_tags'] = array(
|
| 33 |
'fields' => array(
|
| 34 |
'tid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
| 35 |
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
| 36 |
'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
| 37 |
'date' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
| 38 |
),
|
| 39 |
'indexes' => array(
|
| 40 |
'tid' => array('tid'),
|
| 41 |
'nid' => array('nid'),
|
| 42 |
'uid' => array('uid'),
|
| 43 |
),
|
| 44 |
'primary key' => array('tid', 'uid', 'nid'),
|
| 45 |
);
|
| 46 |
return $schema;
|
| 47 |
}
|
| 48 |
|
| 49 |
/**
|
| 50 |
* Update: Add tid column key.
|
| 51 |
*/
|
| 52 |
function community_tags_update_1() {
|
| 53 |
$ret = array();
|
| 54 |
db_add_index($ret, 'community_tags', 'tid', array('tid'));
|
| 55 |
community_tags_rehash(TRUE);
|
| 56 |
return $ret;
|
| 57 |
}
|
| 58 |
|
| 59 |
/**
|
| 60 |
* Implementation of hook_enable().
|
| 61 |
*/
|
| 62 |
function community_tags_enable() {
|
| 63 |
community_tags_rehash();
|
| 64 |
}
|