1
|
<?php
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
db_create_table('forum', array(
|
8
|
'fields' => array(
|
9
|
'nid' => array(
|
10
|
'type' => 'int',
|
11
|
'unsigned' => TRUE,
|
12
|
'not null' => TRUE,
|
13
|
'default' => 0,
|
14
|
),
|
15
|
'vid' => array(
|
16
|
'type' => 'int',
|
17
|
'unsigned' => TRUE,
|
18
|
'not null' => TRUE,
|
19
|
'default' => 0,
|
20
|
),
|
21
|
'tid' => array(
|
22
|
'type' => 'int',
|
23
|
'unsigned' => TRUE,
|
24
|
'not null' => TRUE,
|
25
|
'default' => 0,
|
26
|
),
|
27
|
),
|
28
|
'indexes' => array(
|
29
|
'nid' => array(
|
30
|
'nid',
|
31
|
),
|
32
|
'tid' => array(
|
33
|
'tid',
|
34
|
),
|
35
|
),
|
36
|
'primary key' => array(
|
37
|
'vid',
|
38
|
),
|
39
|
'module' => 'forum',
|
40
|
'name' => 'forum',
|
41
|
));
|
42
|
db_insert('forum')->fields(array(
|
43
|
'nid',
|
44
|
'vid',
|
45
|
'tid',
|
46
|
))
|
47
|
->values(array(
|
48
|
'nid' => '51',
|
49
|
'vid' => '61',
|
50
|
'tid' => '81',
|
51
|
))
|
52
|
->execute();
|
53
|
|
54
|
db_insert('node')->fields(array(
|
55
|
'nid',
|
56
|
'vid',
|
57
|
'type',
|
58
|
'language',
|
59
|
'title',
|
60
|
'uid',
|
61
|
'status',
|
62
|
'created',
|
63
|
'changed',
|
64
|
'comment',
|
65
|
'promote',
|
66
|
'moderate',
|
67
|
'sticky',
|
68
|
'tnid',
|
69
|
'translate',
|
70
|
))
|
71
|
->values(array(
|
72
|
'nid' => '51',
|
73
|
'vid' => '61',
|
74
|
'type' => 'forum',
|
75
|
'language' => '',
|
76
|
'title' => 'Apples',
|
77
|
'uid' => '1',
|
78
|
'status' => '1',
|
79
|
'created' => '1298363952',
|
80
|
'changed' => '1298363952',
|
81
|
'comment' => '2',
|
82
|
'promote' => '0',
|
83
|
'moderate' => '0',
|
84
|
'sticky' => '0',
|
85
|
'tnid' => '0',
|
86
|
'translate' => '0',
|
87
|
))
|
88
|
->execute();
|
89
|
|
90
|
db_insert('node_revisions')->fields(array(
|
91
|
'nid',
|
92
|
'vid',
|
93
|
'uid',
|
94
|
'title',
|
95
|
'body',
|
96
|
'teaser',
|
97
|
'log',
|
98
|
'timestamp',
|
99
|
'format',
|
100
|
))
|
101
|
->values(array(
|
102
|
'nid' => '51',
|
103
|
'vid' => '61',
|
104
|
'uid' => '1',
|
105
|
'title' => 'Apples',
|
106
|
'body' => 'A fruit.',
|
107
|
'teaser' => 'A fruit.',
|
108
|
'log' => '',
|
109
|
'timestamp' => '1298363952',
|
110
|
'format' => '1',
|
111
|
))
|
112
|
->execute();
|
113
|
|
114
|
db_insert('node_comment_statistics')->fields(array(
|
115
|
'nid',
|
116
|
'last_comment_timestamp',
|
117
|
'last_comment_name',
|
118
|
'last_comment_uid',
|
119
|
'comment_count',
|
120
|
))
|
121
|
->values(array(
|
122
|
'nid' => '51',
|
123
|
'last_comment_timestamp' => '1298363952',
|
124
|
'last_comment_name' => NULL,
|
125
|
'last_comment_uid' => '1',
|
126
|
'comment_count' => '0',
|
127
|
))
|
128
|
->execute();
|
129
|
|
130
|
db_insert('node_type')->fields(array(
|
131
|
'type',
|
132
|
'name',
|
133
|
'module',
|
134
|
'description',
|
135
|
'help',
|
136
|
'has_title',
|
137
|
'title_label',
|
138
|
'has_body',
|
139
|
'body_label',
|
140
|
'min_word_count',
|
141
|
'custom',
|
142
|
'modified',
|
143
|
'locked',
|
144
|
'orig_type',
|
145
|
))
|
146
|
->values(array(
|
147
|
'type' => 'forum',
|
148
|
'name' => 'Forum topic',
|
149
|
'module' => 'forum',
|
150
|
'description' => 'A <em>forum topic</em> is the initial post to a new discussion thread within a forum.',
|
151
|
'help' => '',
|
152
|
'has_title' => '1',
|
153
|
'title_label' => 'Subject',
|
154
|
'has_body' => '1',
|
155
|
'body_label' => 'Body',
|
156
|
'min_word_count' => '0',
|
157
|
'custom' => '0',
|
158
|
'modified' => '0',
|
159
|
'locked' => '1',
|
160
|
'orig_type' => 'forum',
|
161
|
))
|
162
|
->execute();
|
163
|
|
164
|
db_update('system')->fields(array(
|
165
|
'schema_version' => '6000',
|
166
|
'status' => '1',
|
167
|
))
|
168
|
->condition('filename', 'modules/forum/forum.module')
|
169
|
->execute();
|
170
|
|
171
|
db_insert('term_data')->fields(array(
|
172
|
'tid',
|
173
|
'vid',
|
174
|
'name',
|
175
|
'description',
|
176
|
'weight',
|
177
|
))
|
178
|
->values(array(
|
179
|
'tid' => '81',
|
180
|
'vid' => '101',
|
181
|
'name' => 'Fruits',
|
182
|
'description' => 'Fruits.',
|
183
|
'weight' => '0',
|
184
|
))
|
185
|
->execute();
|
186
|
|
187
|
db_insert('term_hierarchy')->fields(array(
|
188
|
'tid',
|
189
|
'parent',
|
190
|
))
|
191
|
->values(array(
|
192
|
'tid' => '81',
|
193
|
'parent' => '0',
|
194
|
))
|
195
|
->execute();
|
196
|
|
197
|
db_insert('term_node')->fields(array(
|
198
|
'nid',
|
199
|
'vid',
|
200
|
'tid',
|
201
|
))
|
202
|
->values(array(
|
203
|
'nid' => '51',
|
204
|
'vid' => '61',
|
205
|
'tid' => '81',
|
206
|
))
|
207
|
->execute();
|
208
|
|
209
|
db_insert('variable')->fields(array(
|
210
|
'name',
|
211
|
'value',
|
212
|
))
|
213
|
->values(array(
|
214
|
'name' => 'forum_nav_vocabulary',
|
215
|
'value' => 's:3:"101";',
|
216
|
))
|
217
|
->values(array(
|
218
|
'name' => 'forum_containers',
|
219
|
'value' => 'a:1:{i:0;s:3:"101";}',
|
220
|
))
|
221
|
->execute();
|
222
|
|
223
|
db_insert('vocabulary')->fields(array(
|
224
|
'vid',
|
225
|
'name',
|
226
|
'description',
|
227
|
'help',
|
228
|
'relations',
|
229
|
'hierarchy',
|
230
|
'multiple',
|
231
|
'required',
|
232
|
'tags',
|
233
|
'module',
|
234
|
'weight',
|
235
|
))
|
236
|
->values(array(
|
237
|
'vid' => '101',
|
238
|
'name' => 'Upgrade test for forums',
|
239
|
'description' => 'Vocabulary used for Forums. The name is changed from the default "Forums" so that the upgrade path may be tested.',
|
240
|
'help' => '',
|
241
|
'relations' => '1',
|
242
|
'hierarchy' => '1',
|
243
|
'multiple' => '0',
|
244
|
'required' => '0',
|
245
|
'tags' => '0',
|
246
|
'module' => 'forum',
|
247
|
'weight' => '-10',
|
248
|
))
|
249
|
->execute();
|
250
|
|
251
|
db_insert('vocabulary_node_types')->fields(array(
|
252
|
'vid',
|
253
|
'type',
|
254
|
))
|
255
|
->values(array(
|
256
|
'vid' => '101',
|
257
|
'type' => 'forum',
|
258
|
))
|
259
|
->execute();
|
260
|
|
261
|
|
262
|
$results = db_select('permission', 'p')
|
263
|
->fields('p')
|
264
|
->execute();
|
265
|
|
266
|
foreach ($results as $result) {
|
267
|
$permissions = $result->perm . ', create forum topics';
|
268
|
db_update('permission')
|
269
|
->fields(array(
|
270
|
'perm' => $permissions,
|
271
|
))
|
272
|
->condition('rid', $result->rid)
|
273
|
->execute();
|
274
|
}
|