@@ -32,14 +32,14 @@ |
||
32 | 32 | */ |
33 | 33 | class Collection extends \Sabre\CalDAV\Principal\Collection { |
34 | 34 | |
35 | - /** |
|
36 | - * Returns a child object based on principal information |
|
37 | - * |
|
38 | - * @param array $principalInfo |
|
39 | - * @return User |
|
40 | - */ |
|
41 | - function getChildForPrincipal(array $principalInfo) { |
|
42 | - return new User($this->principalBackend, $principalInfo); |
|
43 | - } |
|
35 | + /** |
|
36 | + * Returns a child object based on principal information |
|
37 | + * |
|
38 | + * @param array $principalInfo |
|
39 | + * @return User |
|
40 | + */ |
|
41 | + function getChildForPrincipal(array $principalInfo) { |
|
42 | + return new User($this->principalBackend, $principalInfo); |
|
43 | + } |
|
44 | 44 | |
45 | 45 | } |
@@ -30,26 +30,26 @@ |
||
30 | 30 | */ |
31 | 31 | class User extends \Sabre\CalDAV\Principal\User { |
32 | 32 | |
33 | - /** |
|
34 | - * Returns a list of ACE's for this node. |
|
35 | - * |
|
36 | - * Each ACE has the following properties: |
|
37 | - * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
38 | - * currently the only supported privileges |
|
39 | - * * 'principal', a url to the principal who owns the node |
|
40 | - * * 'protected' (optional), indicating that this ACE is not allowed to |
|
41 | - * be updated. |
|
42 | - * |
|
43 | - * @return array |
|
44 | - */ |
|
45 | - function getACL() { |
|
46 | - $acl = parent::getACL(); |
|
47 | - $acl[] = [ |
|
48 | - 'privilege' => '{DAV:}read', |
|
49 | - 'principal' => '{DAV:}authenticated', |
|
50 | - 'protected' => true, |
|
51 | - ]; |
|
52 | - return $acl; |
|
53 | - } |
|
33 | + /** |
|
34 | + * Returns a list of ACE's for this node. |
|
35 | + * |
|
36 | + * Each ACE has the following properties: |
|
37 | + * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
38 | + * currently the only supported privileges |
|
39 | + * * 'principal', a url to the principal who owns the node |
|
40 | + * * 'protected' (optional), indicating that this ACE is not allowed to |
|
41 | + * be updated. |
|
42 | + * |
|
43 | + * @return array |
|
44 | + */ |
|
45 | + function getACL() { |
|
46 | + $acl = parent::getACL(); |
|
47 | + $acl[] = [ |
|
48 | + 'privilege' => '{DAV:}read', |
|
49 | + 'principal' => '{DAV:}authenticated', |
|
50 | + 'protected' => true, |
|
51 | + ]; |
|
52 | + return $acl; |
|
53 | + } |
|
54 | 54 | |
55 | 55 | } |
@@ -29,404 +29,404 @@ |
||
29 | 29 | * @since 11.0.0 |
30 | 30 | */ |
31 | 31 | class Definitions { |
32 | - /** |
|
33 | - * @var array |
|
34 | - * @since 11.0.0 |
|
35 | - */ |
|
36 | - public $definitions = [ |
|
37 | - 'addressbook' => [ |
|
38 | - 'author' => 'Nextcloud', |
|
39 | - 'app' => 'dav', |
|
40 | - 'since' => '11.0.0', |
|
41 | - 'parameters' => [ |
|
42 | - 'id' => [ |
|
43 | - 'since' => '11.0.0', |
|
44 | - 'required' => true, |
|
45 | - 'description' => 'The id used to identify the addressbook on the instance', |
|
46 | - 'example' => '42', |
|
47 | - ], |
|
48 | - 'name' => [ |
|
49 | - 'since' => '11.0.0', |
|
50 | - 'required' => true, |
|
51 | - 'description' => 'The display name of the addressbook which should be used in the visual representation', |
|
52 | - 'example' => 'Contacts', |
|
53 | - ], |
|
54 | - ], |
|
55 | - ], |
|
56 | - 'addressbook-contact' => [ |
|
57 | - 'author' => 'Nextcloud', |
|
58 | - 'app' => 'dav', |
|
59 | - 'since' => '11.0.0', |
|
60 | - 'parameters' => [ |
|
61 | - 'id' => [ |
|
62 | - 'since' => '11.0.0', |
|
63 | - 'required' => true, |
|
64 | - 'description' => 'The id used to identify the contact on the instance', |
|
65 | - 'example' => '42', |
|
66 | - ], |
|
67 | - 'name' => [ |
|
68 | - 'since' => '11.0.0', |
|
69 | - 'required' => true, |
|
70 | - 'description' => 'The display name of the contact which should be used in the visual representation', |
|
71 | - 'example' => 'John Doe', |
|
72 | - ], |
|
73 | - ], |
|
74 | - ], |
|
75 | - 'announcement' => [ |
|
76 | - 'author' => 'Joas Schilling', |
|
77 | - 'app' => 'announcementcenter', |
|
78 | - 'since' => '11.0.0', |
|
79 | - 'parameters' => [ |
|
80 | - 'id' => [ |
|
81 | - 'since' => '11.0.0', |
|
82 | - 'required' => true, 'description' => 'The id used to identify the announcement on the instance', |
|
83 | - 'example' => '42', |
|
84 | - ], |
|
85 | - 'name' => [ |
|
86 | - 'since' => '11.0.0', |
|
87 | - 'required' => true, |
|
88 | - 'description' => 'The announcement subject which should be used in the visual representation', |
|
89 | - 'example' => 'file.txt', |
|
90 | - ], |
|
91 | - 'link' => [ |
|
92 | - 'since' => '11.0.0', |
|
93 | - 'required' => false, |
|
94 | - 'description' => 'The full URL to the file', |
|
95 | - 'example' => 'http://localhost/index.php/apps/announcements/#23', |
|
96 | - ], |
|
97 | - ], |
|
98 | - ], |
|
99 | - 'app' => [ |
|
100 | - 'author' => 'Nextcloud', |
|
101 | - 'app' => 'updatenotification', |
|
102 | - 'since' => '11.0.0', |
|
103 | - 'parameters' => [ |
|
104 | - 'id' => [ |
|
105 | - 'since' => '11.0.0', |
|
106 | - 'required' => true, 'description' => 'The app id', |
|
107 | - 'example' => 'updatenotification', |
|
108 | - ], |
|
109 | - 'name' => [ |
|
110 | - 'since' => '11.0.0', |
|
111 | - 'required' => true, |
|
112 | - 'description' => 'The name of the app which should be used in the visual representation', |
|
113 | - 'example' => 'Update notification', |
|
114 | - ], |
|
115 | - ], |
|
116 | - ], |
|
117 | - 'calendar' => [ |
|
118 | - 'author' => 'Nextcloud', |
|
119 | - 'app' => 'dav', |
|
120 | - 'since' => '11.0.0', |
|
121 | - 'parameters' => [ |
|
122 | - 'id' => [ |
|
123 | - 'since' => '11.0.0', |
|
124 | - 'required' => true, |
|
125 | - 'description' => 'The id used to identify the calendar on the instance', |
|
126 | - 'example' => '42', |
|
127 | - ], |
|
128 | - 'name' => [ |
|
129 | - 'since' => '11.0.0', |
|
130 | - 'required' => true, |
|
131 | - 'description' => 'The display name of the calendar which should be used in the visual representation', |
|
132 | - 'example' => 'Personal', |
|
133 | - ], |
|
134 | - ], |
|
135 | - ], |
|
136 | - 'calendar-event' => [ |
|
137 | - 'author' => 'Nextcloud', |
|
138 | - 'app' => 'dav', |
|
139 | - 'since' => '11.0.0', |
|
140 | - 'parameters' => [ |
|
141 | - 'id' => [ |
|
142 | - 'since' => '11.0.0', |
|
143 | - 'required' => true, |
|
144 | - 'description' => 'The id used to identify the event on the instance', |
|
145 | - 'example' => '42', |
|
146 | - ], |
|
147 | - 'name' => [ |
|
148 | - 'since' => '11.0.0', |
|
149 | - 'required' => true, |
|
150 | - 'description' => 'The display name of the event which should be used in the visual representation', |
|
151 | - 'example' => 'Workout', |
|
152 | - ], |
|
153 | - ], |
|
154 | - ], |
|
155 | - 'call' => [ |
|
156 | - 'author' => 'Nextcloud', |
|
157 | - 'app' => 'spreed', |
|
158 | - 'since' => '11.0.2', |
|
159 | - 'parameters' => [ |
|
160 | - 'id' => [ |
|
161 | - 'since' => '11.0.2', |
|
162 | - 'required' => true, |
|
163 | - 'description' => 'The id used to identify the call on the instance', |
|
164 | - 'example' => '42', |
|
165 | - ], |
|
166 | - 'name' => [ |
|
167 | - 'since' => '11.0.2', |
|
168 | - 'required' => true, |
|
169 | - 'description' => 'The display name of the call which should be used in the visual representation', |
|
170 | - 'example' => 'Company call', |
|
171 | - ], |
|
172 | - 'call-type' => [ |
|
173 | - 'since' => '11.0.2', |
|
174 | - 'required' => true, |
|
175 | - 'description' => 'The type of the call: one2one, group or public', |
|
176 | - 'example' => 'one2one', |
|
177 | - ], |
|
178 | - ], |
|
179 | - ], |
|
180 | - 'circle' => [ |
|
181 | - 'author' => 'Maxence Lange', |
|
182 | - 'app' => 'circles', |
|
183 | - 'since' => '12.0.0', |
|
184 | - 'parameters' => [ |
|
185 | - 'id' => [ |
|
186 | - 'since' => '12.0.0', |
|
187 | - 'required' => true, |
|
188 | - 'description' => 'The id used to identify the circle on the instance', |
|
189 | - 'example' => '42', |
|
190 | - ], |
|
191 | - 'name' => [ |
|
192 | - 'since' => '12.0.0', |
|
193 | - 'required' => true, |
|
194 | - 'description' => 'The display name of the circle which should be used in the visual representation', |
|
195 | - 'example' => 'My friends', |
|
196 | - ], |
|
197 | - 'link' => [ |
|
198 | - 'since' => '12.0.0', |
|
199 | - 'required' => true, |
|
200 | - 'description' => 'The full URL to the circle', |
|
201 | - 'example' => 'http://localhost/index.php/apps/circles/#42', |
|
202 | - ], |
|
203 | - ], |
|
204 | - ], |
|
205 | - 'email' => [ |
|
206 | - 'author' => 'Nextcloud', |
|
207 | - 'app' => 'sharebymail', |
|
208 | - 'since' => '11.0.0', |
|
209 | - 'parameters' => [ |
|
210 | - 'id' => [ |
|
211 | - 'since' => '11.0.0', |
|
212 | - 'required' => true, |
|
213 | - 'description' => 'The mail-address used to identify the event on the instance', |
|
214 | - 'example' => 'test@localhost', |
|
215 | - ], |
|
216 | - 'name' => [ |
|
217 | - 'since' => '11.0.0', |
|
218 | - 'required' => true, |
|
219 | - 'description' => 'The display name of a matching contact or the email (fallback) which should be used in the visual representation', |
|
220 | - 'example' => 'Foo Bar', |
|
221 | - ], |
|
222 | - ], |
|
223 | - ], |
|
224 | - 'file' => [ |
|
225 | - 'author' => 'Nextcloud', |
|
226 | - 'app' => 'dav', |
|
227 | - 'since' => '11.0.0', |
|
228 | - 'parameters' => [ |
|
229 | - 'id' => [ |
|
230 | - 'since' => '11.0.0', |
|
231 | - 'required' => true, |
|
232 | - 'description' => 'The id used to identify the file on the instance', |
|
233 | - 'example' => '42', |
|
234 | - ], |
|
235 | - 'name' => [ |
|
236 | - 'since' => '11.0.0', |
|
237 | - 'required' => true, |
|
238 | - 'description' => 'The file name which should be used in the visual representation', |
|
239 | - 'example' => 'file.txt', |
|
240 | - ], |
|
241 | - 'path' => [ |
|
242 | - 'since' => '11.0.0', |
|
243 | - 'required' => true, |
|
244 | - 'description' => 'The full path of the file for the user, should not start with a slash', |
|
245 | - 'example' => 'path/to/file.txt', |
|
246 | - ], |
|
247 | - 'link' => [ |
|
248 | - 'since' => '11.0.0', |
|
249 | - 'required' => false, |
|
250 | - 'description' => 'The full URL to the file', |
|
251 | - 'example' => 'http://localhost/index.php/f/42', |
|
252 | - ], |
|
253 | - ], |
|
254 | - ], |
|
255 | - 'highlight' => [ |
|
256 | - 'author' => 'Nextcloud', |
|
257 | - 'app' => 'core', |
|
258 | - 'since' => '13.0.0', |
|
259 | - 'parameters' => [ |
|
260 | - 'id' => [ |
|
261 | - 'since' => '13.0.0', |
|
262 | - 'required' => true, |
|
263 | - 'description' => 'The id used to identify the highlighted object on the instance', |
|
264 | - 'example' => '42', |
|
265 | - ], |
|
266 | - 'name' => [ |
|
267 | - 'since' => '13.0.0', |
|
268 | - 'required' => true, |
|
269 | - 'description' => 'The string that should be highlighted.', |
|
270 | - 'example' => 'Hello World', |
|
271 | - ], |
|
272 | - 'link' => [ |
|
273 | - 'since' => '13.0.0', |
|
274 | - 'required' => false, |
|
275 | - 'description' => 'The full URL that should be opened when clicking the highlighted text.', |
|
276 | - 'example' => 'http://localhost/index.php/f/42', |
|
277 | - ], |
|
278 | - ], |
|
279 | - ], |
|
280 | - 'open-graph' => [ |
|
281 | - 'author' => 'Maxence Lange', |
|
282 | - 'app' => 'mood', |
|
283 | - 'since' => '12.0.0', |
|
284 | - 'parameters' => [ |
|
285 | - 'id' => [ |
|
286 | - 'since' => '12.0.0', |
|
287 | - 'required' => true, |
|
288 | - 'description' => 'The id used to identify the open graph data on the instance', |
|
289 | - 'example' => '42', |
|
290 | - ], |
|
291 | - 'name' => [ |
|
292 | - 'since' => '12.0.0', |
|
293 | - 'required' => true, |
|
294 | - 'description' => 'The open graph title of the website', |
|
295 | - 'example' => 'This is a website', |
|
296 | - ], |
|
297 | - 'description' => [ |
|
298 | - 'since' => '12.0.0', |
|
299 | - 'required' => false, |
|
300 | - 'description' => 'The open graph description from the website', |
|
301 | - 'example' => 'This is the description of the website', |
|
302 | - ], |
|
303 | - 'thumb' => [ |
|
304 | - 'since' => '12.0.0', |
|
305 | - 'required' => false, |
|
306 | - 'description' => 'The full URL of the open graph thumbnail', |
|
307 | - 'example' => 'http://localhost/index.php/apps/mood/data/image?url=https%3A%2F%2Fthumb.example.com%2Fimage.png', |
|
308 | - ], |
|
309 | - 'website' => [ |
|
310 | - 'since' => '12.0.0', |
|
311 | - 'required' => false, |
|
312 | - 'description' => 'The name of the described website', |
|
313 | - 'example' => 'Nextcloud - App Store', |
|
314 | - ], |
|
315 | - 'link' => [ |
|
316 | - 'since' => '12.0.0', |
|
317 | - 'required' => false, |
|
318 | - 'description' => 'The full link to the website', |
|
319 | - 'example' => 'https://apps.nextcloud.com/apps/mood', |
|
320 | - ], |
|
321 | - ], |
|
322 | - ], |
|
323 | - 'pending-federated-share' => [ |
|
324 | - 'author' => 'Nextcloud', |
|
325 | - 'app' => 'dav', |
|
326 | - 'since' => '11.0.0', |
|
327 | - 'parameters' => [ |
|
328 | - 'id' => [ |
|
329 | - 'since' => '11.0.0', |
|
330 | - 'required' => true, |
|
331 | - 'description' => 'The id used to identify the federated share on the instance', |
|
332 | - 'example' => '42', |
|
333 | - ], |
|
334 | - 'name' => [ |
|
335 | - 'since' => '11.0.0', |
|
336 | - 'required' => true, |
|
337 | - 'description' => 'The name of the shared item which should be used in the visual representation', |
|
338 | - 'example' => 'file.txt', |
|
339 | - ], |
|
340 | - ], |
|
341 | - ], |
|
342 | - 'systemtag' => [ |
|
343 | - 'author' => 'Nextcloud', |
|
344 | - 'app' => 'core', |
|
345 | - 'since' => '11.0.0', |
|
346 | - 'parameters' => [ |
|
347 | - 'id' => [ |
|
348 | - 'since' => '11.0.0', |
|
349 | - 'required' => true, |
|
350 | - 'description' => 'The id used to identify the systemtag on the instance', |
|
351 | - 'example' => '23', |
|
352 | - ], |
|
353 | - 'name' => [ |
|
354 | - 'since' => '11.0.0', |
|
355 | - 'required' => true, |
|
356 | - 'description' => 'The display name of the systemtag which should be used in the visual representation', |
|
357 | - 'example' => 'Project 1', |
|
358 | - ], |
|
359 | - 'visibility' => [ |
|
360 | - 'since' => '11.0.0', |
|
361 | - 'required' => true, |
|
362 | - 'description' => 'If the user can see the systemtag', |
|
363 | - 'example' => '1', |
|
364 | - ], |
|
365 | - 'assignable' => [ |
|
366 | - 'since' => '11.0.0', |
|
367 | - 'required' => true, |
|
368 | - 'description' => 'If the user can assign the systemtag', |
|
369 | - 'example' => '0', |
|
370 | - ], |
|
371 | - ], |
|
372 | - ], |
|
373 | - 'user' => [ |
|
374 | - 'author' => 'Nextcloud', |
|
375 | - 'app' => 'core', |
|
376 | - 'since' => '11.0.0', |
|
377 | - 'parameters' => [ |
|
378 | - 'id' => [ |
|
379 | - 'since' => '11.0.0', |
|
380 | - 'required' => true, |
|
381 | - 'description' => 'The id used to identify the user on the instance', |
|
382 | - 'example' => 'johndoe', |
|
383 | - ], |
|
384 | - 'name' => [ |
|
385 | - 'since' => '11.0.0', |
|
386 | - 'required' => true, |
|
387 | - 'description' => 'The display name of the user which should be used in the visual representation', |
|
388 | - 'example' => 'John Doe', |
|
389 | - ], |
|
390 | - 'server' => [ |
|
391 | - 'since' => '11.0.0', |
|
392 | - 'required' => false, |
|
393 | - 'description' => 'The URL of the instance the user lives on', |
|
394 | - 'example' => 'localhost', |
|
395 | - ], |
|
396 | - ], |
|
397 | - ], |
|
398 | - 'user-group' => [ |
|
399 | - 'author' => 'Nextcloud', |
|
400 | - 'app' => 'core', |
|
401 | - 'since' => '11.0.0', |
|
402 | - 'parameters' => [ |
|
403 | - 'id' => [ |
|
404 | - 'since' => '11.0.0', |
|
405 | - 'required' => true, |
|
406 | - 'description' => 'The id used to identify the group on the instance', |
|
407 | - 'example' => 'supportteam', |
|
408 | - ], |
|
409 | - 'name' => [ |
|
410 | - 'since' => '11.0.0', |
|
411 | - 'required' => true, |
|
412 | - 'description' => 'The display name of the group which should be used in the visual representation', |
|
413 | - 'example' => 'Support Team', |
|
414 | - ], |
|
415 | - ], |
|
416 | - ], |
|
417 | - ]; |
|
32 | + /** |
|
33 | + * @var array |
|
34 | + * @since 11.0.0 |
|
35 | + */ |
|
36 | + public $definitions = [ |
|
37 | + 'addressbook' => [ |
|
38 | + 'author' => 'Nextcloud', |
|
39 | + 'app' => 'dav', |
|
40 | + 'since' => '11.0.0', |
|
41 | + 'parameters' => [ |
|
42 | + 'id' => [ |
|
43 | + 'since' => '11.0.0', |
|
44 | + 'required' => true, |
|
45 | + 'description' => 'The id used to identify the addressbook on the instance', |
|
46 | + 'example' => '42', |
|
47 | + ], |
|
48 | + 'name' => [ |
|
49 | + 'since' => '11.0.0', |
|
50 | + 'required' => true, |
|
51 | + 'description' => 'The display name of the addressbook which should be used in the visual representation', |
|
52 | + 'example' => 'Contacts', |
|
53 | + ], |
|
54 | + ], |
|
55 | + ], |
|
56 | + 'addressbook-contact' => [ |
|
57 | + 'author' => 'Nextcloud', |
|
58 | + 'app' => 'dav', |
|
59 | + 'since' => '11.0.0', |
|
60 | + 'parameters' => [ |
|
61 | + 'id' => [ |
|
62 | + 'since' => '11.0.0', |
|
63 | + 'required' => true, |
|
64 | + 'description' => 'The id used to identify the contact on the instance', |
|
65 | + 'example' => '42', |
|
66 | + ], |
|
67 | + 'name' => [ |
|
68 | + 'since' => '11.0.0', |
|
69 | + 'required' => true, |
|
70 | + 'description' => 'The display name of the contact which should be used in the visual representation', |
|
71 | + 'example' => 'John Doe', |
|
72 | + ], |
|
73 | + ], |
|
74 | + ], |
|
75 | + 'announcement' => [ |
|
76 | + 'author' => 'Joas Schilling', |
|
77 | + 'app' => 'announcementcenter', |
|
78 | + 'since' => '11.0.0', |
|
79 | + 'parameters' => [ |
|
80 | + 'id' => [ |
|
81 | + 'since' => '11.0.0', |
|
82 | + 'required' => true, 'description' => 'The id used to identify the announcement on the instance', |
|
83 | + 'example' => '42', |
|
84 | + ], |
|
85 | + 'name' => [ |
|
86 | + 'since' => '11.0.0', |
|
87 | + 'required' => true, |
|
88 | + 'description' => 'The announcement subject which should be used in the visual representation', |
|
89 | + 'example' => 'file.txt', |
|
90 | + ], |
|
91 | + 'link' => [ |
|
92 | + 'since' => '11.0.0', |
|
93 | + 'required' => false, |
|
94 | + 'description' => 'The full URL to the file', |
|
95 | + 'example' => 'http://localhost/index.php/apps/announcements/#23', |
|
96 | + ], |
|
97 | + ], |
|
98 | + ], |
|
99 | + 'app' => [ |
|
100 | + 'author' => 'Nextcloud', |
|
101 | + 'app' => 'updatenotification', |
|
102 | + 'since' => '11.0.0', |
|
103 | + 'parameters' => [ |
|
104 | + 'id' => [ |
|
105 | + 'since' => '11.0.0', |
|
106 | + 'required' => true, 'description' => 'The app id', |
|
107 | + 'example' => 'updatenotification', |
|
108 | + ], |
|
109 | + 'name' => [ |
|
110 | + 'since' => '11.0.0', |
|
111 | + 'required' => true, |
|
112 | + 'description' => 'The name of the app which should be used in the visual representation', |
|
113 | + 'example' => 'Update notification', |
|
114 | + ], |
|
115 | + ], |
|
116 | + ], |
|
117 | + 'calendar' => [ |
|
118 | + 'author' => 'Nextcloud', |
|
119 | + 'app' => 'dav', |
|
120 | + 'since' => '11.0.0', |
|
121 | + 'parameters' => [ |
|
122 | + 'id' => [ |
|
123 | + 'since' => '11.0.0', |
|
124 | + 'required' => true, |
|
125 | + 'description' => 'The id used to identify the calendar on the instance', |
|
126 | + 'example' => '42', |
|
127 | + ], |
|
128 | + 'name' => [ |
|
129 | + 'since' => '11.0.0', |
|
130 | + 'required' => true, |
|
131 | + 'description' => 'The display name of the calendar which should be used in the visual representation', |
|
132 | + 'example' => 'Personal', |
|
133 | + ], |
|
134 | + ], |
|
135 | + ], |
|
136 | + 'calendar-event' => [ |
|
137 | + 'author' => 'Nextcloud', |
|
138 | + 'app' => 'dav', |
|
139 | + 'since' => '11.0.0', |
|
140 | + 'parameters' => [ |
|
141 | + 'id' => [ |
|
142 | + 'since' => '11.0.0', |
|
143 | + 'required' => true, |
|
144 | + 'description' => 'The id used to identify the event on the instance', |
|
145 | + 'example' => '42', |
|
146 | + ], |
|
147 | + 'name' => [ |
|
148 | + 'since' => '11.0.0', |
|
149 | + 'required' => true, |
|
150 | + 'description' => 'The display name of the event which should be used in the visual representation', |
|
151 | + 'example' => 'Workout', |
|
152 | + ], |
|
153 | + ], |
|
154 | + ], |
|
155 | + 'call' => [ |
|
156 | + 'author' => 'Nextcloud', |
|
157 | + 'app' => 'spreed', |
|
158 | + 'since' => '11.0.2', |
|
159 | + 'parameters' => [ |
|
160 | + 'id' => [ |
|
161 | + 'since' => '11.0.2', |
|
162 | + 'required' => true, |
|
163 | + 'description' => 'The id used to identify the call on the instance', |
|
164 | + 'example' => '42', |
|
165 | + ], |
|
166 | + 'name' => [ |
|
167 | + 'since' => '11.0.2', |
|
168 | + 'required' => true, |
|
169 | + 'description' => 'The display name of the call which should be used in the visual representation', |
|
170 | + 'example' => 'Company call', |
|
171 | + ], |
|
172 | + 'call-type' => [ |
|
173 | + 'since' => '11.0.2', |
|
174 | + 'required' => true, |
|
175 | + 'description' => 'The type of the call: one2one, group or public', |
|
176 | + 'example' => 'one2one', |
|
177 | + ], |
|
178 | + ], |
|
179 | + ], |
|
180 | + 'circle' => [ |
|
181 | + 'author' => 'Maxence Lange', |
|
182 | + 'app' => 'circles', |
|
183 | + 'since' => '12.0.0', |
|
184 | + 'parameters' => [ |
|
185 | + 'id' => [ |
|
186 | + 'since' => '12.0.0', |
|
187 | + 'required' => true, |
|
188 | + 'description' => 'The id used to identify the circle on the instance', |
|
189 | + 'example' => '42', |
|
190 | + ], |
|
191 | + 'name' => [ |
|
192 | + 'since' => '12.0.0', |
|
193 | + 'required' => true, |
|
194 | + 'description' => 'The display name of the circle which should be used in the visual representation', |
|
195 | + 'example' => 'My friends', |
|
196 | + ], |
|
197 | + 'link' => [ |
|
198 | + 'since' => '12.0.0', |
|
199 | + 'required' => true, |
|
200 | + 'description' => 'The full URL to the circle', |
|
201 | + 'example' => 'http://localhost/index.php/apps/circles/#42', |
|
202 | + ], |
|
203 | + ], |
|
204 | + ], |
|
205 | + 'email' => [ |
|
206 | + 'author' => 'Nextcloud', |
|
207 | + 'app' => 'sharebymail', |
|
208 | + 'since' => '11.0.0', |
|
209 | + 'parameters' => [ |
|
210 | + 'id' => [ |
|
211 | + 'since' => '11.0.0', |
|
212 | + 'required' => true, |
|
213 | + 'description' => 'The mail-address used to identify the event on the instance', |
|
214 | + 'example' => 'test@localhost', |
|
215 | + ], |
|
216 | + 'name' => [ |
|
217 | + 'since' => '11.0.0', |
|
218 | + 'required' => true, |
|
219 | + 'description' => 'The display name of a matching contact or the email (fallback) which should be used in the visual representation', |
|
220 | + 'example' => 'Foo Bar', |
|
221 | + ], |
|
222 | + ], |
|
223 | + ], |
|
224 | + 'file' => [ |
|
225 | + 'author' => 'Nextcloud', |
|
226 | + 'app' => 'dav', |
|
227 | + 'since' => '11.0.0', |
|
228 | + 'parameters' => [ |
|
229 | + 'id' => [ |
|
230 | + 'since' => '11.0.0', |
|
231 | + 'required' => true, |
|
232 | + 'description' => 'The id used to identify the file on the instance', |
|
233 | + 'example' => '42', |
|
234 | + ], |
|
235 | + 'name' => [ |
|
236 | + 'since' => '11.0.0', |
|
237 | + 'required' => true, |
|
238 | + 'description' => 'The file name which should be used in the visual representation', |
|
239 | + 'example' => 'file.txt', |
|
240 | + ], |
|
241 | + 'path' => [ |
|
242 | + 'since' => '11.0.0', |
|
243 | + 'required' => true, |
|
244 | + 'description' => 'The full path of the file for the user, should not start with a slash', |
|
245 | + 'example' => 'path/to/file.txt', |
|
246 | + ], |
|
247 | + 'link' => [ |
|
248 | + 'since' => '11.0.0', |
|
249 | + 'required' => false, |
|
250 | + 'description' => 'The full URL to the file', |
|
251 | + 'example' => 'http://localhost/index.php/f/42', |
|
252 | + ], |
|
253 | + ], |
|
254 | + ], |
|
255 | + 'highlight' => [ |
|
256 | + 'author' => 'Nextcloud', |
|
257 | + 'app' => 'core', |
|
258 | + 'since' => '13.0.0', |
|
259 | + 'parameters' => [ |
|
260 | + 'id' => [ |
|
261 | + 'since' => '13.0.0', |
|
262 | + 'required' => true, |
|
263 | + 'description' => 'The id used to identify the highlighted object on the instance', |
|
264 | + 'example' => '42', |
|
265 | + ], |
|
266 | + 'name' => [ |
|
267 | + 'since' => '13.0.0', |
|
268 | + 'required' => true, |
|
269 | + 'description' => 'The string that should be highlighted.', |
|
270 | + 'example' => 'Hello World', |
|
271 | + ], |
|
272 | + 'link' => [ |
|
273 | + 'since' => '13.0.0', |
|
274 | + 'required' => false, |
|
275 | + 'description' => 'The full URL that should be opened when clicking the highlighted text.', |
|
276 | + 'example' => 'http://localhost/index.php/f/42', |
|
277 | + ], |
|
278 | + ], |
|
279 | + ], |
|
280 | + 'open-graph' => [ |
|
281 | + 'author' => 'Maxence Lange', |
|
282 | + 'app' => 'mood', |
|
283 | + 'since' => '12.0.0', |
|
284 | + 'parameters' => [ |
|
285 | + 'id' => [ |
|
286 | + 'since' => '12.0.0', |
|
287 | + 'required' => true, |
|
288 | + 'description' => 'The id used to identify the open graph data on the instance', |
|
289 | + 'example' => '42', |
|
290 | + ], |
|
291 | + 'name' => [ |
|
292 | + 'since' => '12.0.0', |
|
293 | + 'required' => true, |
|
294 | + 'description' => 'The open graph title of the website', |
|
295 | + 'example' => 'This is a website', |
|
296 | + ], |
|
297 | + 'description' => [ |
|
298 | + 'since' => '12.0.0', |
|
299 | + 'required' => false, |
|
300 | + 'description' => 'The open graph description from the website', |
|
301 | + 'example' => 'This is the description of the website', |
|
302 | + ], |
|
303 | + 'thumb' => [ |
|
304 | + 'since' => '12.0.0', |
|
305 | + 'required' => false, |
|
306 | + 'description' => 'The full URL of the open graph thumbnail', |
|
307 | + 'example' => 'http://localhost/index.php/apps/mood/data/image?url=https%3A%2F%2Fthumb.example.com%2Fimage.png', |
|
308 | + ], |
|
309 | + 'website' => [ |
|
310 | + 'since' => '12.0.0', |
|
311 | + 'required' => false, |
|
312 | + 'description' => 'The name of the described website', |
|
313 | + 'example' => 'Nextcloud - App Store', |
|
314 | + ], |
|
315 | + 'link' => [ |
|
316 | + 'since' => '12.0.0', |
|
317 | + 'required' => false, |
|
318 | + 'description' => 'The full link to the website', |
|
319 | + 'example' => 'https://apps.nextcloud.com/apps/mood', |
|
320 | + ], |
|
321 | + ], |
|
322 | + ], |
|
323 | + 'pending-federated-share' => [ |
|
324 | + 'author' => 'Nextcloud', |
|
325 | + 'app' => 'dav', |
|
326 | + 'since' => '11.0.0', |
|
327 | + 'parameters' => [ |
|
328 | + 'id' => [ |
|
329 | + 'since' => '11.0.0', |
|
330 | + 'required' => true, |
|
331 | + 'description' => 'The id used to identify the federated share on the instance', |
|
332 | + 'example' => '42', |
|
333 | + ], |
|
334 | + 'name' => [ |
|
335 | + 'since' => '11.0.0', |
|
336 | + 'required' => true, |
|
337 | + 'description' => 'The name of the shared item which should be used in the visual representation', |
|
338 | + 'example' => 'file.txt', |
|
339 | + ], |
|
340 | + ], |
|
341 | + ], |
|
342 | + 'systemtag' => [ |
|
343 | + 'author' => 'Nextcloud', |
|
344 | + 'app' => 'core', |
|
345 | + 'since' => '11.0.0', |
|
346 | + 'parameters' => [ |
|
347 | + 'id' => [ |
|
348 | + 'since' => '11.0.0', |
|
349 | + 'required' => true, |
|
350 | + 'description' => 'The id used to identify the systemtag on the instance', |
|
351 | + 'example' => '23', |
|
352 | + ], |
|
353 | + 'name' => [ |
|
354 | + 'since' => '11.0.0', |
|
355 | + 'required' => true, |
|
356 | + 'description' => 'The display name of the systemtag which should be used in the visual representation', |
|
357 | + 'example' => 'Project 1', |
|
358 | + ], |
|
359 | + 'visibility' => [ |
|
360 | + 'since' => '11.0.0', |
|
361 | + 'required' => true, |
|
362 | + 'description' => 'If the user can see the systemtag', |
|
363 | + 'example' => '1', |
|
364 | + ], |
|
365 | + 'assignable' => [ |
|
366 | + 'since' => '11.0.0', |
|
367 | + 'required' => true, |
|
368 | + 'description' => 'If the user can assign the systemtag', |
|
369 | + 'example' => '0', |
|
370 | + ], |
|
371 | + ], |
|
372 | + ], |
|
373 | + 'user' => [ |
|
374 | + 'author' => 'Nextcloud', |
|
375 | + 'app' => 'core', |
|
376 | + 'since' => '11.0.0', |
|
377 | + 'parameters' => [ |
|
378 | + 'id' => [ |
|
379 | + 'since' => '11.0.0', |
|
380 | + 'required' => true, |
|
381 | + 'description' => 'The id used to identify the user on the instance', |
|
382 | + 'example' => 'johndoe', |
|
383 | + ], |
|
384 | + 'name' => [ |
|
385 | + 'since' => '11.0.0', |
|
386 | + 'required' => true, |
|
387 | + 'description' => 'The display name of the user which should be used in the visual representation', |
|
388 | + 'example' => 'John Doe', |
|
389 | + ], |
|
390 | + 'server' => [ |
|
391 | + 'since' => '11.0.0', |
|
392 | + 'required' => false, |
|
393 | + 'description' => 'The URL of the instance the user lives on', |
|
394 | + 'example' => 'localhost', |
|
395 | + ], |
|
396 | + ], |
|
397 | + ], |
|
398 | + 'user-group' => [ |
|
399 | + 'author' => 'Nextcloud', |
|
400 | + 'app' => 'core', |
|
401 | + 'since' => '11.0.0', |
|
402 | + 'parameters' => [ |
|
403 | + 'id' => [ |
|
404 | + 'since' => '11.0.0', |
|
405 | + 'required' => true, |
|
406 | + 'description' => 'The id used to identify the group on the instance', |
|
407 | + 'example' => 'supportteam', |
|
408 | + ], |
|
409 | + 'name' => [ |
|
410 | + 'since' => '11.0.0', |
|
411 | + 'required' => true, |
|
412 | + 'description' => 'The display name of the group which should be used in the visual representation', |
|
413 | + 'example' => 'Support Team', |
|
414 | + ], |
|
415 | + ], |
|
416 | + ], |
|
417 | + ]; |
|
418 | 418 | |
419 | - /** |
|
420 | - * @param string $type |
|
421 | - * @return array |
|
422 | - * @throws InvalidObjectExeption |
|
423 | - * @since 11.0.0 |
|
424 | - */ |
|
425 | - public function getDefinition($type) { |
|
426 | - if (isset($this->definitions[$type])) { |
|
427 | - return $this->definitions[$type]; |
|
428 | - } |
|
419 | + /** |
|
420 | + * @param string $type |
|
421 | + * @return array |
|
422 | + * @throws InvalidObjectExeption |
|
423 | + * @since 11.0.0 |
|
424 | + */ |
|
425 | + public function getDefinition($type) { |
|
426 | + if (isset($this->definitions[$type])) { |
|
427 | + return $this->definitions[$type]; |
|
428 | + } |
|
429 | 429 | |
430 | - throw new InvalidObjectExeption('Object type is undefined'); |
|
431 | - } |
|
430 | + throw new InvalidObjectExeption('Object type is undefined'); |
|
431 | + } |
|
432 | 432 | } |
@@ -29,164 +29,164 @@ |
||
29 | 29 | use OCP\Migration\IRepairStep; |
30 | 30 | |
31 | 31 | class RepairInvalidPaths implements IRepairStep { |
32 | - const MAX_ROWS = 1000; |
|
33 | - |
|
34 | - /** @var IDBConnection */ |
|
35 | - private $connection; |
|
36 | - /** @var IConfig */ |
|
37 | - private $config; |
|
38 | - |
|
39 | - private $getIdQuery; |
|
40 | - private $updateQuery; |
|
41 | - private $reparentQuery; |
|
42 | - private $deleteQuery; |
|
43 | - |
|
44 | - public function __construct(IDBConnection $connection, IConfig $config) { |
|
45 | - $this->connection = $connection; |
|
46 | - $this->config = $config; |
|
47 | - } |
|
48 | - |
|
49 | - |
|
50 | - public function getName() { |
|
51 | - return 'Repair invalid paths in file cache'; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * @return \Generator |
|
56 | - * @suppress SqlInjectionChecker |
|
57 | - */ |
|
58 | - private function getInvalidEntries() { |
|
59 | - $builder = $this->connection->getQueryBuilder(); |
|
60 | - |
|
61 | - $computedPath = $builder->func()->concat( |
|
62 | - 'p.path', |
|
63 | - $builder->func()->concat($builder->createNamedParameter('/'), 'f.name') |
|
64 | - ); |
|
65 | - |
|
66 | - //select f.path, f.parent,p.path from oc_filecache f inner join oc_filecache p on f.parent=p.fileid and p.path!='' where f.path != p.path || '/' || f.name; |
|
67 | - $builder->select('f.fileid', 'f.path', 'f.name', 'f.parent', 'f.storage') |
|
68 | - ->selectAlias('p.path', 'parent_path') |
|
69 | - ->selectAlias('p.storage', 'parent_storage') |
|
70 | - ->from('filecache', 'f') |
|
71 | - ->innerJoin('f', 'filecache', 'p', $builder->expr()->andX( |
|
72 | - $builder->expr()->eq('f.parent', 'p.fileid'), |
|
73 | - $builder->expr()->nonEmptyString('p.name') |
|
74 | - )) |
|
75 | - ->where($builder->expr()->neq('f.path', $computedPath)) |
|
76 | - ->setMaxResults(self::MAX_ROWS); |
|
77 | - |
|
78 | - do { |
|
79 | - $result = $builder->execute(); |
|
80 | - $rows = $result->fetchAll(); |
|
81 | - foreach ($rows as $row) { |
|
82 | - yield $row; |
|
83 | - } |
|
84 | - $result->closeCursor(); |
|
85 | - } while (count($rows) > 0); |
|
86 | - } |
|
87 | - |
|
88 | - private function getId($storage, $path) { |
|
89 | - if (!$this->getIdQuery) { |
|
90 | - $builder = $this->connection->getQueryBuilder(); |
|
91 | - |
|
92 | - $this->getIdQuery = $builder->select('fileid') |
|
93 | - ->from('filecache') |
|
94 | - ->where($builder->expr()->eq('storage', $builder->createParameter('storage'))) |
|
95 | - ->andWhere($builder->expr()->eq('path_hash', $builder->createParameter('path_hash'))); |
|
96 | - } |
|
97 | - |
|
98 | - $this->getIdQuery->setParameter('storage', $storage, IQueryBuilder::PARAM_INT); |
|
99 | - $this->getIdQuery->setParameter('path_hash', md5($path)); |
|
100 | - |
|
101 | - return $this->getIdQuery->execute()->fetchColumn(); |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * @param string $fileid |
|
106 | - * @param string $newPath |
|
107 | - * @param string $newStorage |
|
108 | - * @suppress SqlInjectionChecker |
|
109 | - */ |
|
110 | - private function update($fileid, $newPath, $newStorage) { |
|
111 | - if (!$this->updateQuery) { |
|
112 | - $builder = $this->connection->getQueryBuilder(); |
|
113 | - |
|
114 | - $this->updateQuery = $builder->update('filecache') |
|
115 | - ->set('path', $builder->createParameter('newpath')) |
|
116 | - ->set('path_hash', $builder->func()->md5($builder->createParameter('newpath'))) |
|
117 | - ->set('storage', $builder->createParameter('newstorage')) |
|
118 | - ->where($builder->expr()->eq('fileid', $builder->createParameter('fileid'))); |
|
119 | - } |
|
120 | - |
|
121 | - $this->updateQuery->setParameter('newpath', $newPath); |
|
122 | - $this->updateQuery->setParameter('newstorage', $newStorage); |
|
123 | - $this->updateQuery->setParameter('fileid', $fileid, IQueryBuilder::PARAM_INT); |
|
124 | - |
|
125 | - $this->updateQuery->execute(); |
|
126 | - } |
|
127 | - |
|
128 | - private function reparent($from, $to) { |
|
129 | - if (!$this->reparentQuery) { |
|
130 | - $builder = $this->connection->getQueryBuilder(); |
|
131 | - |
|
132 | - $this->reparentQuery = $builder->update('filecache') |
|
133 | - ->set('parent', $builder->createParameter('to')) |
|
134 | - ->where($builder->expr()->eq('fileid', $builder->createParameter('from'))); |
|
135 | - } |
|
136 | - |
|
137 | - $this->reparentQuery->setParameter('from', $from); |
|
138 | - $this->reparentQuery->setParameter('to', $to); |
|
139 | - |
|
140 | - $this->reparentQuery->execute(); |
|
141 | - } |
|
142 | - |
|
143 | - private function delete($fileid) { |
|
144 | - if (!$this->deleteQuery) { |
|
145 | - $builder = $this->connection->getQueryBuilder(); |
|
146 | - |
|
147 | - $this->deleteQuery = $builder->delete('filecache') |
|
148 | - ->where($builder->expr()->eq('fileid', $builder->createParameter('fileid'))); |
|
149 | - } |
|
150 | - |
|
151 | - $this->deleteQuery->setParameter('fileid', $fileid, IQueryBuilder::PARAM_INT); |
|
152 | - |
|
153 | - $this->deleteQuery->execute(); |
|
154 | - } |
|
155 | - |
|
156 | - private function repair() { |
|
157 | - $this->connection->beginTransaction(); |
|
158 | - $entries = $this->getInvalidEntries(); |
|
159 | - $count = 0; |
|
160 | - foreach ($entries as $entry) { |
|
161 | - $count++; |
|
162 | - $calculatedPath = $entry['parent_path'] . '/' . $entry['name']; |
|
163 | - if ($newId = $this->getId($entry['parent_storage'], $calculatedPath)) { |
|
164 | - // a new entry with the correct path has already been created, reuse that one and delete the incorrect entry |
|
165 | - $this->reparent($entry['fileid'], $newId); |
|
166 | - $this->delete($entry['fileid']); |
|
167 | - } else { |
|
168 | - $this->update($entry['fileid'], $calculatedPath, $entry['parent_storage']); |
|
169 | - } |
|
170 | - } |
|
171 | - $this->connection->commit(); |
|
172 | - return $count; |
|
173 | - } |
|
174 | - |
|
175 | - private function shouldRun() { |
|
176 | - $versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0'); |
|
177 | - |
|
178 | - // was added to 11.0.5.2, 12.0.0.30 and 13.0.0.1 |
|
179 | - $shouldRun = version_compare($versionFromBeforeUpdate, '11.0.5.2', '<'); |
|
180 | - $shouldRun |= version_compare($versionFromBeforeUpdate, '12.0.0.0', '>=') && version_compare($versionFromBeforeUpdate, '12.0.0.30', '<'); |
|
181 | - $shouldRun |= version_compare($versionFromBeforeUpdate, '13.0.0.0', '=='); |
|
182 | - return $shouldRun; |
|
183 | - } |
|
184 | - |
|
185 | - public function run(IOutput $output) { |
|
186 | - if ($this->shouldRun()) { |
|
187 | - $count = $this->repair(); |
|
188 | - |
|
189 | - $output->info('Repaired ' . $count . ' paths'); |
|
190 | - } |
|
191 | - } |
|
32 | + const MAX_ROWS = 1000; |
|
33 | + |
|
34 | + /** @var IDBConnection */ |
|
35 | + private $connection; |
|
36 | + /** @var IConfig */ |
|
37 | + private $config; |
|
38 | + |
|
39 | + private $getIdQuery; |
|
40 | + private $updateQuery; |
|
41 | + private $reparentQuery; |
|
42 | + private $deleteQuery; |
|
43 | + |
|
44 | + public function __construct(IDBConnection $connection, IConfig $config) { |
|
45 | + $this->connection = $connection; |
|
46 | + $this->config = $config; |
|
47 | + } |
|
48 | + |
|
49 | + |
|
50 | + public function getName() { |
|
51 | + return 'Repair invalid paths in file cache'; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * @return \Generator |
|
56 | + * @suppress SqlInjectionChecker |
|
57 | + */ |
|
58 | + private function getInvalidEntries() { |
|
59 | + $builder = $this->connection->getQueryBuilder(); |
|
60 | + |
|
61 | + $computedPath = $builder->func()->concat( |
|
62 | + 'p.path', |
|
63 | + $builder->func()->concat($builder->createNamedParameter('/'), 'f.name') |
|
64 | + ); |
|
65 | + |
|
66 | + //select f.path, f.parent,p.path from oc_filecache f inner join oc_filecache p on f.parent=p.fileid and p.path!='' where f.path != p.path || '/' || f.name; |
|
67 | + $builder->select('f.fileid', 'f.path', 'f.name', 'f.parent', 'f.storage') |
|
68 | + ->selectAlias('p.path', 'parent_path') |
|
69 | + ->selectAlias('p.storage', 'parent_storage') |
|
70 | + ->from('filecache', 'f') |
|
71 | + ->innerJoin('f', 'filecache', 'p', $builder->expr()->andX( |
|
72 | + $builder->expr()->eq('f.parent', 'p.fileid'), |
|
73 | + $builder->expr()->nonEmptyString('p.name') |
|
74 | + )) |
|
75 | + ->where($builder->expr()->neq('f.path', $computedPath)) |
|
76 | + ->setMaxResults(self::MAX_ROWS); |
|
77 | + |
|
78 | + do { |
|
79 | + $result = $builder->execute(); |
|
80 | + $rows = $result->fetchAll(); |
|
81 | + foreach ($rows as $row) { |
|
82 | + yield $row; |
|
83 | + } |
|
84 | + $result->closeCursor(); |
|
85 | + } while (count($rows) > 0); |
|
86 | + } |
|
87 | + |
|
88 | + private function getId($storage, $path) { |
|
89 | + if (!$this->getIdQuery) { |
|
90 | + $builder = $this->connection->getQueryBuilder(); |
|
91 | + |
|
92 | + $this->getIdQuery = $builder->select('fileid') |
|
93 | + ->from('filecache') |
|
94 | + ->where($builder->expr()->eq('storage', $builder->createParameter('storage'))) |
|
95 | + ->andWhere($builder->expr()->eq('path_hash', $builder->createParameter('path_hash'))); |
|
96 | + } |
|
97 | + |
|
98 | + $this->getIdQuery->setParameter('storage', $storage, IQueryBuilder::PARAM_INT); |
|
99 | + $this->getIdQuery->setParameter('path_hash', md5($path)); |
|
100 | + |
|
101 | + return $this->getIdQuery->execute()->fetchColumn(); |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * @param string $fileid |
|
106 | + * @param string $newPath |
|
107 | + * @param string $newStorage |
|
108 | + * @suppress SqlInjectionChecker |
|
109 | + */ |
|
110 | + private function update($fileid, $newPath, $newStorage) { |
|
111 | + if (!$this->updateQuery) { |
|
112 | + $builder = $this->connection->getQueryBuilder(); |
|
113 | + |
|
114 | + $this->updateQuery = $builder->update('filecache') |
|
115 | + ->set('path', $builder->createParameter('newpath')) |
|
116 | + ->set('path_hash', $builder->func()->md5($builder->createParameter('newpath'))) |
|
117 | + ->set('storage', $builder->createParameter('newstorage')) |
|
118 | + ->where($builder->expr()->eq('fileid', $builder->createParameter('fileid'))); |
|
119 | + } |
|
120 | + |
|
121 | + $this->updateQuery->setParameter('newpath', $newPath); |
|
122 | + $this->updateQuery->setParameter('newstorage', $newStorage); |
|
123 | + $this->updateQuery->setParameter('fileid', $fileid, IQueryBuilder::PARAM_INT); |
|
124 | + |
|
125 | + $this->updateQuery->execute(); |
|
126 | + } |
|
127 | + |
|
128 | + private function reparent($from, $to) { |
|
129 | + if (!$this->reparentQuery) { |
|
130 | + $builder = $this->connection->getQueryBuilder(); |
|
131 | + |
|
132 | + $this->reparentQuery = $builder->update('filecache') |
|
133 | + ->set('parent', $builder->createParameter('to')) |
|
134 | + ->where($builder->expr()->eq('fileid', $builder->createParameter('from'))); |
|
135 | + } |
|
136 | + |
|
137 | + $this->reparentQuery->setParameter('from', $from); |
|
138 | + $this->reparentQuery->setParameter('to', $to); |
|
139 | + |
|
140 | + $this->reparentQuery->execute(); |
|
141 | + } |
|
142 | + |
|
143 | + private function delete($fileid) { |
|
144 | + if (!$this->deleteQuery) { |
|
145 | + $builder = $this->connection->getQueryBuilder(); |
|
146 | + |
|
147 | + $this->deleteQuery = $builder->delete('filecache') |
|
148 | + ->where($builder->expr()->eq('fileid', $builder->createParameter('fileid'))); |
|
149 | + } |
|
150 | + |
|
151 | + $this->deleteQuery->setParameter('fileid', $fileid, IQueryBuilder::PARAM_INT); |
|
152 | + |
|
153 | + $this->deleteQuery->execute(); |
|
154 | + } |
|
155 | + |
|
156 | + private function repair() { |
|
157 | + $this->connection->beginTransaction(); |
|
158 | + $entries = $this->getInvalidEntries(); |
|
159 | + $count = 0; |
|
160 | + foreach ($entries as $entry) { |
|
161 | + $count++; |
|
162 | + $calculatedPath = $entry['parent_path'] . '/' . $entry['name']; |
|
163 | + if ($newId = $this->getId($entry['parent_storage'], $calculatedPath)) { |
|
164 | + // a new entry with the correct path has already been created, reuse that one and delete the incorrect entry |
|
165 | + $this->reparent($entry['fileid'], $newId); |
|
166 | + $this->delete($entry['fileid']); |
|
167 | + } else { |
|
168 | + $this->update($entry['fileid'], $calculatedPath, $entry['parent_storage']); |
|
169 | + } |
|
170 | + } |
|
171 | + $this->connection->commit(); |
|
172 | + return $count; |
|
173 | + } |
|
174 | + |
|
175 | + private function shouldRun() { |
|
176 | + $versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0'); |
|
177 | + |
|
178 | + // was added to 11.0.5.2, 12.0.0.30 and 13.0.0.1 |
|
179 | + $shouldRun = version_compare($versionFromBeforeUpdate, '11.0.5.2', '<'); |
|
180 | + $shouldRun |= version_compare($versionFromBeforeUpdate, '12.0.0.0', '>=') && version_compare($versionFromBeforeUpdate, '12.0.0.30', '<'); |
|
181 | + $shouldRun |= version_compare($versionFromBeforeUpdate, '13.0.0.0', '=='); |
|
182 | + return $shouldRun; |
|
183 | + } |
|
184 | + |
|
185 | + public function run(IOutput $output) { |
|
186 | + if ($this->shouldRun()) { |
|
187 | + $count = $this->repair(); |
|
188 | + |
|
189 | + $output->info('Repaired ' . $count . ' paths'); |
|
190 | + } |
|
191 | + } |
|
192 | 192 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $count = 0; |
160 | 160 | foreach ($entries as $entry) { |
161 | 161 | $count++; |
162 | - $calculatedPath = $entry['parent_path'] . '/' . $entry['name']; |
|
162 | + $calculatedPath = $entry['parent_path'].'/'.$entry['name']; |
|
163 | 163 | if ($newId = $this->getId($entry['parent_storage'], $calculatedPath)) { |
164 | 164 | // a new entry with the correct path has already been created, reuse that one and delete the incorrect entry |
165 | 165 | $this->reparent($entry['fileid'], $newId); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if ($this->shouldRun()) { |
187 | 187 | $count = $this->repair(); |
188 | 188 | |
189 | - $output->info('Repaired ' . $count . ' paths'); |
|
189 | + $output->info('Repaired '.$count.' paths'); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | } |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | return null; |
50 | 50 | } |
51 | 51 | |
52 | - if(!is_null($this->cache)) { |
|
53 | - $fileCacheKey = $file . filemtime($file); |
|
52 | + if (!is_null($this->cache)) { |
|
53 | + $fileCacheKey = $file.filemtime($file); |
|
54 | 54 | if ($cachedValue = $this->cache->get($fileCacheKey)) { |
55 | 55 | return json_decode($cachedValue, true); |
56 | 56 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $array['settings']['personal-section'] = [$array['settings']['personal-section']]; |
200 | 200 | } |
201 | 201 | |
202 | - if(!is_null($this->cache)) { |
|
202 | + if (!is_null($this->cache)) { |
|
203 | 203 | $this->cache->set($fileCacheKey, json_encode($array)); |
204 | 204 | } |
205 | 205 | return $array; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function xmlToArray($xml) { |
213 | 213 | if (!$xml->children()) { |
214 | - return (string)$xml; |
|
214 | + return (string) $xml; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | $array = []; |
@@ -227,16 +227,16 @@ discard block |
||
227 | 227 | $data = [ |
228 | 228 | '@attributes' => [], |
229 | 229 | ]; |
230 | - if (!count($node->children())){ |
|
231 | - $value = (string)$node; |
|
230 | + if (!count($node->children())) { |
|
231 | + $value = (string) $node; |
|
232 | 232 | if (!empty($value)) { |
233 | - $data['@value'] = (string)$node; |
|
233 | + $data['@value'] = (string) $node; |
|
234 | 234 | } |
235 | 235 | } else { |
236 | 236 | $data = array_merge($data, $this->xmlToArray($node)); |
237 | 237 | } |
238 | 238 | foreach ($attributes as $attr => $value) { |
239 | - $data['@attributes'][$attr] = (string)$value; |
|
239 | + $data['@attributes'][$attr] = (string) $value; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | if ($totalElement > 1) { |
@@ -33,233 +33,233 @@ |
||
33 | 33 | use OCP\ICache; |
34 | 34 | |
35 | 35 | class InfoParser { |
36 | - /** @var \OCP\ICache|null */ |
|
37 | - private $cache; |
|
36 | + /** @var \OCP\ICache|null */ |
|
37 | + private $cache; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param ICache|null $cache |
|
41 | - */ |
|
42 | - public function __construct(ICache $cache = null) { |
|
43 | - $this->cache = $cache; |
|
44 | - } |
|
39 | + /** |
|
40 | + * @param ICache|null $cache |
|
41 | + */ |
|
42 | + public function __construct(ICache $cache = null) { |
|
43 | + $this->cache = $cache; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param string $file the xml file to be loaded |
|
48 | - * @return null|array where null is an indicator for an error |
|
49 | - */ |
|
50 | - public function parse($file) { |
|
51 | - if (!file_exists($file)) { |
|
52 | - return null; |
|
53 | - } |
|
46 | + /** |
|
47 | + * @param string $file the xml file to be loaded |
|
48 | + * @return null|array where null is an indicator for an error |
|
49 | + */ |
|
50 | + public function parse($file) { |
|
51 | + if (!file_exists($file)) { |
|
52 | + return null; |
|
53 | + } |
|
54 | 54 | |
55 | - if(!is_null($this->cache)) { |
|
56 | - $fileCacheKey = $file . filemtime($file); |
|
57 | - if ($cachedValue = $this->cache->get($fileCacheKey)) { |
|
58 | - return json_decode($cachedValue, true); |
|
59 | - } |
|
60 | - } |
|
55 | + if(!is_null($this->cache)) { |
|
56 | + $fileCacheKey = $file . filemtime($file); |
|
57 | + if ($cachedValue = $this->cache->get($fileCacheKey)) { |
|
58 | + return json_decode($cachedValue, true); |
|
59 | + } |
|
60 | + } |
|
61 | 61 | |
62 | - libxml_use_internal_errors(true); |
|
63 | - $loadEntities = libxml_disable_entity_loader(false); |
|
64 | - $xml = simplexml_load_file($file); |
|
62 | + libxml_use_internal_errors(true); |
|
63 | + $loadEntities = libxml_disable_entity_loader(false); |
|
64 | + $xml = simplexml_load_file($file); |
|
65 | 65 | |
66 | - libxml_disable_entity_loader($loadEntities); |
|
67 | - if ($xml === false) { |
|
68 | - libxml_clear_errors(); |
|
69 | - return null; |
|
70 | - } |
|
71 | - $array = $this->xmlToArray($xml); |
|
66 | + libxml_disable_entity_loader($loadEntities); |
|
67 | + if ($xml === false) { |
|
68 | + libxml_clear_errors(); |
|
69 | + return null; |
|
70 | + } |
|
71 | + $array = $this->xmlToArray($xml); |
|
72 | 72 | |
73 | - if (is_null($array)) { |
|
74 | - return null; |
|
75 | - } |
|
73 | + if (is_null($array)) { |
|
74 | + return null; |
|
75 | + } |
|
76 | 76 | |
77 | - if (!array_key_exists('info', $array)) { |
|
78 | - $array['info'] = []; |
|
79 | - } |
|
80 | - if (!array_key_exists('remote', $array)) { |
|
81 | - $array['remote'] = []; |
|
82 | - } |
|
83 | - if (!array_key_exists('public', $array)) { |
|
84 | - $array['public'] = []; |
|
85 | - } |
|
86 | - if (!array_key_exists('types', $array)) { |
|
87 | - $array['types'] = []; |
|
88 | - } |
|
89 | - if (!array_key_exists('repair-steps', $array)) { |
|
90 | - $array['repair-steps'] = []; |
|
91 | - } |
|
92 | - if (!array_key_exists('install', $array['repair-steps'])) { |
|
93 | - $array['repair-steps']['install'] = []; |
|
94 | - } |
|
95 | - if (!array_key_exists('pre-migration', $array['repair-steps'])) { |
|
96 | - $array['repair-steps']['pre-migration'] = []; |
|
97 | - } |
|
98 | - if (!array_key_exists('post-migration', $array['repair-steps'])) { |
|
99 | - $array['repair-steps']['post-migration'] = []; |
|
100 | - } |
|
101 | - if (!array_key_exists('live-migration', $array['repair-steps'])) { |
|
102 | - $array['repair-steps']['live-migration'] = []; |
|
103 | - } |
|
104 | - if (!array_key_exists('uninstall', $array['repair-steps'])) { |
|
105 | - $array['repair-steps']['uninstall'] = []; |
|
106 | - } |
|
107 | - if (!array_key_exists('background-jobs', $array)) { |
|
108 | - $array['background-jobs'] = []; |
|
109 | - } |
|
110 | - if (!array_key_exists('two-factor-providers', $array)) { |
|
111 | - $array['two-factor-providers'] = []; |
|
112 | - } |
|
113 | - if (!array_key_exists('commands', $array)) { |
|
114 | - $array['commands'] = []; |
|
115 | - } |
|
116 | - if (!array_key_exists('activity', $array)) { |
|
117 | - $array['activity'] = []; |
|
118 | - } |
|
119 | - if (!array_key_exists('filters', $array['activity'])) { |
|
120 | - $array['activity']['filters'] = []; |
|
121 | - } |
|
122 | - if (!array_key_exists('settings', $array['activity'])) { |
|
123 | - $array['activity']['settings'] = []; |
|
124 | - } |
|
125 | - if (!array_key_exists('providers', $array['activity'])) { |
|
126 | - $array['activity']['providers'] = []; |
|
127 | - } |
|
128 | - if (!array_key_exists('settings', $array)) { |
|
129 | - $array['settings'] = []; |
|
130 | - } |
|
131 | - if (!array_key_exists('admin', $array['settings'])) { |
|
132 | - $array['settings']['admin'] = []; |
|
133 | - } |
|
134 | - if (!array_key_exists('admin-section', $array['settings'])) { |
|
135 | - $array['settings']['admin-section'] = []; |
|
136 | - } |
|
137 | - if (!array_key_exists('personal', $array['settings'])) { |
|
138 | - $array['settings']['personal'] = []; |
|
139 | - } |
|
140 | - if (!array_key_exists('personal-section', $array['settings'])) { |
|
141 | - $array['settings']['personal-section'] = []; |
|
142 | - } |
|
77 | + if (!array_key_exists('info', $array)) { |
|
78 | + $array['info'] = []; |
|
79 | + } |
|
80 | + if (!array_key_exists('remote', $array)) { |
|
81 | + $array['remote'] = []; |
|
82 | + } |
|
83 | + if (!array_key_exists('public', $array)) { |
|
84 | + $array['public'] = []; |
|
85 | + } |
|
86 | + if (!array_key_exists('types', $array)) { |
|
87 | + $array['types'] = []; |
|
88 | + } |
|
89 | + if (!array_key_exists('repair-steps', $array)) { |
|
90 | + $array['repair-steps'] = []; |
|
91 | + } |
|
92 | + if (!array_key_exists('install', $array['repair-steps'])) { |
|
93 | + $array['repair-steps']['install'] = []; |
|
94 | + } |
|
95 | + if (!array_key_exists('pre-migration', $array['repair-steps'])) { |
|
96 | + $array['repair-steps']['pre-migration'] = []; |
|
97 | + } |
|
98 | + if (!array_key_exists('post-migration', $array['repair-steps'])) { |
|
99 | + $array['repair-steps']['post-migration'] = []; |
|
100 | + } |
|
101 | + if (!array_key_exists('live-migration', $array['repair-steps'])) { |
|
102 | + $array['repair-steps']['live-migration'] = []; |
|
103 | + } |
|
104 | + if (!array_key_exists('uninstall', $array['repair-steps'])) { |
|
105 | + $array['repair-steps']['uninstall'] = []; |
|
106 | + } |
|
107 | + if (!array_key_exists('background-jobs', $array)) { |
|
108 | + $array['background-jobs'] = []; |
|
109 | + } |
|
110 | + if (!array_key_exists('two-factor-providers', $array)) { |
|
111 | + $array['two-factor-providers'] = []; |
|
112 | + } |
|
113 | + if (!array_key_exists('commands', $array)) { |
|
114 | + $array['commands'] = []; |
|
115 | + } |
|
116 | + if (!array_key_exists('activity', $array)) { |
|
117 | + $array['activity'] = []; |
|
118 | + } |
|
119 | + if (!array_key_exists('filters', $array['activity'])) { |
|
120 | + $array['activity']['filters'] = []; |
|
121 | + } |
|
122 | + if (!array_key_exists('settings', $array['activity'])) { |
|
123 | + $array['activity']['settings'] = []; |
|
124 | + } |
|
125 | + if (!array_key_exists('providers', $array['activity'])) { |
|
126 | + $array['activity']['providers'] = []; |
|
127 | + } |
|
128 | + if (!array_key_exists('settings', $array)) { |
|
129 | + $array['settings'] = []; |
|
130 | + } |
|
131 | + if (!array_key_exists('admin', $array['settings'])) { |
|
132 | + $array['settings']['admin'] = []; |
|
133 | + } |
|
134 | + if (!array_key_exists('admin-section', $array['settings'])) { |
|
135 | + $array['settings']['admin-section'] = []; |
|
136 | + } |
|
137 | + if (!array_key_exists('personal', $array['settings'])) { |
|
138 | + $array['settings']['personal'] = []; |
|
139 | + } |
|
140 | + if (!array_key_exists('personal-section', $array['settings'])) { |
|
141 | + $array['settings']['personal-section'] = []; |
|
142 | + } |
|
143 | 143 | |
144 | - if (array_key_exists('types', $array)) { |
|
145 | - if (is_array($array['types'])) { |
|
146 | - foreach ($array['types'] as $type => $v) { |
|
147 | - unset($array['types'][$type]); |
|
148 | - if (is_string($type)) { |
|
149 | - $array['types'][] = $type; |
|
150 | - } |
|
151 | - } |
|
152 | - } else { |
|
153 | - $array['types'] = []; |
|
154 | - } |
|
155 | - } |
|
156 | - if (isset($array['repair-steps']['install']['step']) && is_array($array['repair-steps']['install']['step'])) { |
|
157 | - $array['repair-steps']['install'] = $array['repair-steps']['install']['step']; |
|
158 | - } |
|
159 | - if (isset($array['repair-steps']['pre-migration']['step']) && is_array($array['repair-steps']['pre-migration']['step'])) { |
|
160 | - $array['repair-steps']['pre-migration'] = $array['repair-steps']['pre-migration']['step']; |
|
161 | - } |
|
162 | - if (isset($array['repair-steps']['post-migration']['step']) && is_array($array['repair-steps']['post-migration']['step'])) { |
|
163 | - $array['repair-steps']['post-migration'] = $array['repair-steps']['post-migration']['step']; |
|
164 | - } |
|
165 | - if (isset($array['repair-steps']['live-migration']['step']) && is_array($array['repair-steps']['live-migration']['step'])) { |
|
166 | - $array['repair-steps']['live-migration'] = $array['repair-steps']['live-migration']['step']; |
|
167 | - } |
|
168 | - if (isset($array['repair-steps']['uninstall']['step']) && is_array($array['repair-steps']['uninstall']['step'])) { |
|
169 | - $array['repair-steps']['uninstall'] = $array['repair-steps']['uninstall']['step']; |
|
170 | - } |
|
171 | - if (isset($array['background-jobs']['job']) && is_array($array['background-jobs']['job'])) { |
|
172 | - $array['background-jobs'] = $array['background-jobs']['job']; |
|
173 | - } |
|
174 | - if (isset($array['commands']['command']) && is_array($array['commands']['command'])) { |
|
175 | - $array['commands'] = $array['commands']['command']; |
|
176 | - } |
|
177 | - if (isset($array['two-factor-providers']['provider']) && is_array($array['two-factor-providers']['provider'])) { |
|
178 | - $array['two-factor-providers'] = $array['two-factor-providers']['provider']; |
|
179 | - } |
|
180 | - if (isset($array['activity']['filters']['filter']) && is_array($array['activity']['filters']['filter'])) { |
|
181 | - $array['activity']['filters'] = $array['activity']['filters']['filter']; |
|
182 | - } |
|
183 | - if (isset($array['activity']['settings']['setting']) && is_array($array['activity']['settings']['setting'])) { |
|
184 | - $array['activity']['settings'] = $array['activity']['settings']['setting']; |
|
185 | - } |
|
186 | - if (isset($array['activity']['providers']['provider']) && is_array($array['activity']['providers']['provider'])) { |
|
187 | - $array['activity']['providers'] = $array['activity']['providers']['provider']; |
|
188 | - } |
|
189 | - if (isset($array['collaboration']['collaborators']['searchPlugins']['searchPlugin']) |
|
190 | - && is_array($array['collaboration']['collaborators']['searchPlugins']['searchPlugin']) |
|
191 | - && !isset($array['collaboration']['collaborators']['searchPlugins']['searchPlugin']['class']) |
|
192 | - ) { |
|
193 | - $array['collaboration']['collaborators']['searchPlugins'] = $array['collaboration']['collaborators']['searchPlugins']['searchPlugin']; |
|
194 | - } |
|
195 | - if (isset($array['settings']['admin']) && !is_array($array['settings']['admin'])) { |
|
196 | - $array['settings']['admin'] = [$array['settings']['admin']]; |
|
197 | - } |
|
198 | - if (isset($array['settings']['admin-section']) && !is_array($array['settings']['admin-section'])) { |
|
199 | - $array['settings']['admin-section'] = [$array['settings']['admin-section']]; |
|
200 | - } |
|
201 | - if (isset($array['settings']['personal']) && !is_array($array['settings']['personal'])) { |
|
202 | - $array['settings']['personal'] = [$array['settings']['personal']]; |
|
203 | - } |
|
204 | - if (isset($array['settings']['personal-section']) && !is_array($array['settings']['personal-section'])) { |
|
205 | - $array['settings']['personal-section'] = [$array['settings']['personal-section']]; |
|
206 | - } |
|
144 | + if (array_key_exists('types', $array)) { |
|
145 | + if (is_array($array['types'])) { |
|
146 | + foreach ($array['types'] as $type => $v) { |
|
147 | + unset($array['types'][$type]); |
|
148 | + if (is_string($type)) { |
|
149 | + $array['types'][] = $type; |
|
150 | + } |
|
151 | + } |
|
152 | + } else { |
|
153 | + $array['types'] = []; |
|
154 | + } |
|
155 | + } |
|
156 | + if (isset($array['repair-steps']['install']['step']) && is_array($array['repair-steps']['install']['step'])) { |
|
157 | + $array['repair-steps']['install'] = $array['repair-steps']['install']['step']; |
|
158 | + } |
|
159 | + if (isset($array['repair-steps']['pre-migration']['step']) && is_array($array['repair-steps']['pre-migration']['step'])) { |
|
160 | + $array['repair-steps']['pre-migration'] = $array['repair-steps']['pre-migration']['step']; |
|
161 | + } |
|
162 | + if (isset($array['repair-steps']['post-migration']['step']) && is_array($array['repair-steps']['post-migration']['step'])) { |
|
163 | + $array['repair-steps']['post-migration'] = $array['repair-steps']['post-migration']['step']; |
|
164 | + } |
|
165 | + if (isset($array['repair-steps']['live-migration']['step']) && is_array($array['repair-steps']['live-migration']['step'])) { |
|
166 | + $array['repair-steps']['live-migration'] = $array['repair-steps']['live-migration']['step']; |
|
167 | + } |
|
168 | + if (isset($array['repair-steps']['uninstall']['step']) && is_array($array['repair-steps']['uninstall']['step'])) { |
|
169 | + $array['repair-steps']['uninstall'] = $array['repair-steps']['uninstall']['step']; |
|
170 | + } |
|
171 | + if (isset($array['background-jobs']['job']) && is_array($array['background-jobs']['job'])) { |
|
172 | + $array['background-jobs'] = $array['background-jobs']['job']; |
|
173 | + } |
|
174 | + if (isset($array['commands']['command']) && is_array($array['commands']['command'])) { |
|
175 | + $array['commands'] = $array['commands']['command']; |
|
176 | + } |
|
177 | + if (isset($array['two-factor-providers']['provider']) && is_array($array['two-factor-providers']['provider'])) { |
|
178 | + $array['two-factor-providers'] = $array['two-factor-providers']['provider']; |
|
179 | + } |
|
180 | + if (isset($array['activity']['filters']['filter']) && is_array($array['activity']['filters']['filter'])) { |
|
181 | + $array['activity']['filters'] = $array['activity']['filters']['filter']; |
|
182 | + } |
|
183 | + if (isset($array['activity']['settings']['setting']) && is_array($array['activity']['settings']['setting'])) { |
|
184 | + $array['activity']['settings'] = $array['activity']['settings']['setting']; |
|
185 | + } |
|
186 | + if (isset($array['activity']['providers']['provider']) && is_array($array['activity']['providers']['provider'])) { |
|
187 | + $array['activity']['providers'] = $array['activity']['providers']['provider']; |
|
188 | + } |
|
189 | + if (isset($array['collaboration']['collaborators']['searchPlugins']['searchPlugin']) |
|
190 | + && is_array($array['collaboration']['collaborators']['searchPlugins']['searchPlugin']) |
|
191 | + && !isset($array['collaboration']['collaborators']['searchPlugins']['searchPlugin']['class']) |
|
192 | + ) { |
|
193 | + $array['collaboration']['collaborators']['searchPlugins'] = $array['collaboration']['collaborators']['searchPlugins']['searchPlugin']; |
|
194 | + } |
|
195 | + if (isset($array['settings']['admin']) && !is_array($array['settings']['admin'])) { |
|
196 | + $array['settings']['admin'] = [$array['settings']['admin']]; |
|
197 | + } |
|
198 | + if (isset($array['settings']['admin-section']) && !is_array($array['settings']['admin-section'])) { |
|
199 | + $array['settings']['admin-section'] = [$array['settings']['admin-section']]; |
|
200 | + } |
|
201 | + if (isset($array['settings']['personal']) && !is_array($array['settings']['personal'])) { |
|
202 | + $array['settings']['personal'] = [$array['settings']['personal']]; |
|
203 | + } |
|
204 | + if (isset($array['settings']['personal-section']) && !is_array($array['settings']['personal-section'])) { |
|
205 | + $array['settings']['personal-section'] = [$array['settings']['personal-section']]; |
|
206 | + } |
|
207 | 207 | |
208 | - if(!is_null($this->cache)) { |
|
209 | - $this->cache->set($fileCacheKey, json_encode($array)); |
|
210 | - } |
|
211 | - return $array; |
|
212 | - } |
|
208 | + if(!is_null($this->cache)) { |
|
209 | + $this->cache->set($fileCacheKey, json_encode($array)); |
|
210 | + } |
|
211 | + return $array; |
|
212 | + } |
|
213 | 213 | |
214 | - /** |
|
215 | - * @param \SimpleXMLElement $xml |
|
216 | - * @return array |
|
217 | - */ |
|
218 | - public function xmlToArray($xml) { |
|
219 | - if (!$xml->children()) { |
|
220 | - return (string)$xml; |
|
221 | - } |
|
214 | + /** |
|
215 | + * @param \SimpleXMLElement $xml |
|
216 | + * @return array |
|
217 | + */ |
|
218 | + public function xmlToArray($xml) { |
|
219 | + if (!$xml->children()) { |
|
220 | + return (string)$xml; |
|
221 | + } |
|
222 | 222 | |
223 | - $array = []; |
|
224 | - foreach ($xml->children() as $element => $node) { |
|
225 | - $totalElement = count($xml->{$element}); |
|
223 | + $array = []; |
|
224 | + foreach ($xml->children() as $element => $node) { |
|
225 | + $totalElement = count($xml->{$element}); |
|
226 | 226 | |
227 | - if (!isset($array[$element])) { |
|
228 | - $array[$element] = $totalElement > 1 ? [] : ""; |
|
229 | - } |
|
230 | - /** @var \SimpleXMLElement $node */ |
|
231 | - // Has attributes |
|
232 | - if ($attributes = $node->attributes()) { |
|
233 | - $data = [ |
|
234 | - '@attributes' => [], |
|
235 | - ]; |
|
236 | - if (!count($node->children())){ |
|
237 | - $value = (string)$node; |
|
238 | - if (!empty($value)) { |
|
239 | - $data['@value'] = (string)$node; |
|
240 | - } |
|
241 | - } else { |
|
242 | - $data = array_merge($data, $this->xmlToArray($node)); |
|
243 | - } |
|
244 | - foreach ($attributes as $attr => $value) { |
|
245 | - $data['@attributes'][$attr] = (string)$value; |
|
246 | - } |
|
227 | + if (!isset($array[$element])) { |
|
228 | + $array[$element] = $totalElement > 1 ? [] : ""; |
|
229 | + } |
|
230 | + /** @var \SimpleXMLElement $node */ |
|
231 | + // Has attributes |
|
232 | + if ($attributes = $node->attributes()) { |
|
233 | + $data = [ |
|
234 | + '@attributes' => [], |
|
235 | + ]; |
|
236 | + if (!count($node->children())){ |
|
237 | + $value = (string)$node; |
|
238 | + if (!empty($value)) { |
|
239 | + $data['@value'] = (string)$node; |
|
240 | + } |
|
241 | + } else { |
|
242 | + $data = array_merge($data, $this->xmlToArray($node)); |
|
243 | + } |
|
244 | + foreach ($attributes as $attr => $value) { |
|
245 | + $data['@attributes'][$attr] = (string)$value; |
|
246 | + } |
|
247 | 247 | |
248 | - if ($totalElement > 1) { |
|
249 | - $array[$element][] = $data; |
|
250 | - } else { |
|
251 | - $array[$element] = $data; |
|
252 | - } |
|
253 | - // Just a value |
|
254 | - } else { |
|
255 | - if ($totalElement > 1) { |
|
256 | - $array[$element][] = $this->xmlToArray($node); |
|
257 | - } else { |
|
258 | - $array[$element] = $this->xmlToArray($node); |
|
259 | - } |
|
260 | - } |
|
261 | - } |
|
248 | + if ($totalElement > 1) { |
|
249 | + $array[$element][] = $data; |
|
250 | + } else { |
|
251 | + $array[$element] = $data; |
|
252 | + } |
|
253 | + // Just a value |
|
254 | + } else { |
|
255 | + if ($totalElement > 1) { |
|
256 | + $array[$element][] = $this->xmlToArray($node); |
|
257 | + } else { |
|
258 | + $array[$element] = $this->xmlToArray($node); |
|
259 | + } |
|
260 | + } |
|
261 | + } |
|
262 | 262 | |
263 | - return $array; |
|
264 | - } |
|
263 | + return $array; |
|
264 | + } |
|
265 | 265 | } |
@@ -25,31 +25,31 @@ |
||
25 | 25 | use OCP\Remote\ICredentials; |
26 | 26 | |
27 | 27 | class Credentials implements ICredentials { |
28 | - /** @var string */ |
|
29 | - private $user; |
|
30 | - /** @var string */ |
|
31 | - private $password; |
|
28 | + /** @var string */ |
|
29 | + private $user; |
|
30 | + /** @var string */ |
|
31 | + private $password; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param string $user |
|
35 | - * @param string $password |
|
36 | - */ |
|
37 | - public function __construct($user, $password) { |
|
38 | - $this->user = $user; |
|
39 | - $this->password = $password; |
|
40 | - } |
|
33 | + /** |
|
34 | + * @param string $user |
|
35 | + * @param string $password |
|
36 | + */ |
|
37 | + public function __construct($user, $password) { |
|
38 | + $this->user = $user; |
|
39 | + $this->password = $password; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * @return string |
|
44 | - */ |
|
45 | - public function getUsername() { |
|
46 | - return $this->user; |
|
47 | - } |
|
42 | + /** |
|
43 | + * @return string |
|
44 | + */ |
|
45 | + public function getUsername() { |
|
46 | + return $this->user; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @return string |
|
51 | - */ |
|
52 | - public function getPassword() { |
|
53 | - return $this->password; |
|
54 | - } |
|
49 | + /** |
|
50 | + * @return string |
|
51 | + */ |
|
52 | + public function getPassword() { |
|
53 | + return $this->password; |
|
54 | + } |
|
55 | 55 | } |
@@ -27,11 +27,11 @@ |
||
27 | 27 | * @since 13.0.0 |
28 | 28 | */ |
29 | 29 | interface IUserApi { |
30 | - /** |
|
31 | - * @param string $userId |
|
32 | - * @return IUser |
|
33 | - * |
|
34 | - * @since 13.0.0 |
|
35 | - */ |
|
36 | - public function getUser($userId); |
|
30 | + /** |
|
31 | + * @param string $userId |
|
32 | + * @return IUser |
|
33 | + * |
|
34 | + * @since 13.0.0 |
|
35 | + */ |
|
36 | + public function getUser($userId); |
|
37 | 37 | } |
@@ -25,10 +25,10 @@ |
||
25 | 25 | * @since 13.0.0 |
26 | 26 | */ |
27 | 27 | interface ICapabilitiesApi { |
28 | - /** |
|
29 | - * @return array The capabilities in the form of [$appId => [$capability => $value]] |
|
30 | - * |
|
31 | - * @since 13.0.0 |
|
32 | - */ |
|
33 | - public function getCapabilities(); |
|
28 | + /** |
|
29 | + * @return array The capabilities in the form of [$appId => [$capability => $value]] |
|
30 | + * |
|
31 | + * @since 13.0.0 |
|
32 | + */ |
|
33 | + public function getCapabilities(); |
|
34 | 34 | } |
@@ -28,12 +28,12 @@ |
||
28 | 28 | * @since 13.0.0 |
29 | 29 | */ |
30 | 30 | interface IApiFactory { |
31 | - /** |
|
32 | - * @param IInstance $instance |
|
33 | - * @param ICredentials $credentials |
|
34 | - * @return IApiCollection |
|
35 | - * |
|
36 | - * @since 13.0.0 |
|
37 | - */ |
|
38 | - public function getApiCollection(IInstance $instance, ICredentials $credentials); |
|
31 | + /** |
|
32 | + * @param IInstance $instance |
|
33 | + * @param ICredentials $credentials |
|
34 | + * @return IApiCollection |
|
35 | + * |
|
36 | + * @since 13.0.0 |
|
37 | + */ |
|
38 | + public function getApiCollection(IInstance $instance, ICredentials $credentials); |
|
39 | 39 | } |