/[drupal]/contributions/modules/taxonomy_dss/taxonomy_dss.install
ViewVC logotype

Contents of /contributions/modules/taxonomy_dss/taxonomy_dss.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.8 - (show annotations) (download) (as text)
Thu Jun 21 20:41:44 2007 UTC (2 years, 5 months ago) by moonray
Branch: MAIN
CVS Tags: DRUPAL-5--1-0, HEAD
Branch point for: DRUPAL-5
Changes since 1.7: +12 -1 lines
File MIME type: text/x-php
Added functionality for hook_taxonomy_dss().
1 <?php
2 // $Id: taxonomy_dss.install,v 1.7 2007/04/05 21:57:46 moonray Exp $
3
4 /**
5 * @file taxonomy_dss.install
6 *
7 * Install and update hooks for taxonomy_dss module
8 */
9
10 /**
11 * Implementation of hook_install()
12 */
13 function taxonomy_dss_install() {
14 switch ($GLOBALS['db_type']) {
15 case 'mysql':
16 case 'mysqli':
17 db_query("CREATE TABLE {taxonomy_dss_term} (
18 tid VARCHAR(32) NOT NULL DEFAULT '',
19 nid INT(10) UNSIGNED NOT NULL DEFAULT 0,
20 hidden TINYINT UNSIGNED NOT NULL DEFAULT 0,
21 toc_hidden TINYINT UNSIGNED NOT NULL DEFAULT 0,
22 toc_depth TINYINT NOT NULL DEFAULT -1,
23 toc_nodecount TINYINT UNSIGNED NOT NULL DEFAULT 1,
24 lst_hidden TINYINT UNSIGNED NOT NULL DEFAULT 0,
25 lst_teasers_hidden TINYINT UNSIGNED NOT NULL DEFAULT 0,
26 serialized_data TEXT NULL DEFAULT NULL,
27 PRIMARY KEY (tid)
28 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
29
30 db_query("CREATE TABLE {taxonomy_dss_vocabulary} (
31 vid INT(10) UNSIGNED NOT NULL DEFAULT 0,
32 hidden TINYINT UNSIGNED NOT NULL DEFAULT 0,
33 PRIMARY KEY (vid)
34 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
35 break;
36
37 case 'pgsql':
38 break;
39 }
40
41 // let's make sure that there's an entry in {taxonomy_dss} for each existing entry in {vocabulary}
42 db_query("INSERT INTO {taxonomy_dss_vocabulary} (vid, hidden)
43 SELECT v.vid, 0
44 FROM {vocabulary} v
45 LEFT JOIN {taxonomy_dss_vocabulary} g ON v.vid = g.vid
46 WHERE ISNULL(g.vid)");
47
48 // Insert taxonomy page type.
49 $type = array(
50 'type' => 'term',
51 'name' => t('Term'),
52 'module' => 'node',
53 'description' => t('Special pages for taxonomy terms. Used by Taxonomy Groups module.'),
54 'has_title' => FALSE,
55 'custom' => FALSE,
56 'modified' => TRUE,
57 'locked' => TRUE,
58 );
59
60 $type = (object) _node_type_set_defaults($type);
61 node_type_save($type);
62
63 // Set node options
64 $node_options = array('status');
65 variable_set('node_options_term', $node_options);
66 }
67
68 /**
69 * Implementation of hook_uninstall()
70 */
71 function taxonomy_dss_uninstall() {
72 db_query('DROP TABLE {taxonomy_dss_term}');
73 db_query('DROP TABLE {taxonomy_dss_vocabulary}');
74 variable_del('node_options_term');
75 variable_del('taxonomy_dss_toc_hidden');
76 variable_del('taxonomy_dss_toc_depth');
77 variable_del('taxonomy_dss_toc_nodecount');
78 variable_del('taxonomy_dss_lst_hidden');
79 variable_del('taxonomy_dss_lst_teasers_hidden');
80 node_type_delete('term');
81 }
82
83 function taxonomy_dss_update_1() {
84 $ret = array();
85
86 // Insert taxonomy page type.
87 $type = array(
88 'type' => 'term',
89 'name' => t('Term'),
90 'module' => 'node',
91 'description' => t('Special pages for taxonomy terms. Used by Taxonomy Groups module.'),
92 'custom' => TRUE,
93 'has_title' => FALSE,
94 'modified' => TRUE,
95 'locked' => TRUE,
96 );
97
98 $type = (object) _node_type_set_defaults($type);
99 node_type_save($type);
100
101 return $ret;
102 }
103
104 function taxonomy_dss_update_2() {
105 $ret = array();
106
107 // Set node options
108 $node_options = array('status');
109 variable_set('node_options_term', $node_options);
110
111 return $ret;
112 }
113
114 function taxonomy_dss_update_3() {
115 $ret = array();
116
117 // Set node options
118 $ret[] = update_sql("ALTER TABLE {taxonomy_dss_term}
119 ADD COLUMN toc_hidden TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER nid,
120 ADD COLUMN toc_depth TINYINT NOT NULL DEFAULT -1 AFTER toc_hidden,
121 ADD COLUMN toc_nodecount TINYINT UNSIGNED NOT NULL DEFAULT 1 AFTER toc_depth;");
122
123 return $ret;
124 }
125
126 function taxonomy_dss_update_4() {
127 $ret = array();
128
129 // Set node options
130 $ret[] = update_sql("ALTER TABLE {taxonomy_dss_term}
131 ADD COLUMN lst_teasers_hidden TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER toc_nodecount;");
132
133 return $ret;
134 }
135
136 function taxonomy_dss_update_5() {
137 $ret = array();
138
139 // Set node options
140 $ret[] = update_sql("ALTER TABLE {taxonomy_dss_term}
141 ADD COLUMN lst_hidden TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER toc_nodecount;");
142
143 return $ret;
144 }
145
146 function taxonomy_dss_update_6() {
147 $ret = array();
148
149 // Set node options
150 $ret[] = update_sql("ALTER TABLE {taxonomy_dss_term}
151 ADD COLUMN hidden TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER toc_nodecount;");
152
153 return $ret;
154 }
155
156 function taxonomy_dss_update_7() {
157 $ret = array();
158
159 // Set node options
160 $ret[] = update_sql("ALTER TABLE {taxonomy_dss_term}
161 ADD COLUMN serialized_data TEXT NULL DEFAULT NULL AFTER lst_teasers_hidden;");
162
163 return $ret;
164 }

  ViewVC Help
Powered by ViewVC 1.1.2