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 | namespace OC\Migrations; |
||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; |
||
6 | use Doctrine\DBAL\Types\Type; |
||
7 | use OCP\Migration\ISchemaMigration; |
||
8 | |||
9 | /** |
||
10 | * migrate stable9 to stable10 |
||
11 | */ |
||
12 | class Version20170101215145 implements ISchemaMigration { |
||
13 | public function changeSchema(Schema $schema, array $options) { |
||
14 | $prefix = $options['tablePrefix']; |
||
15 | |||
16 | if (!$schema->hasTable("${prefix}authtoken")) { |
||
17 | $authTokenTable = $schema->createTable("${prefix}authtoken"); |
||
18 | |||
19 | $authTokenTable->addColumn( |
||
20 | 'id', |
||
21 | Type::INTEGER, |
||
22 | [ |
||
23 | 'notnull' => true, |
||
24 | 'autoincrement' => 1, |
||
25 | 'unsigned' => true |
||
26 | ] |
||
27 | ); |
||
28 | |||
29 | $authTokenTable->addColumn( |
||
30 | 'uid', |
||
31 | Type::STRING, |
||
32 | [ |
||
33 | 'length' => 64, |
||
34 | 'default' => '', |
||
35 | 'notnull' => true |
||
36 | ] |
||
37 | ); |
||
38 | |||
39 | $authTokenTable->addColumn( |
||
40 | 'login_name', |
||
41 | Type::STRING, |
||
42 | [ |
||
43 | 'length' => 64, |
||
44 | 'default' => '', |
||
45 | 'notnull' => true |
||
46 | ] |
||
47 | ); |
||
48 | |||
49 | $authTokenTable->addColumn( |
||
50 | 'name', |
||
51 | Type::TEXT, |
||
52 | [ |
||
53 | 'default' => '', |
||
54 | 'notnull' => true |
||
55 | ] |
||
56 | ); |
||
57 | |||
58 | $authTokenTable->addColumn( |
||
59 | 'token', |
||
60 | Type::STRING, |
||
61 | [ |
||
62 | 'length' => 200, |
||
63 | 'default' => '', |
||
64 | 'notnull' => true |
||
65 | ] |
||
66 | ); |
||
67 | |||
68 | $authTokenTable->addColumn( |
||
69 | 'type', |
||
70 | Type::SMALLINT, |
||
71 | [ |
||
72 | 'unsigned' => true, |
||
73 | 'default' => 0, |
||
74 | 'notnull' => true |
||
75 | ] |
||
76 | ); |
||
77 | |||
78 | $authTokenTable->addColumn( |
||
79 | 'last_activity', |
||
80 | Type::INTEGER, |
||
81 | [ |
||
82 | 'unsigned' => true, |
||
83 | 'default' => 0, |
||
84 | 'notnull' => true |
||
85 | ] |
||
86 | ); |
||
87 | |||
88 | $authTokenTable->addColumn( |
||
89 | 'last_check', |
||
90 | Type::INTEGER, |
||
91 | [ |
||
92 | 'unsigned' => true, |
||
93 | 'default' => 0, |
||
94 | 'notnull' => true |
||
95 | ] |
||
96 | ); |
||
97 | |||
98 | $authTokenTable->addColumn( |
||
99 | 'password', |
||
100 | Type::TEXT, |
||
101 | [ |
||
102 | 'default' => null, |
||
103 | 'notnull' => false |
||
104 | ] |
||
105 | ); |
||
106 | |||
107 | $authTokenTable->setPrimaryKey(['id']); |
||
108 | |||
109 | $authTokenTable->addIndex(['last_activity'], 'authtoken_last_activity_index'); |
||
110 | |||
111 | $authTokenTable->addUniqueIndex(['token'], 'authtoken_token_index'); |
||
112 | } |
||
113 | |||
114 | if (!$schema->hasTable("${prefix}systemtag_group")) { |
||
115 | $systemTagGroupTable = $schema->createTable("${prefix}systemtag_group"); |
||
116 | |||
117 | $systemTagGroupTable->addColumn( |
||
118 | 'gid', |
||
119 | Type::STRING, |
||
120 | [ |
||
121 | 'length' => 255, |
||
122 | 'notnull' => true |
||
123 | ] |
||
124 | ); |
||
125 | |||
126 | $systemTagGroupTable->addColumn( |
||
127 | 'systemtagid', |
||
128 | Type::INTEGER, |
||
129 | [ |
||
130 | 'unsigned' => true, |
||
131 | 'default' => 0, |
||
132 | 'notnull' => true |
||
133 | ] |
||
134 | ); |
||
135 | |||
136 | $systemTagGroupTable->setPrimaryKey(['gid', 'systemtagid']); |
||
137 | } |
||
138 | |||
139 | if ($schema->hasTable("${prefix}jobs")) { |
||
140 | $jobsTable = $schema->getTable("${prefix}jobs"); |
||
141 | |||
142 | View Code Duplication | if (!$jobsTable->hasColumn('last_checked')) { |
|
0 ignored issues
–
show
|
|||
143 | $jobsTable->addColumn( |
||
144 | 'last_checked', |
||
145 | Type::INTEGER, |
||
146 | [ |
||
147 | 'default' => 0, |
||
148 | 'notnull' => false |
||
149 | ] |
||
150 | ); |
||
151 | } |
||
152 | |||
153 | View Code Duplication | if (!$jobsTable->hasColumn('reserved_at')) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
154 | $jobsTable->addColumn( |
||
155 | 'reserved_at', |
||
156 | Type::INTEGER, |
||
157 | [ |
||
158 | 'default' => 0, |
||
159 | 'notnull' => false |
||
160 | ] |
||
161 | ); |
||
162 | } |
||
163 | } |
||
164 | |||
165 | if ($schema->hasTable("${prefix}calendarobjects")) { |
||
166 | $calendarObjectsTable = $schema->getTable("${prefix}calendarobjects"); |
||
167 | |||
168 | View Code Duplication | if (!$calendarObjectsTable->hasColumn('classification')) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
169 | $calendarObjectsTable->addColumn( |
||
170 | 'classification', |
||
171 | Type::INTEGER, |
||
172 | [ |
||
173 | 'default' => 0, |
||
174 | 'notnull' => false |
||
175 | ] |
||
176 | ); |
||
177 | } |
||
178 | |||
179 | if ($calendarObjectsTable->hasColumn('componenttype')) { |
||
180 | $componentType = $calendarObjectsTable->getColumn('componenttype'); |
||
181 | // TODO: check what happens when this contained data with length > 8 |
||
182 | $componentType->setOptions(['length' => 8]); |
||
183 | } |
||
184 | |||
185 | if ($calendarObjectsTable->hasColumn('firstoccurence')) { |
||
186 | $firstOccurence = $calendarObjectsTable->getColumn('firstoccurence'); |
||
187 | $firstOccurence->setType(Type::getType(Type::BIGINT)); |
||
188 | } |
||
189 | |||
190 | if ($calendarObjectsTable->hasColumn('lastoccurence')) { |
||
191 | $lastOccurence = $calendarObjectsTable->getColumn('lastoccurence'); |
||
192 | $lastOccurence->setType(Type::getType(Type::BIGINT)); |
||
193 | } |
||
194 | } |
||
195 | |||
196 | if ($schema->hasTable("${prefix}calendars")) { |
||
197 | $calendarsTable = $schema->getTable("${prefix}calendars"); |
||
198 | |||
199 | if ($calendarsTable->hasColumn('components')) { |
||
200 | $components = $calendarsTable->getColumn('components'); |
||
201 | $components->setOptions(['length' => 20]); |
||
202 | } |
||
203 | } |
||
204 | |||
205 | if ($schema->hasTable("${prefix}calendarsubscriptions")) { |
||
206 | $calendarSubscriptionsTable = $schema->getTable("${prefix}calendarsubscriptions"); |
||
207 | |||
208 | if ($calendarSubscriptionsTable->hasColumn('lastmodified')) { |
||
209 | $lastModified = $calendarSubscriptionsTable->getColumn('lastmodified'); |
||
210 | $lastModified->setOptions( |
||
211 | [ |
||
212 | 'notnull' => true |
||
213 | ] |
||
214 | ); |
||
215 | } |
||
216 | } |
||
217 | } |
||
218 | } |
||
219 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.