| 1 |
<?php |
<?php |
| 2 |
// $Id: taxonomy_dss.install,v 1.8 2007/06/21 20:41:44 moonray Exp $ |
// $Id: taxonomy_dss.install,v 1.8.2.1 2008/01/23 20:38:50 moonray Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file taxonomy_dss.install |
* @file taxonomy_dss.install |
| 31 |
db_query("CREATE TABLE {taxonomy_dss_vocabulary} ( |
db_query("CREATE TABLE {taxonomy_dss_vocabulary} ( |
| 32 |
vid INT(10) UNSIGNED NOT NULL DEFAULT 0, |
vid INT(10) UNSIGNED NOT NULL DEFAULT 0, |
| 33 |
hidden TINYINT UNSIGNED NOT NULL DEFAULT 0, |
hidden TINYINT UNSIGNED NOT NULL DEFAULT 0, |
| 34 |
|
disabled TINYINT UNSIGNED NOT NULL DEFAULT 0, |
| 35 |
PRIMARY KEY (vid) |
PRIMARY KEY (vid) |
| 36 |
) /*!40100 DEFAULT CHARACTER SET utf8 */;"); |
) /*!40100 DEFAULT CHARACTER SET utf8 */;"); |
| 37 |
break; |
break; |
| 41 |
} |
} |
| 42 |
|
|
| 43 |
// let's make sure that there's an entry in {taxonomy_dss} for each existing entry in {vocabulary} |
// let's make sure that there's an entry in {taxonomy_dss} for each existing entry in {vocabulary} |
| 44 |
db_query("INSERT INTO {taxonomy_dss_vocabulary} (vid, hidden) |
db_query("INSERT INTO {taxonomy_dss_vocabulary} (vid, hidden, disabled) |
| 45 |
SELECT v.vid, 0 |
SELECT v.vid, 0, 0 |
| 46 |
FROM {vocabulary} v |
FROM {vocabulary} v |
| 47 |
LEFT JOIN {taxonomy_dss_vocabulary} g ON v.vid = g.vid |
LEFT JOIN {taxonomy_dss_vocabulary} g ON v.vid = g.vid |
| 48 |
WHERE ISNULL(g.vid)"); |
WHERE ISNULL(g.vid)"); |
| 49 |
|
|
|
// Insert taxonomy page type. |
|
|
$type = array( |
|
|
'type' => 'term', |
|
|
'name' => t('Term'), |
|
|
'module' => 'node', |
|
|
'description' => t('Special pages for taxonomy terms. Used by Taxonomy DSS module.'), |
|
|
'has_title' => FALSE, |
|
|
'custom' => FALSE, |
|
|
'modified' => TRUE, |
|
|
'locked' => TRUE, |
|
|
); |
|
|
|
|
|
$type = (object) _node_type_set_defaults($type); |
|
|
node_type_save($type); |
|
|
|
|
| 50 |
// Set node options |
// Set node options |
| 51 |
$node_options = array('status'); |
$node_options = array('status'); |
| 52 |
variable_set('node_options_term', $node_options); |
variable_set('node_options_termset', $node_options); |
| 53 |
} |
} |
| 54 |
|
|
| 55 |
/** |
/** |
| 58 |
function taxonomy_dss_uninstall() { |
function taxonomy_dss_uninstall() { |
| 59 |
db_query('DROP TABLE {taxonomy_dss_term}'); |
db_query('DROP TABLE {taxonomy_dss_term}'); |
| 60 |
db_query('DROP TABLE {taxonomy_dss_vocabulary}'); |
db_query('DROP TABLE {taxonomy_dss_vocabulary}'); |
| 61 |
variable_del('node_options_term'); |
variable_del('node_options_termset'); |
| 62 |
variable_del('taxonomy_dss_toc_hidden'); |
variable_del('taxonomy_dss_toc_hidden'); |
| 63 |
variable_del('taxonomy_dss_toc_depth'); |
variable_del('taxonomy_dss_toc_depth'); |
| 64 |
variable_del('taxonomy_dss_toc_nodecount'); |
variable_del('taxonomy_dss_toc_nodecount'); |
| 193 |
|
|
| 194 |
return $ret; |
return $ret; |
| 195 |
} |
} |
| 196 |
|
|
| 197 |
|
function taxonomy_dss_update_9() { |
| 198 |
|
$ret = array(); |
| 199 |
|
|
| 200 |
|
$node_options = array('status'); |
| 201 |
|
variable_set('node_options_termset', variable_get('node_options_termset', $node_options)); |
| 202 |
|
variable_del('node_options_term'); |
| 203 |
|
|
| 204 |
|
// Add disabled field |
| 205 |
|
$ret[] = update_sql("ALTER TABLE {taxonomy_dss_vocabulary} ADD COLUMN disabled TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER hidden;"); |
| 206 |
|
|
| 207 |
|
return $ret; |
| 208 |
|
} |