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

Contents of /contributions/modules/similarterms/similarterms.install

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


Revision 1.6 - (show annotations) (download) (as text)
Wed Jan 28 18:15:48 2009 UTC (9 months, 3 weeks ago) by rmiddle
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +2 -1 lines
File MIME type: text/x-php
Make the  field actually work.  Thanks to derjochenmeyer [#365617]
1 <?php
2 // $Id: similarterms.install,v 1.5 2009/01/27 02:18:36 rmiddle Exp $
3
4 /**
5 * @file
6 * Similar By Terms install file
7 */
8
9 /**
10 * Implementation of hook_install().
11 */
12 function similarterms_install() {
13 $result = drupal_install_schema('similarterms');
14
15 if (count($result) > 0) {
16 drupal_set_message(t('similarterms module installed.'));
17 }
18 else {
19 drupal_set_message(t('similarterms table creation failed. Please "uninstall" the module and retry.'));
20 }
21 }
22
23 /**
24 * Implementation of hook_schema().
25 */
26 function similarterms_schema() {
27 $schema['cache_similarterms'] = array(
28 'module' => 'similarterms',
29 'description' => t('Cache table for the Similar by Terms Module.'),
30 'fields' => array(
31 'cid' => array(
32 'description' => t('Primary Key: Unique cache ID.'),
33 'type' => 'varchar',
34 'length' => 255,
35 'not null' => TRUE,
36 'default' => ''),
37 'data' => array(
38 'description' => t('A collection of data to cache.'),
39 'type' => 'blob',
40 'not null' => FALSE,
41 'size' => 'big'),
42 'expire' => array(
43 'description' => t('A Unix timestamp indicating when the cache entry should expire, or 0 for never.'),
44 'type' => 'int',
45 'not null' => TRUE,
46 'default' => 0),
47 'created' => array(
48 'description' => t('A Unix timestamp indicating when the cache entry was created.'),
49 'type' => 'int',
50 'not null' => TRUE,
51 'default' => 0),
52 'headers' => array(
53 'description' => t('Any custom HTTP headers to be added to cached data.'),
54 'type' => 'text',
55 'not null' => FALSE),
56 'serialized' => array(
57 'description' => t('A flag to indicate whether content is serialized (1) or not (0).'),
58 'type' => 'int',
59 'size' => 'small',
60 'not null' => TRUE,
61 'default' => 0)
62 ),
63 'indexes' => array('expire' => array('expire')),
64 'primary key' => array('cid'),
65 );
66 $schema['similarterms_override'] = array(
67 'module' => 'similarterms',
68 'description' => 'Override information for the similarterms blocks implemented as node type.',
69 'fields' => array(
70 'nid' => array(
71 'description' => 'Node identifier',
72 'type' => 'int',
73 'unsigned' => TRUE,
74 'not null' => TRUE,
75 'default' => 0,
76 ),
77 'vid' => array(
78 'description' => 'Version identifier',
79 'type' => 'int',
80 'unsigned' => TRUE,
81 'not null' => TRUE,
82 'default' => 0,
83 ),
84 'path' => array(
85 'description' => 'Node Id to point to of overide',
86 'type' => 'int',
87 'not null' => TRUE,
88 'default' => 0,
89 'size' => 'tiny',
90 ),
91 'weight' => array(
92 'description' => 'Node weight',
93 'type' => 'int',
94 'not null' => TRUE,
95 'default' => 0,
96 'size' => 'tiny',
97 ),
98 ),
99 'indexes' => array(
100 'nid' => array('nid'),
101 'vid' => array('vid'),
102 ),
103 );
104 return $schema;
105 }
106
107 /**
108 * Implementation of hook_uninstall().
109 */
110 function similarterms_uninstall() {
111 // Get the variables that have a tid at the end.
112 // @@@ I'm not crazy about this, but it works.
113 $result = db_query("SELECT v.name FROM {variable} v WHERE v.name LIKE ('simterms_%') OR v.name LIKE ('similarterms_%')");
114 while ($name = db_result($result)) {
115 variable_del($name);
116 }
117 drupal_uninstall_schema('similarterms');
118 drupal_set_message(t('similarterms module uninstalled.'));
119 }
120
121 /**
122 * Implementation of hook_update().
123 */
124 function similarterms_update_6102() {
125 $schema['cache_similarterms'] = array(
126 'module' => 'similarterms',
127 'description' => t('Cache table for the Similar by Terms Module.'),
128 'fields' => array(
129 'cid' => array(
130 'description' => t('Primary Key: Unique cache ID.'),
131 'type' => 'varchar',
132 'length' => 255,
133 'not null' => TRUE,
134 'default' => ''),
135 'data' => array(
136 'description' => t('A collection of data to cache.'),
137 'type' => 'blob',
138 'not null' => FALSE,
139 'size' => 'big'),
140 'expire' => array(
141 'description' => t('A Unix timestamp indicating when the cache entry should expire, or 0 for never.'),
142 'type' => 'int',
143 'not null' => TRUE,
144 'default' => 0),
145 'created' => array(
146 'description' => t('A Unix timestamp indicating when the cache entry was created.'),
147 'type' => 'int',
148 'not null' => TRUE,
149 'default' => 0),
150 'headers' => array(
151 'description' => t('Any custom HTTP headers to be added to cached data.'),
152 'type' => 'text',
153 'not null' => FALSE),
154 'serialized' => array(
155 'description' => t('A flag to indicate whether content is serialized (1) or not (0).'),
156 'type' => 'int',
157 'size' => 'small',
158 'not null' => TRUE,
159 'default' => 0)
160 ),
161 'indexes' => array('expire' => array('expire')),
162 'primary key' => array('cid'),
163 );
164 $schema['similarterms_override'] = array(
165 'module' => 'similarterms',
166 'description' => 'Override information for the similarterms blocks implemented as node type.',
167 'fields' => array(
168 'nid' => array(
169 'description' => 'Node identifier',
170 'type' => 'int',
171 'unsigned' => TRUE,
172 'not null' => TRUE,
173 'default' => 0,
174 ),
175 'vid' => array(
176 'description' => 'Version identifier',
177 'type' => 'int',
178 'unsigned' => TRUE,
179 'not null' => TRUE,
180 'default' => 0,
181 ),
182 'path' => array(
183 'description' => 'Node Id to point to of overide',
184 'type' => 'int',
185 'not null' => TRUE,
186 'default' => 0,
187 'size' => 'tiny',
188 ),
189 'weight' => array(
190 'description' => 'Node weight',
191 'type' => 'int',
192 'not null' => TRUE,
193 'default' => 0,
194 'size' => 'tiny',
195 ),
196 ),
197 'indexes' => array(
198 'nid' => array('nid'),
199 'vid' => array('vid'),
200 ),
201 );
202 $ret = array();
203 db_create_table($ret, 'cache_similarterms', $schema['cache_similarterms']);
204 db_create_table($ret, 'similarterms_override', $schema['similarterms_override']);
205 return $ret;
206 }
207
208 /**
209 * Implementation of hook_update().
210 */
211 function similarterms_update_6101() {
212 $ret = array();
213 cache_clear_all('*', 'cache_block', TRUE);
214 $ret = array( array('success' => TRUE, 'query' => t('Successful Cleared the Block Cache.') );
215 return $ret;
216 }

  ViewVC Help
Powered by ViewVC 1.1.2