comparison modules/simpletest/tests/upgrade/drupal-6.locale.database.php @ 0:ff03f76ab3fe

initial version
author danieleb <danielebarchiesi@me.com>
date Wed, 21 Aug 2013 18:51:11 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:ff03f76ab3fe
1 <?php
2
3 /**
4 * Database additions for locale tests.
5 */
6
7 db_create_table('languages', array(
8 'fields' => array(
9 'language' => array(
10 'type' => 'varchar',
11 'length' => 12,
12 'not null' => TRUE,
13 'default' => '',
14 ),
15 'name' => array(
16 'type' => 'varchar',
17 'length' => 64,
18 'not null' => TRUE,
19 'default' => '',
20 ),
21 'native' => array(
22 'type' => 'varchar',
23 'length' => 64,
24 'not null' => TRUE,
25 'default' => '',
26 ),
27 'direction' => array(
28 'type' => 'int',
29 'not null' => TRUE,
30 'default' => 0,
31 ),
32 'enabled' => array(
33 'type' => 'int',
34 'not null' => TRUE,
35 'default' => 0,
36 ),
37 'plurals' => array(
38 'type' => 'int',
39 'not null' => TRUE,
40 'default' => 0,
41 ),
42 'formula' => array(
43 'type' => 'varchar',
44 'length' => 128,
45 'not null' => TRUE,
46 'default' => '',
47 ),
48 'domain' => array(
49 'type' => 'varchar',
50 'length' => 128,
51 'not null' => TRUE,
52 'default' => '',
53 ),
54 'prefix' => array(
55 'type' => 'varchar',
56 'length' => 128,
57 'not null' => TRUE,
58 'default' => '',
59 ),
60 'weight' => array(
61 'type' => 'int',
62 'not null' => TRUE,
63 'default' => 0,
64 ),
65 'javascript' => array(
66 'type' => 'varchar',
67 'length' => 32,
68 'not null' => TRUE,
69 'default' => '',
70 ),
71 ),
72 'primary key' => array(
73 'language',
74 ),
75 'indexes' => array(
76 'list' => array(
77 'weight',
78 'name',
79 ),
80 ),
81 'module' => 'locale',
82 'name' => 'languages',
83 ));
84 db_insert('languages')->fields(array(
85 'language',
86 'name',
87 'native',
88 'direction',
89 'enabled',
90 'plurals',
91 'formula',
92 'domain',
93 'prefix',
94 'weight',
95 'javascript',
96 ))
97 ->values(array(
98 'language' => 'en',
99 'name' => 'English',
100 'native' => 'English',
101 'direction' => '0',
102 'enabled' => '1',
103 'plurals' => '0',
104 'formula' => '',
105 'domain' => 'http://en.example.com',
106 'prefix' => 'en',
107 'weight' => '0',
108 'javascript' => '',
109 ))
110 ->values(array(
111 'language' => 'fr',
112 'name' => 'French',
113 'native' => 'Français',
114 'direction' => '0',
115 'enabled' => '1',
116 'plurals' => '2',
117 'formula' => '($n>1)',
118 'domain' => '',
119 'prefix' => 'fr',
120 'weight' => '-3',
121 'javascript' => '51e92dcfe1491f4595b9df7f3b287753',
122 ))
123 ->execute();
124
125 db_create_table('locales_source', array(
126 'fields' => array(
127 'lid' => array(
128 'type' => 'serial',
129 'not null' => TRUE,
130 ),
131 'location' => array(
132 'type' => 'varchar',
133 'length' => 255,
134 'not null' => TRUE,
135 'default' => '',
136 ),
137 'textgroup' => array(
138 'type' => 'varchar',
139 'length' => 255,
140 'not null' => TRUE,
141 'default' => 'default',
142 ),
143 'source' => array(
144 'type' => 'text',
145 'mysql_type' => 'blob',
146 'not null' => TRUE,
147 ),
148 'version' => array(
149 'type' => 'varchar',
150 'length' => 20,
151 'not null' => TRUE,
152 'default' => 'none',
153 ),
154 ),
155 'primary key' => array(
156 'lid',
157 ),
158 'indexes' => array(
159 'source' => array(
160 array(
161 'source',
162 30,
163 ),
164 ),
165 ),
166 'module' => 'locale',
167 'name' => 'locales_source',
168 ));
169
170 db_create_table('locales_target', array(
171 'fields' => array(
172 'lid' => array(
173 'type' => 'int',
174 'not null' => TRUE,
175 'default' => 0,
176 ),
177 'translation' => array(
178 'type' => 'text',
179 'mysql_type' => 'blob',
180 'not null' => TRUE,
181 ),
182 'language' => array(
183 'type' => 'varchar',
184 'length' => 12,
185 'not null' => TRUE,
186 'default' => '',
187 ),
188 'plid' => array(
189 'type' => 'int',
190 'not null' => TRUE,
191 'default' => 0,
192 ),
193 'plural' => array(
194 'type' => 'int',
195 'not null' => TRUE,
196 'default' => 0,
197 ),
198 ),
199 'primary key' => array(
200 'language',
201 'lid',
202 'plural',
203 ),
204 'indexes' => array(
205 'lid' => array(
206 'lid',
207 ),
208 'plid' => array(
209 'plid',
210 ),
211 'plural' => array(
212 'plural',
213 ),
214 ),
215 'module' => 'locale',
216 'name' => 'locales_target',
217 ));
218
219 // Enable the locale module.
220 db_update('system')->fields(array(
221 'status' => 1,
222 'schema_version' => '6006',
223 ))
224 ->condition('type', 'module')
225 ->condition('name', 'locale')
226 ->execute();
227
228 // Set the default language.
229 db_insert('variable')->fields(array(
230 'name',
231 'value',
232 ))
233 ->values(array(
234 'name' => 'language_default',
235 'value' => 'O:8:"stdClass":11:{s:8:"language";s:2:"fr";s:4:"name";s:6:"French";s:6:"native";s:9:"Français";s:9:"direction";s:1:"0";s:7:"enabled";i:1;s:7:"plurals";s:1:"2";s:7:"formula";s:6:"($n>1)";s:6:"domain";s:0:"";s:6:"prefix";s:0:"";s:6:"weight";s:2:"-3";s:10:"javascript";s:32:"51e92dcfe1491f4595b9df7f3b287753";}',
236 ))
237 ->values(array(
238 'name' => 'language_count',
239 'value' => 'i:2;',
240 ))
241 ->values(array(
242 'name' => 'language_negotiation',
243 'value' => 'i:0;',
244 ))
245 ->execute();
246
247 // Add the language switcher block in the left region.
248 db_insert('blocks')->fields(array(
249 'module',
250 'delta',
251 'theme',
252 'status',
253 'weight',
254 'region',
255 'custom',
256 'throttle',
257 'visibility',
258 'pages',
259 'title',
260 'cache',
261 ))
262 ->values(array(
263 'module' => 'locale',
264 'delta' => '0',
265 'theme' => 'garland',
266 'status' => '1',
267 'weight' => '0',
268 'region' => 'left',
269 'custom' => '0',
270 'throttle' => '0',
271 'visibility' => '0',
272 'pages' => '',
273 'title' => '',
274 'cache' => '-1',
275 ))
276 ->execute();