This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @author Viktar Dubiniuk <[email protected]> |
||
4 | * |
||
5 | * @copyright Copyright (c) 2018, ownCloud GmbH |
||
6 | * @license AGPL-3.0 |
||
7 | * |
||
8 | * This code is free software: you can redistribute it and/or modify |
||
9 | * it under the terms of the GNU Affero General Public License, version 3, |
||
10 | * as published by the Free Software Foundation. |
||
11 | * |
||
12 | * This program is distributed in the hope that it will be useful, |
||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
15 | * GNU Affero General Public License for more details. |
||
16 | * |
||
17 | * You should have received a copy of the GNU Affero General Public License, version 3, |
||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/> |
||
19 | * |
||
20 | */ |
||
21 | |||
22 | namespace OCA\DAV\Migrations; |
||
23 | |||
24 | use Doctrine\DBAL\Schema\Schema; |
||
25 | use OCP\Migration\ISchemaMigration; |
||
26 | |||
27 | /* |
||
28 | * Create initial tables for the dav app |
||
29 | */ |
||
30 | |||
31 | class Version20170116150538 implements ISchemaMigration { |
||
32 | |||
33 | /** @var string */ |
||
34 | private $prefix; |
||
35 | |||
36 | /** |
||
37 | * @param Schema $schema |
||
38 | * @param [] $options |
||
0 ignored issues
–
show
|
|||
39 | */ |
||
40 | public function changeSchema(Schema $schema, array $options) { |
||
41 | $this->prefix = $options['tablePrefix']; |
||
42 | $this->createAddressbooksTable($schema); |
||
43 | $this->createCardsTable($schema); |
||
44 | $this->createAddressbookChangesTable($schema); |
||
45 | $this->createCalendarObjectsTable($schema); |
||
46 | $this->createCalendarsTable($schema); |
||
47 | $this->createCalendarChangesTable($schema); |
||
48 | $this->createCalendarSubscriptionsTable($schema); |
||
49 | $this->createSchedulingObjectsTable($schema); |
||
50 | $this->createCardsPropertiesTable($schema); |
||
51 | $this->createDavSharesTable($schema); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @param Schema $schema |
||
56 | */ |
||
57 | private function createAddressbooksTable(Schema $schema) { |
||
58 | if (!$schema->hasTable("{$this->prefix}addressbooks")) { |
||
59 | $table = $schema->createTable("{$this->prefix}addressbooks"); |
||
60 | $table->addColumn('id', 'integer', [ |
||
61 | 'autoincrement' => true, |
||
62 | 'unsigned' => true, |
||
63 | 'notnull' => true, |
||
64 | 'length' => 11, |
||
65 | ]); |
||
66 | $table->addColumn('principaluri', 'string', [ |
||
67 | 'length' => 255, |
||
68 | 'notnull' => false, |
||
69 | ]); |
||
70 | $table->addColumn('displayname', 'string', [ |
||
71 | 'length' => 255, |
||
72 | 'notnull' => false, |
||
73 | ]); |
||
74 | $table->addColumn('uri', 'string', [ |
||
75 | 'length' => 255, |
||
76 | 'notnull' => false, |
||
77 | ]); |
||
78 | $table->addColumn('description', 'string', [ |
||
79 | 'length' => 255, |
||
80 | 'notnull' => false, |
||
81 | ]); |
||
82 | $table->addColumn('synctoken', 'integer', [ |
||
83 | 'unsigned' => true, |
||
84 | 'notnull' => true, |
||
85 | 'default' => 1, |
||
86 | ]); |
||
87 | $table->setPrimaryKey(['id']); |
||
88 | $table->addUniqueIndex(['principaluri', 'uri'], 'addressbook_index'); |
||
89 | } |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * @param Schema $schema |
||
94 | */ |
||
95 | View Code Duplication | private function createCardsTable(Schema $schema) { |
|
96 | if (!$schema->hasTable("{$this->prefix}cards")) { |
||
97 | $table = $schema->createTable("{$this->prefix}cards"); |
||
98 | $table->addColumn('id', 'integer', [ |
||
99 | 'autoincrement' => true, |
||
100 | 'unsigned' => true, |
||
101 | 'notnull' => true, |
||
102 | 'length' => 11, |
||
103 | ]); |
||
104 | $table->addColumn('addressbookid', 'integer', [ |
||
105 | 'notnull' => true, |
||
106 | 'default' => 0, |
||
107 | ]); |
||
108 | $table->addColumn('carddata', 'blob', [ |
||
109 | 'notnull' => false, |
||
110 | ]); |
||
111 | $table->addColumn('uri', 'string', [ |
||
112 | 'length' => 255, |
||
113 | 'notnull' => false, |
||
114 | ]); |
||
115 | $table->addColumn('lastmodified', 'bigint', [ |
||
116 | 'length' => 11, |
||
117 | 'unsigned' => true, |
||
118 | 'notnull' => false, |
||
119 | ]); |
||
120 | $table->addColumn('etag', 'string', [ |
||
121 | 'length' => 32, |
||
122 | 'notnull' => false, |
||
123 | ]); |
||
124 | $table->addColumn('size', 'bigint', [ |
||
125 | 'length' => 11, |
||
126 | 'notnull' => true, |
||
127 | 'unsigned' => true, |
||
128 | ]); |
||
129 | $table->setPrimaryKey(['id']); |
||
130 | } |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * @param Schema $schema |
||
135 | */ |
||
136 | View Code Duplication | private function createAddressbookChangesTable(Schema $schema) { |
|
137 | if (!$schema->hasTable("{$this->prefix}addressbookchanges")) { |
||
138 | $table = $schema->createTable("{$this->prefix}addressbookchanges"); |
||
139 | $table->addColumn('id', 'integer', [ |
||
140 | 'autoincrement' => true, |
||
141 | 'notnull' => true, |
||
142 | 'unsigned' => true, |
||
143 | 'length' => 11, |
||
144 | ]); |
||
145 | $table->addColumn('uri', 'string', [ |
||
146 | 'length' => 255, |
||
147 | 'notnull' => false, |
||
148 | ]); |
||
149 | $table->addColumn('synctoken', 'integer', [ |
||
150 | 'notnull' => true, |
||
151 | 'default' => 1, |
||
152 | 'unsigned' =>true, |
||
153 | ]); |
||
154 | $table->addColumn('addressbookid', 'integer', [ |
||
155 | 'notnull' => true, |
||
156 | ]); |
||
157 | $table->addColumn('operation', 'smallint', [ |
||
158 | 'notnull' => true, |
||
159 | 'length' => 1, |
||
160 | ]); |
||
161 | $table->setPrimaryKey(['id']); |
||
162 | $table->addIndex( |
||
163 | ['addressbookid', 'synctoken'], |
||
164 | 'addressbookid_synctoken' |
||
165 | ); |
||
166 | } |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * @param Schema $schema |
||
171 | */ |
||
172 | private function createCalendarObjectsTable(Schema $schema) { |
||
173 | if (!$schema->hasTable("{$this->prefix}calendarobjects")) { |
||
174 | $table = $schema->createTable("{$this->prefix}calendarobjects"); |
||
175 | $table->addColumn('id', 'integer', [ |
||
176 | 'notnull' => true, |
||
177 | 'autoincrement' => true, |
||
178 | 'unsigned' => true, |
||
179 | 'length' => 11, |
||
180 | ]); |
||
181 | $table->addColumn('calendardata', 'blob', [ |
||
182 | 'notnull' => false, |
||
183 | ]); |
||
184 | $table->addColumn('uri', 'string', [ |
||
185 | 'length' => 255, |
||
186 | 'notnull' => false, |
||
187 | ]); |
||
188 | $table->addColumn('calendarid', 'integer', [ |
||
189 | 'notnull' => true, |
||
190 | 'unsigned' =>true, |
||
191 | ]); |
||
192 | $table->addColumn('lastmodified', 'integer', [ |
||
193 | 'length' => 11, |
||
194 | 'unsigned' =>true, |
||
195 | 'notnull' => false, |
||
196 | ]); |
||
197 | $table->addColumn('etag', 'string', [ |
||
198 | 'length' => 32, |
||
199 | 'notnull' => false, |
||
200 | ]); |
||
201 | $table->addColumn('size', 'bigint', [ |
||
202 | 'length' => 11, |
||
203 | 'notnull' => true, |
||
204 | 'unsigned' =>true, |
||
205 | ]); |
||
206 | $table->addColumn('componenttype', 'string', [ |
||
207 | 'length' => 8, |
||
208 | 'notnull' => false, |
||
209 | ]); |
||
210 | $table->addColumn('firstoccurence', 'bigint', [ |
||
211 | 'unsigned' =>true, |
||
212 | 'length' => 11, |
||
213 | 'notnull' => false, |
||
214 | ]); |
||
215 | $table->addColumn('lastoccurence', 'bigint', [ |
||
216 | 'unsigned' =>true, |
||
217 | 'length' => 11, |
||
218 | 'notnull' => false, |
||
219 | ]); |
||
220 | $table->addColumn('uid', 'string', [ |
||
221 | 'length' => 255, |
||
222 | 'notnull' => false, |
||
223 | ]); |
||
224 | // possible types: 0 - public, 1 - private, 2 - confidential |
||
225 | $table->addColumn('classification', 'integer', [ |
||
226 | 'default' => 0, |
||
227 | 'notnull' => false |
||
228 | ]); |
||
229 | $table->setPrimaryKey(['id']); |
||
230 | $table->addUniqueIndex( |
||
231 | ['calendarid', 'uri'], |
||
232 | 'calobjects_index' |
||
233 | ); |
||
234 | } |
||
235 | } |
||
236 | |||
237 | /** |
||
238 | * @param Schema $schema |
||
239 | */ |
||
240 | View Code Duplication | private function createCalendarsTable(Schema $schema) { |
|
241 | if (!$schema->hasTable("{$this->prefix}calendars")) { |
||
242 | $table = $schema->createTable("{$this->prefix}calendars"); |
||
243 | $table->addColumn('id', 'integer', [ |
||
244 | 'autoincrement' => true, |
||
245 | 'unsigned' =>true, |
||
246 | 'notnull' => true, |
||
247 | 'length' => 11, |
||
248 | ]); |
||
249 | $table->addColumn('principaluri', 'string', [ |
||
250 | 'length' => 255, |
||
251 | 'notnull' => false, |
||
252 | ]); |
||
253 | $table->addColumn('displayname', 'string', [ |
||
254 | 'length' => 255, |
||
255 | 'notnull' => false, |
||
256 | ]); |
||
257 | $table->addColumn('uri', 'string', [ |
||
258 | 'length' => 255, |
||
259 | 'notnull' => false, |
||
260 | ]); |
||
261 | $table->addColumn('synctoken', 'integer', [ |
||
262 | 'notnull' => true, |
||
263 | 'default' => 1, |
||
264 | 'unsigned' =>true, |
||
265 | ]); |
||
266 | $table->addColumn('description', 'string', [ |
||
267 | 'length' => 255, |
||
268 | 'notnull' => false, |
||
269 | ]); |
||
270 | $table->addColumn('calendarorder', 'integer', [ |
||
271 | 'notnull' => true, |
||
272 | 'default' => 0, |
||
273 | 'unsigned' =>true, |
||
274 | ]); |
||
275 | $table->addColumn('calendarcolor', 'string', [ |
||
276 | 'notnull' => false, |
||
277 | ]); |
||
278 | $table->addColumn('timezone', 'text', [ |
||
279 | 'notnull' => false, |
||
280 | ]); |
||
281 | $table->addColumn('components', 'string', [ |
||
282 | 'length' => 20, |
||
283 | 'notnull' => false, |
||
284 | ]); |
||
285 | $table->addColumn('transparent', 'smallint', [ |
||
286 | 'notnull' => true, |
||
287 | 'default' => 0, |
||
288 | 'length' => 1 |
||
289 | ]); |
||
290 | $table->setPrimaryKey(['id']); |
||
291 | $table->addUniqueIndex( |
||
292 | ['principaluri', 'uri'], |
||
293 | 'calendars_index' |
||
294 | ); |
||
295 | } |
||
296 | } |
||
297 | |||
298 | /** |
||
299 | * @param Schema $schema |
||
300 | */ |
||
301 | View Code Duplication | private function createCalendarChangesTable(Schema $schema) { |
|
302 | if (!$schema->hasTable("{$this->prefix}calendarchanges")) { |
||
303 | $table = $schema->createTable("{$this->prefix}calendarchanges"); |
||
304 | $table->addColumn('id', 'integer', [ |
||
305 | 'autoincrement' => true, |
||
306 | 'unsigned' =>true, |
||
307 | 'notnull' => true, |
||
308 | 'length' => 11, |
||
309 | ]); |
||
310 | $table->addColumn('uri', 'string', [ |
||
311 | 'length' => 255, |
||
312 | 'notnull' => false, |
||
313 | ]); |
||
314 | $table->addColumn('synctoken', 'integer', [ |
||
315 | 'notnull' => true, |
||
316 | 'default' => 1, |
||
317 | 'unsigned' =>true, |
||
318 | ]); |
||
319 | $table->addColumn('calendarid', 'integer', [ |
||
320 | 'notnull' => true, |
||
321 | ]); |
||
322 | $table->addColumn('operation', 'smallint', [ |
||
323 | 'notnull' => true, |
||
324 | 'length' => 1, |
||
325 | ]); |
||
326 | $table->setPrimaryKey(['id']); |
||
327 | $table->addIndex( |
||
328 | ['calendarid', 'synctoken'], |
||
329 | 'calendarid_synctoken' |
||
330 | ); |
||
331 | } |
||
332 | } |
||
333 | |||
334 | /** |
||
335 | * @param Schema $schema |
||
336 | */ |
||
337 | View Code Duplication | private function createCalendarSubscriptionsTable(Schema $schema) { |
|
338 | if (!$schema->hasTable("{$this->prefix}calendarsubscriptions")) { |
||
339 | $table = $schema->createTable("{$this->prefix}calendarsubscriptions"); |
||
340 | $table->addColumn('id', 'integer', [ |
||
341 | 'autoincrement' => true, |
||
342 | 'unsigned' =>true, |
||
343 | 'notnull' => true, |
||
344 | 'length' => 11, |
||
345 | ]); |
||
346 | $table->addColumn('uri', 'string', [ |
||
347 | 'length' => 255, |
||
348 | 'notnull' => false, |
||
349 | ]); |
||
350 | $table->addColumn('principaluri', 'string', [ |
||
351 | 'length' => 255, |
||
352 | 'notnull' => false, |
||
353 | ]); |
||
354 | $table->addColumn('source', 'string', [ |
||
355 | 'length' => 255, |
||
356 | 'notnull' => false, |
||
357 | ]); |
||
358 | $table->addColumn('displayname', 'string', [ |
||
359 | 'length' => 100, |
||
360 | 'notnull' => false, |
||
361 | ]); |
||
362 | $table->addColumn('refreshrate', 'string', [ |
||
363 | 'length' => 10, |
||
364 | 'notnull' => false, |
||
365 | ]); |
||
366 | $table->addColumn('calendarorder', 'integer', [ |
||
367 | 'default' => 0, |
||
368 | 'notnull' => true, |
||
369 | 'unsigned' =>true, |
||
370 | ]); |
||
371 | $table->addColumn('calendarcolor', 'string', [ |
||
372 | 'notnull' => false, |
||
373 | ]); |
||
374 | $table->addColumn('striptodos', 'smallint', [ |
||
375 | 'length' => 1, |
||
376 | 'notnull' => false, |
||
377 | ]); |
||
378 | $table->addColumn('stripalarms', 'smallint', [ |
||
379 | 'length' => 1, |
||
380 | 'notnull' => false, |
||
381 | ]); |
||
382 | $table->addColumn('stripattachments', 'smallint', [ |
||
383 | 'length' => 1, |
||
384 | 'notnull' => false, |
||
385 | ]); |
||
386 | $table->addColumn('lastmodified', 'integer', [ |
||
387 | 'unsigned' => true, |
||
388 | ]); |
||
389 | $table->setPrimaryKey(['id']); |
||
390 | $table->addUniqueIndex( |
||
391 | ['principaluri', 'uri'], |
||
392 | 'calsub_index' |
||
393 | ); |
||
394 | } |
||
395 | } |
||
396 | |||
397 | /** |
||
398 | * @param Schema $schema |
||
399 | */ |
||
400 | View Code Duplication | private function createSchedulingObjectsTable(Schema $schema) { |
|
401 | if (!$schema->hasTable("{$this->prefix}schedulingobjects")) { |
||
402 | $table = $schema->createTable("{$this->prefix}schedulingobjects"); |
||
403 | $table->addColumn('id', 'integer', [ |
||
404 | 'autoincrement' => true, |
||
405 | 'unsigned' =>true, |
||
406 | 'notnull' => true, |
||
407 | 'length' => 11, |
||
408 | ]); |
||
409 | $table->addColumn('principaluri', 'string', [ |
||
410 | 'length' => 255, |
||
411 | 'notnull' => false, |
||
412 | ]); |
||
413 | $table->addColumn('calendardata', 'blob', [ |
||
414 | 'notnull' => false, |
||
415 | ]); |
||
416 | $table->addColumn('uri', 'string', [ |
||
417 | 'length' => 255, |
||
418 | 'notnull' => false, |
||
419 | ]); |
||
420 | $table->addColumn('lastmodified', 'integer', [ |
||
421 | 'notnull' => false, |
||
422 | 'unsigned' => true, |
||
423 | ]); |
||
424 | $table->addColumn('etag', 'string', [ |
||
425 | 'length' => 32, |
||
426 | 'notnull' => false, |
||
427 | ]); |
||
428 | $table->addColumn('size', 'bigint', [ |
||
429 | 'length' => 11, |
||
430 | 'notnull' => true, |
||
431 | 'unsigned' => true, |
||
432 | ]); |
||
433 | $table->setPrimaryKey(['id']); |
||
434 | } |
||
435 | } |
||
436 | |||
437 | private function createCardsPropertiesTable(Schema $schema) { |
||
438 | if (!$schema->hasTable("{$this->prefix}cards_properties")) { |
||
439 | $table = $schema->createTable("{$this->prefix}cards_properties"); |
||
440 | $table->addColumn('id', 'integer', [ |
||
441 | 'autoincrement' => true, |
||
442 | 'unsigned' =>true, |
||
443 | 'notnull' => true, |
||
444 | 'length' => 11, |
||
445 | ]); |
||
446 | $table->addColumn('addressbookid', 'bigint', [ |
||
447 | 'notnull' => true, |
||
448 | 'default' => 0, |
||
449 | ]); |
||
450 | $table->addColumn('cardid', 'bigint', [ |
||
451 | 'default' => 0, |
||
452 | 'unsigned' =>true, |
||
453 | 'notnull' => true, |
||
454 | 'length' => 11, |
||
455 | ]); |
||
456 | $table->addColumn('name', 'string', [ |
||
457 | 'notnull' => false, |
||
458 | 'length' => 64, |
||
459 | ]); |
||
460 | $table->addColumn('value', 'string', [ |
||
461 | 'notnull' => false, |
||
462 | 'length' => 255, |
||
463 | ]); |
||
464 | $table->addColumn('preferred', 'integer', [ |
||
465 | 'default' => 1, |
||
466 | 'notnull' => true, |
||
467 | 'length' => 4, |
||
468 | ]); |
||
469 | $table->setPrimaryKey(['id']); |
||
470 | $table->addIndex( |
||
471 | ['cardid'], |
||
472 | 'card_contactid_index' |
||
473 | ); |
||
474 | $table->addIndex( |
||
475 | ['name'], |
||
476 | 'card_name_index' |
||
477 | ); |
||
478 | $table->addIndex( |
||
479 | ['value'], |
||
480 | 'card_value_index' |
||
481 | ); |
||
482 | } |
||
483 | } |
||
484 | |||
485 | private function createDavSharesTable(Schema $schema) { |
||
486 | if (!$schema->hasTable("{$this->prefix}dav_shares")) { |
||
487 | $table = $schema->createTable("{$this->prefix}dav_shares"); |
||
488 | $table->addColumn('id', 'integer', [ |
||
489 | 'autoincrement' => true, |
||
490 | 'unsigned' =>true, |
||
491 | 'notnull' => true, |
||
492 | 'length' => 11, |
||
493 | ]); |
||
494 | $table->addColumn('principaluri', 'string', [ |
||
495 | 'length' => 255, |
||
496 | 'notnull' => false, |
||
497 | ]); |
||
498 | $table->addColumn('type', 'string', [ |
||
499 | 'length' => 255, |
||
500 | 'notnull' => false, |
||
501 | ]); |
||
502 | $table->addColumn('access', 'smallint', [ |
||
503 | 'notnull' => false, |
||
504 | 'length' => 1, |
||
505 | ]); |
||
506 | $table->addColumn('resourceid', 'integer', [ |
||
507 | 'unsigned' =>true, |
||
508 | 'notnull' => true, |
||
509 | ]); |
||
510 | $table->addColumn('publicuri', 'string', [ |
||
511 | 'length' => 255, |
||
512 | 'notnull' => false, |
||
513 | ]); |
||
514 | $table->setPrimaryKey(['id']); |
||
515 | $table->addUniqueIndex( |
||
516 | ['principaluri', 'resourceid', 'type', 'publicuri'], |
||
517 | 'dav_shares_index' |
||
518 | ); |
||
519 | } |
||
520 | } |
||
521 | } |
||
522 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.