@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | * The response from the remote usually contains the webroot already and must be normalized to: |
59 | 59 | * https://server.internal/cloud/remote.php/dav/addressbooks/system/system/system/Database:alice.vcf |
60 | 60 | */ |
61 | - $host = rtrim($host, '/') . '/'; |
|
61 | + $host = rtrim($host, '/').'/'; |
|
62 | 62 | |
63 | 63 | $uri = \GuzzleHttp\Psr7\UriResolver::resolve( |
64 | 64 | \GuzzleHttp\Psr7\Utils::uriFor($host), |
65 | 65 | \GuzzleHttp\Psr7\Utils::uriFor($path) |
66 | 66 | ); |
67 | 67 | |
68 | - return (string)$uri; |
|
68 | + return (string) $uri; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $options, |
126 | 126 | ); |
127 | 127 | |
128 | - return (string)$response->getBody(); |
|
128 | + return (string) $response->getBody(); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | private function buildSyncCollectionRequestBody(?string $syncToken): string { |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $downloadedEvents += $this->syncService->syncOne($calendar); |
48 | 48 | } catch (ClientExceptionInterface $e) { |
49 | 49 | $name = $calendar->getUri(); |
50 | - $this->logger->error("Failed to sync federated calendar $name: " . $e->getMessage(), [ |
|
50 | + $this->logger->error("Failed to sync federated calendar $name: ".$e->getMessage(), [ |
|
51 | 51 | 'exception' => $e, |
52 | 52 | 'calendar' => $calendar->toCalendarInfo(), |
53 | 53 | ]); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | return; |
44 | 44 | } |
45 | 45 | |
46 | - $id = (int)$id; |
|
46 | + $id = (int) $id; |
|
47 | 47 | try { |
48 | 48 | $calendar = $this->federatedCalendarMapper->find($id); |
49 | 49 | } catch (DoesNotExistException $e) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $this->syncService->syncOne($calendar); |
55 | 55 | } catch (ClientExceptionInterface $e) { |
56 | 56 | $name = $calendar->getUri(); |
57 | - $this->logger->error("Failed to sync federated calendar $name: " . $e->getMessage(), [ |
|
57 | + $this->logger->error("Failed to sync federated calendar $name: ".$e->getMessage(), [ |
|
58 | 58 | 'exception' => $e, |
59 | 59 | 'calendar' => $calendar->toCalendarInfo(), |
60 | 60 | ]); |
@@ -30,17 +30,17 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | public function fetchAllForCalendarHome(string $principalUri): array { |
33 | - return array_map(function ($calendar) use (&$principalUri) { |
|
33 | + return array_map(function($calendar) use (&$principalUri) { |
|
34 | 34 | return new AppCalendar($this->getAppID(), $calendar, $principalUri); |
35 | 35 | }, $this->getWrappedCalendars($principalUri)); |
36 | 36 | } |
37 | 37 | |
38 | 38 | public function hasCalendarInCalendarHome(string $principalUri, string $calendarUri): bool { |
39 | - return count($this->getWrappedCalendars($principalUri, [ $calendarUri ])) > 0; |
|
39 | + return count($this->getWrappedCalendars($principalUri, [$calendarUri])) > 0; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function getCalendarInCalendarHome(string $principalUri, string $calendarUri): ?ExternalCalendar { |
43 | - $calendars = $this->getWrappedCalendars($principalUri, [ $calendarUri ]); |
|
43 | + $calendars = $this->getWrappedCalendars($principalUri, [$calendarUri]); |
|
44 | 44 | if (count($calendars) > 0) { |
45 | 45 | return new AppCalendar($this->getAppID(), $calendars[0], $principalUri); |
46 | 46 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | protected function getWrappedCalendars(string $principalUri, array $calendarUris = []): array { |
52 | 52 | return array_values( |
53 | - array_filter($this->manager->getCalendarsForPrincipal($principalUri, $calendarUris), function ($c) { |
|
53 | + array_filter($this->manager->getCalendarsForPrincipal($principalUri, $calendarUris), function($c) { |
|
54 | 54 | // We must not provide a wrapper for DAV calendars |
55 | 55 | return !( |
56 | 56 | ($c instanceof CalendarImpl) |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => ['timezone', 'string'], |
149 | 149 | '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], |
150 | 150 | '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], |
151 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int'], |
|
151 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => ['deleted_at', 'int'], |
|
152 | 152 | ]; |
153 | 153 | |
154 | 154 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | $result = $query->executeQuery(); |
243 | - $column = (int)$result->fetchOne(); |
|
243 | + $column = (int) $result->fetchOne(); |
|
244 | 244 | $result->closeCursor(); |
245 | 245 | return $column; |
246 | 246 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | $result = $query->executeQuery(); |
264 | - $column = (int)$result->fetchOne(); |
|
264 | + $column = (int) $result->fetchOne(); |
|
265 | 265 | $result->closeCursor(); |
266 | 266 | return $column; |
267 | 267 | } |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | $calendars = []; |
280 | 280 | while (($row = $result->fetch()) !== false) { |
281 | 281 | $calendars[] = [ |
282 | - 'id' => (int)$row['id'], |
|
283 | - 'deleted_at' => (int)$row['deleted_at'], |
|
282 | + 'id' => (int) $row['id'], |
|
283 | + 'deleted_at' => (int) $row['deleted_at'], |
|
284 | 284 | ]; |
285 | 285 | } |
286 | 286 | $result->closeCursor(); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * @return array |
314 | 314 | */ |
315 | 315 | public function getCalendarsForUser($principalUri) { |
316 | - return $this->atomic(function () use ($principalUri) { |
|
316 | + return $this->atomic(function() use ($principalUri) { |
|
317 | 317 | $principalUriOriginal = $principalUri; |
318 | 318 | $principalUri = $this->convertPrincipal($principalUri, true); |
319 | 319 | $fields = array_column($this->propertyMap, 0); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | |
341 | 341 | $calendars = []; |
342 | 342 | while ($row = $result->fetch()) { |
343 | - $row['principaluri'] = (string)$row['principaluri']; |
|
343 | + $row['principaluri'] = (string) $row['principaluri']; |
|
344 | 344 | $components = []; |
345 | 345 | if ($row['components']) { |
346 | 346 | $components = explode(',', $row['components']); |
@@ -350,11 +350,11 @@ discard block |
||
350 | 350 | 'id' => $row['id'], |
351 | 351 | 'uri' => $row['uri'], |
352 | 352 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
353 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
353 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
354 | 354 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
355 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
356 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
357 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
355 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
356 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
357 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
358 | 358 | ]; |
359 | 359 | |
360 | 360 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -373,8 +373,8 @@ discard block |
||
373 | 373 | $principals[] = $principalUri; |
374 | 374 | |
375 | 375 | $fields = array_column($this->propertyMap, 0); |
376 | - $fields = array_map(function (string $field) { |
|
377 | - return 'a.' . $field; |
|
376 | + $fields = array_map(function(string $field) { |
|
377 | + return 'a.'.$field; |
|
378 | 378 | }, $fields); |
379 | 379 | $fields[] = 'a.id'; |
380 | 380 | $fields[] = 'a.uri'; |
@@ -401,14 +401,14 @@ discard block |
||
401 | 401 | |
402 | 402 | $results = $select->executeQuery(); |
403 | 403 | |
404 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
404 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
405 | 405 | while ($row = $results->fetch()) { |
406 | - $row['principaluri'] = (string)$row['principaluri']; |
|
406 | + $row['principaluri'] = (string) $row['principaluri']; |
|
407 | 407 | if ($row['principaluri'] === $principalUri) { |
408 | 408 | continue; |
409 | 409 | } |
410 | 410 | |
411 | - $readOnly = (int)$row['access'] === Backend::ACCESS_READ; |
|
411 | + $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
412 | 412 | if (isset($calendars[$row['id']])) { |
413 | 413 | if ($readOnly) { |
414 | 414 | // New share can not have more permissions than the old one. |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | [, $name] = Uri\split($row['principaluri']); |
425 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
426 | - $row['displayname'] = $row['displayname'] . ' (' . ($this->userManager->getDisplayName($name) ?? ($name ?? '')) . ')'; |
|
425 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
426 | + $row['displayname'] = $row['displayname'].' ('.($this->userManager->getDisplayName($name) ?? ($name ?? '')).')'; |
|
427 | 427 | $components = []; |
428 | 428 | if ($row['components']) { |
429 | 429 | $components = explode(',', $row['components']); |
@@ -432,11 +432,11 @@ discard block |
||
432 | 432 | 'id' => $row['id'], |
433 | 433 | 'uri' => $uri, |
434 | 434 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
435 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
435 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
436 | 436 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
437 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
438 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
439 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
437 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
438 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
439 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
440 | 440 | $readOnlyPropertyName => $readOnly, |
441 | 441 | ]; |
442 | 442 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $stmt = $query->executeQuery(); |
474 | 474 | $calendars = []; |
475 | 475 | while ($row = $stmt->fetch()) { |
476 | - $row['principaluri'] = (string)$row['principaluri']; |
|
476 | + $row['principaluri'] = (string) $row['principaluri']; |
|
477 | 477 | $components = []; |
478 | 478 | if ($row['components']) { |
479 | 479 | $components = explode(',', $row['components']); |
@@ -482,10 +482,10 @@ discard block |
||
482 | 482 | 'id' => $row['id'], |
483 | 483 | 'uri' => $row['uri'], |
484 | 484 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
485 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
485 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
486 | 486 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
487 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
488 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
487 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
488 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
489 | 489 | ]; |
490 | 490 | |
491 | 491 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -523,9 +523,9 @@ discard block |
||
523 | 523 | ->executeQuery(); |
524 | 524 | |
525 | 525 | while ($row = $result->fetch()) { |
526 | - $row['principaluri'] = (string)$row['principaluri']; |
|
526 | + $row['principaluri'] = (string) $row['principaluri']; |
|
527 | 527 | [, $name] = Uri\split($row['principaluri']); |
528 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
528 | + $row['displayname'] = $row['displayname']."($name)"; |
|
529 | 529 | $components = []; |
530 | 530 | if ($row['components']) { |
531 | 531 | $components = explode(',', $row['components']); |
@@ -534,13 +534,13 @@ discard block |
||
534 | 534 | 'id' => $row['id'], |
535 | 535 | 'uri' => $row['publicuri'], |
536 | 536 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
537 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
537 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
538 | 538 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
539 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
540 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
541 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
542 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => true, |
|
543 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
539 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
540 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
541 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
542 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => true, |
|
543 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
544 | 544 | ]; |
545 | 545 | |
546 | 546 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -585,12 +585,12 @@ discard block |
||
585 | 585 | $result->closeCursor(); |
586 | 586 | |
587 | 587 | if ($row === false) { |
588 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
588 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
589 | 589 | } |
590 | 590 | |
591 | - $row['principaluri'] = (string)$row['principaluri']; |
|
591 | + $row['principaluri'] = (string) $row['principaluri']; |
|
592 | 592 | [, $name] = Uri\split($row['principaluri']); |
593 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
593 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
594 | 594 | $components = []; |
595 | 595 | if ($row['components']) { |
596 | 596 | $components = explode(',', $row['components']); |
@@ -599,13 +599,13 @@ discard block |
||
599 | 599 | 'id' => $row['id'], |
600 | 600 | 'uri' => $row['publicuri'], |
601 | 601 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
602 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
602 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
603 | 603 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
604 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
605 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
606 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
607 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => true, |
|
608 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
604 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
605 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
606 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
607 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => true, |
|
608 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
609 | 609 | ]; |
610 | 610 | |
611 | 611 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | return null; |
644 | 644 | } |
645 | 645 | |
646 | - $row['principaluri'] = (string)$row['principaluri']; |
|
646 | + $row['principaluri'] = (string) $row['principaluri']; |
|
647 | 647 | $components = []; |
648 | 648 | if ($row['components']) { |
649 | 649 | $components = explode(',', $row['components']); |
@@ -653,10 +653,10 @@ discard block |
||
653 | 653 | 'id' => $row['id'], |
654 | 654 | 'uri' => $row['uri'], |
655 | 655 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
656 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
656 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
657 | 657 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
658 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
659 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
658 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
659 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
660 | 660 | ]; |
661 | 661 | |
662 | 662 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | return null; |
693 | 693 | } |
694 | 694 | |
695 | - $row['principaluri'] = (string)$row['principaluri']; |
|
695 | + $row['principaluri'] = (string) $row['principaluri']; |
|
696 | 696 | $components = []; |
697 | 697 | if ($row['components']) { |
698 | 698 | $components = explode(',', $row['components']); |
@@ -702,10 +702,10 @@ discard block |
||
702 | 702 | 'id' => $row['id'], |
703 | 703 | 'uri' => $row['uri'], |
704 | 704 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
705 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
705 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
706 | 706 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?? 0, |
707 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
708 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
707 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
708 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
709 | 709 | ]; |
710 | 710 | |
711 | 711 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -740,14 +740,14 @@ discard block |
||
740 | 740 | return null; |
741 | 741 | } |
742 | 742 | |
743 | - $row['principaluri'] = (string)$row['principaluri']; |
|
743 | + $row['principaluri'] = (string) $row['principaluri']; |
|
744 | 744 | $subscription = [ |
745 | 745 | 'id' => $row['id'], |
746 | 746 | 'uri' => $row['uri'], |
747 | 747 | 'principaluri' => $row['principaluri'], |
748 | 748 | 'source' => $row['source'], |
749 | 749 | 'lastmodified' => $row['lastmodified'], |
750 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
750 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
751 | 751 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
752 | 752 | ]; |
753 | 753 | |
@@ -777,14 +777,14 @@ discard block |
||
777 | 777 | return null; |
778 | 778 | } |
779 | 779 | |
780 | - $row['principaluri'] = (string)$row['principaluri']; |
|
780 | + $row['principaluri'] = (string) $row['principaluri']; |
|
781 | 781 | $subscription = [ |
782 | 782 | 'id' => $row['id'], |
783 | 783 | 'uri' => $row['uri'], |
784 | 784 | 'principaluri' => $row['principaluri'], |
785 | 785 | 'source' => $row['source'], |
786 | 786 | 'lastmodified' => $row['lastmodified'], |
787 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
787 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
788 | 788 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
789 | 789 | ]; |
790 | 790 | |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
823 | 823 | if (isset($properties[$sccs])) { |
824 | 824 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
825 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
825 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
826 | 826 | } |
827 | 827 | $values['components'] = implode(',', $properties[$sccs]->getValue()); |
828 | 828 | } elseif (isset($properties['components'])) { |
@@ -831,9 +831,9 @@ discard block |
||
831 | 831 | $values['components'] = $properties['components']; |
832 | 832 | } |
833 | 833 | |
834 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
834 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
835 | 835 | if (isset($properties[$transp])) { |
836 | - $values['transparent'] = (int)($properties[$transp]->getValue() === 'transparent'); |
|
836 | + $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | foreach ($this->propertyMap as $xmlName => [$dbName, $type]) { |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | } |
843 | 843 | } |
844 | 844 | |
845 | - [$calendarId, $calendarData] = $this->atomic(function () use ($values) { |
|
845 | + [$calendarId, $calendarData] = $this->atomic(function() use ($values) { |
|
846 | 846 | $query = $this->db->getQueryBuilder(); |
847 | 847 | $query->insert('calendars'); |
848 | 848 | foreach ($values as $column => $value) { |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | return [$calendarId, $calendarData]; |
856 | 856 | }, $this->db); |
857 | 857 | |
858 | - $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); |
|
858 | + $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData)); |
|
859 | 859 | |
860 | 860 | return $calendarId; |
861 | 861 | } |
@@ -878,15 +878,15 @@ discard block |
||
878 | 878 | */ |
879 | 879 | public function updateCalendar($calendarId, PropPatch $propPatch) { |
880 | 880 | $supportedProperties = array_keys($this->propertyMap); |
881 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
881 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
882 | 882 | |
883 | - $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { |
|
883 | + $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
|
884 | 884 | $newValues = []; |
885 | 885 | foreach ($mutations as $propertyName => $propertyValue) { |
886 | 886 | switch ($propertyName) { |
887 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': |
|
887 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp': |
|
888 | 888 | $fieldName = 'transparent'; |
889 | - $newValues[$fieldName] = (int)($propertyValue->getValue() === 'transparent'); |
|
889 | + $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
|
890 | 890 | break; |
891 | 891 | default: |
892 | 892 | $fieldName = $this->propertyMap[$propertyName][0]; |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | break; |
895 | 895 | } |
896 | 896 | } |
897 | - [$calendarData, $shares] = $this->atomic(function () use ($calendarId, $newValues) { |
|
897 | + [$calendarData, $shares] = $this->atomic(function() use ($calendarId, $newValues) { |
|
898 | 898 | $query = $this->db->getQueryBuilder(); |
899 | 899 | $query->update('calendars'); |
900 | 900 | foreach ($newValues as $fieldName => $value) { |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | * @return void |
924 | 924 | */ |
925 | 925 | public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) { |
926 | - $this->atomic(function () use ($calendarId, $forceDeletePermanently): void { |
|
926 | + $this->atomic(function() use ($calendarId, $forceDeletePermanently): void { |
|
927 | 927 | // The calendar is deleted right away if this is either enforced by the caller |
928 | 928 | // or the special contacts birthday calendar or when the preference of an empty |
929 | 929 | // retention (0 seconds) is set, which signals a disabled trashbin. |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | } |
987 | 987 | |
988 | 988 | public function restoreCalendar(int $id): void { |
989 | - $this->atomic(function () use ($id): void { |
|
989 | + $this->atomic(function() use ($id): void { |
|
990 | 990 | $qb = $this->db->getQueryBuilder(); |
991 | 991 | $update = $qb->update('calendars') |
992 | 992 | ->set('deleted_at', $qb->createNamedParameter(null)) |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | */ |
1061 | 1061 | public function getLimitedCalendarObjects(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
1062 | 1062 | $query = $this->db->getQueryBuilder(); |
1063 | - $query->select(['id','uid', 'etag', 'uri', 'calendardata']) |
|
1063 | + $query->select(['id', 'uid', 'etag', 'uri', 'calendardata']) |
|
1064 | 1064 | ->from('calendarobjects') |
1065 | 1065 | ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
1066 | 1066 | ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))) |
@@ -1138,11 +1138,11 @@ discard block |
||
1138 | 1138 | 'id' => $row['id'], |
1139 | 1139 | 'uri' => $row['uri'], |
1140 | 1140 | 'lastmodified' => $row['lastmodified'], |
1141 | - 'etag' => '"' . $row['etag'] . '"', |
|
1141 | + 'etag' => '"'.$row['etag'].'"', |
|
1142 | 1142 | 'calendarid' => $row['calendarid'], |
1143 | - 'size' => (int)$row['size'], |
|
1143 | + 'size' => (int) $row['size'], |
|
1144 | 1144 | 'component' => strtolower($row['componenttype']), |
1145 | - 'classification' => (int)$row['classification'] |
|
1145 | + 'classification' => (int) $row['classification'] |
|
1146 | 1146 | ]; |
1147 | 1147 | } |
1148 | 1148 | $stmt->closeCursor(); |
@@ -1165,13 +1165,13 @@ discard block |
||
1165 | 1165 | 'id' => $row['id'], |
1166 | 1166 | 'uri' => $row['uri'], |
1167 | 1167 | 'lastmodified' => $row['lastmodified'], |
1168 | - 'etag' => '"' . $row['etag'] . '"', |
|
1169 | - 'calendarid' => (int)$row['calendarid'], |
|
1170 | - 'calendartype' => (int)$row['calendartype'], |
|
1171 | - 'size' => (int)$row['size'], |
|
1168 | + 'etag' => '"'.$row['etag'].'"', |
|
1169 | + 'calendarid' => (int) $row['calendarid'], |
|
1170 | + 'calendartype' => (int) $row['calendartype'], |
|
1171 | + 'size' => (int) $row['size'], |
|
1172 | 1172 | 'component' => strtolower($row['componenttype']), |
1173 | - 'classification' => (int)$row['classification'], |
|
1174 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
1173 | + 'classification' => (int) $row['classification'], |
|
1174 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
1175 | 1175 | ]; |
1176 | 1176 | } |
1177 | 1177 | $stmt->closeCursor(); |
@@ -1204,13 +1204,13 @@ discard block |
||
1204 | 1204 | 'id' => $row['id'], |
1205 | 1205 | 'uri' => $row['uri'], |
1206 | 1206 | 'lastmodified' => $row['lastmodified'], |
1207 | - 'etag' => '"' . $row['etag'] . '"', |
|
1207 | + 'etag' => '"'.$row['etag'].'"', |
|
1208 | 1208 | 'calendarid' => $row['calendarid'], |
1209 | 1209 | 'calendaruri' => $row['calendaruri'], |
1210 | - 'size' => (int)$row['size'], |
|
1210 | + 'size' => (int) $row['size'], |
|
1211 | 1211 | 'component' => strtolower($row['componenttype']), |
1212 | - 'classification' => (int)$row['classification'], |
|
1213 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
1212 | + 'classification' => (int) $row['classification'], |
|
1213 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
1214 | 1214 | ]; |
1215 | 1215 | } |
1216 | 1216 | $stmt->closeCursor(); |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | * @return array|null |
1237 | 1237 | */ |
1238 | 1238 | public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
1239 | - $key = $calendarId . '::' . $objectUri . '::' . $calendarType; |
|
1239 | + $key = $calendarId.'::'.$objectUri.'::'.$calendarType; |
|
1240 | 1240 | if (isset($this->cachedObjects[$key])) { |
1241 | 1241 | return $this->cachedObjects[$key]; |
1242 | 1242 | } |
@@ -1265,13 +1265,13 @@ discard block |
||
1265 | 1265 | 'uri' => $row['uri'], |
1266 | 1266 | 'uid' => $row['uid'], |
1267 | 1267 | 'lastmodified' => $row['lastmodified'], |
1268 | - 'etag' => '"' . $row['etag'] . '"', |
|
1268 | + 'etag' => '"'.$row['etag'].'"', |
|
1269 | 1269 | 'calendarid' => $row['calendarid'], |
1270 | - 'size' => (int)$row['size'], |
|
1270 | + 'size' => (int) $row['size'], |
|
1271 | 1271 | 'calendardata' => $this->readBlob($row['calendardata']), |
1272 | 1272 | 'component' => strtolower($row['componenttype']), |
1273 | - 'classification' => (int)$row['classification'], |
|
1274 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
1273 | + 'classification' => (int) $row['classification'], |
|
1274 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
1275 | 1275 | ]; |
1276 | 1276 | } |
1277 | 1277 | |
@@ -1313,12 +1313,12 @@ discard block |
||
1313 | 1313 | 'id' => $row['id'], |
1314 | 1314 | 'uri' => $row['uri'], |
1315 | 1315 | 'lastmodified' => $row['lastmodified'], |
1316 | - 'etag' => '"' . $row['etag'] . '"', |
|
1316 | + 'etag' => '"'.$row['etag'].'"', |
|
1317 | 1317 | 'calendarid' => $row['calendarid'], |
1318 | - 'size' => (int)$row['size'], |
|
1318 | + 'size' => (int) $row['size'], |
|
1319 | 1319 | 'calendardata' => $this->readBlob($row['calendardata']), |
1320 | 1320 | 'component' => strtolower($row['componenttype']), |
1321 | - 'classification' => (int)$row['classification'] |
|
1321 | + 'classification' => (int) $row['classification'] |
|
1322 | 1322 | ]; |
1323 | 1323 | } |
1324 | 1324 | $result->closeCursor(); |
@@ -1350,7 +1350,7 @@ discard block |
||
1350 | 1350 | $this->cachedObjects = []; |
1351 | 1351 | $extraData = $this->getDenormalizedData($calendarData); |
1352 | 1352 | |
1353 | - return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
1353 | + return $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
1354 | 1354 | // Try to detect duplicates |
1355 | 1355 | $qb = $this->db->getQueryBuilder(); |
1356 | 1356 | $qb->select($qb->func()->count('*')) |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | ->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))) |
1361 | 1361 | ->andWhere($qb->expr()->isNull('deleted_at')); |
1362 | 1362 | $result = $qb->executeQuery(); |
1363 | - $count = (int)$result->fetchOne(); |
|
1363 | + $count = (int) $result->fetchOne(); |
|
1364 | 1364 | $result->closeCursor(); |
1365 | 1365 | |
1366 | 1366 | if ($count !== 0) { |
@@ -1420,7 +1420,7 @@ discard block |
||
1420 | 1420 | // TODO: implement custom event for federated calendars |
1421 | 1421 | } |
1422 | 1422 | |
1423 | - return '"' . $extraData['etag'] . '"'; |
|
1423 | + return '"'.$extraData['etag'].'"'; |
|
1424 | 1424 | }, $this->db); |
1425 | 1425 | } |
1426 | 1426 | |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | $this->cachedObjects = []; |
1448 | 1448 | $extraData = $this->getDenormalizedData($calendarData); |
1449 | 1449 | |
1450 | - return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
1450 | + return $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
1451 | 1451 | $query = $this->db->getQueryBuilder(); |
1452 | 1452 | $query->update('calendarobjects') |
1453 | 1453 | ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | } |
1484 | 1484 | } |
1485 | 1485 | |
1486 | - return '"' . $extraData['etag'] . '"'; |
|
1486 | + return '"'.$extraData['etag'].'"'; |
|
1487 | 1487 | }, $this->db); |
1488 | 1488 | } |
1489 | 1489 | |
@@ -1501,7 +1501,7 @@ discard block |
||
1501 | 1501 | */ |
1502 | 1502 | public function moveCalendarObject(string $sourcePrincipalUri, int $sourceObjectId, string $targetPrincipalUri, int $targetCalendarId, string $tragetObjectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR): bool { |
1503 | 1503 | $this->cachedObjects = []; |
1504 | - return $this->atomic(function () use ($sourcePrincipalUri, $sourceObjectId, $targetPrincipalUri, $targetCalendarId, $tragetObjectUri, $calendarType) { |
|
1504 | + return $this->atomic(function() use ($sourcePrincipalUri, $sourceObjectId, $targetPrincipalUri, $targetCalendarId, $tragetObjectUri, $calendarType) { |
|
1505 | 1505 | $object = $this->getCalendarObjectById($sourcePrincipalUri, $sourceObjectId); |
1506 | 1506 | if (empty($object)) { |
1507 | 1507 | return false; |
@@ -1558,7 +1558,7 @@ discard block |
||
1558 | 1558 | */ |
1559 | 1559 | public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) { |
1560 | 1560 | $this->cachedObjects = []; |
1561 | - $this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void { |
|
1561 | + $this->atomic(function() use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void { |
|
1562 | 1562 | $data = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
1563 | 1563 | |
1564 | 1564 | if ($data === null) { |
@@ -1642,8 +1642,8 @@ discard block |
||
1642 | 1642 | */ |
1643 | 1643 | public function restoreCalendarObject(array $objectData): void { |
1644 | 1644 | $this->cachedObjects = []; |
1645 | - $this->atomic(function () use ($objectData): void { |
|
1646 | - $id = (int)$objectData['id']; |
|
1645 | + $this->atomic(function() use ($objectData): void { |
|
1646 | + $id = (int) $objectData['id']; |
|
1647 | 1647 | $restoreUri = str_replace('-deleted.ics', '.ics', $objectData['uri']); |
1648 | 1648 | $targetObject = $this->getCalendarObject( |
1649 | 1649 | $objectData['calendarid'], |
@@ -1673,17 +1673,17 @@ discard block |
||
1673 | 1673 | // Welp, this should possibly not have happened, but let's ignore |
1674 | 1674 | return; |
1675 | 1675 | } |
1676 | - $this->addChanges($row['calendarid'], [$row['uri']], 1, (int)$row['calendartype']); |
|
1676 | + $this->addChanges($row['calendarid'], [$row['uri']], 1, (int) $row['calendartype']); |
|
1677 | 1677 | |
1678 | - $calendarRow = $this->getCalendarById((int)$row['calendarid']); |
|
1678 | + $calendarRow = $this->getCalendarById((int) $row['calendarid']); |
|
1679 | 1679 | if ($calendarRow === null) { |
1680 | 1680 | throw new RuntimeException('Calendar object data that was just written can\'t be read back. Check your database configuration.'); |
1681 | 1681 | } |
1682 | 1682 | $this->dispatcher->dispatchTyped( |
1683 | 1683 | new CalendarObjectRestoredEvent( |
1684 | - (int)$objectData['calendarid'], |
|
1684 | + (int) $objectData['calendarid'], |
|
1685 | 1685 | $calendarRow, |
1686 | - $this->getShares((int)$row['calendarid']), |
|
1686 | + $this->getShares((int) $row['calendarid']), |
|
1687 | 1687 | $row |
1688 | 1688 | ) |
1689 | 1689 | ); |
@@ -1802,19 +1802,19 @@ discard block |
||
1802 | 1802 | try { |
1803 | 1803 | $matches = $this->validateFilterForObject($row, $filters); |
1804 | 1804 | } catch (ParseException $ex) { |
1805 | - $this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [ |
|
1805 | + $this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [ |
|
1806 | 1806 | 'app' => 'dav', |
1807 | 1807 | 'exception' => $ex, |
1808 | 1808 | ]); |
1809 | 1809 | continue; |
1810 | 1810 | } catch (InvalidDataException $ex) { |
1811 | - $this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [ |
|
1811 | + $this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [ |
|
1812 | 1812 | 'app' => 'dav', |
1813 | 1813 | 'exception' => $ex, |
1814 | 1814 | ]); |
1815 | 1815 | continue; |
1816 | 1816 | } catch (MaxInstancesExceededException $ex) { |
1817 | - $this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: ' . $row['uri'], [ |
|
1817 | + $this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: '.$row['uri'], [ |
|
1818 | 1818 | 'app' => 'dav', |
1819 | 1819 | 'exception' => $ex, |
1820 | 1820 | ]); |
@@ -1826,7 +1826,7 @@ discard block |
||
1826 | 1826 | } |
1827 | 1827 | } |
1828 | 1828 | $result[] = $row['uri']; |
1829 | - $key = $calendarId . '::' . $row['uri'] . '::' . $calendarType; |
|
1829 | + $key = $calendarId.'::'.$row['uri'].'::'.$calendarType; |
|
1830 | 1830 | $this->cachedObjects[$key] = $this->rowToCalendarObject($row); |
1831 | 1831 | } |
1832 | 1832 | |
@@ -1845,7 +1845,7 @@ discard block |
||
1845 | 1845 | * @return array |
1846 | 1846 | */ |
1847 | 1847 | public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
1848 | - return $this->atomic(function () use ($principalUri, $filters, $limit, $offset) { |
|
1848 | + return $this->atomic(function() use ($principalUri, $filters, $limit, $offset) { |
|
1849 | 1849 | $calendars = $this->getCalendarsForUser($principalUri); |
1850 | 1850 | $ownCalendars = []; |
1851 | 1851 | $sharedCalendars = []; |
@@ -1937,7 +1937,7 @@ discard block |
||
1937 | 1937 | ->andWhere($compExpr) |
1938 | 1938 | ->andWhere($propParamExpr) |
1939 | 1939 | ->andWhere($query->expr()->iLike('i.value', |
1940 | - $query->createNamedParameter('%' . $this->db->escapeLikeParameter($filters['search-term']) . '%'))) |
|
1940 | + $query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%'))) |
|
1941 | 1941 | ->andWhere($query->expr()->isNull('deleted_at')); |
1942 | 1942 | |
1943 | 1943 | if ($offset) { |
@@ -1951,7 +1951,7 @@ discard block |
||
1951 | 1951 | |
1952 | 1952 | $result = []; |
1953 | 1953 | while ($row = $stmt->fetch()) { |
1954 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
1954 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
1955 | 1955 | if (!in_array($path, $result)) { |
1956 | 1956 | $result[] = $path; |
1957 | 1957 | } |
@@ -2021,7 +2021,7 @@ discard block |
||
2021 | 2021 | if ($pattern !== '') { |
2022 | 2022 | $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
2023 | 2023 | $outerQuery->createNamedParameter('%' |
2024 | - . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
2024 | + . $this->db->escapeLikeParameter($pattern).'%'))); |
|
2025 | 2025 | } |
2026 | 2026 | |
2027 | 2027 | $start = null; |
@@ -2073,7 +2073,7 @@ discard block |
||
2073 | 2073 | // For the pagination with hasLimit and hasTimeRange, a stable ordering is helpful. |
2074 | 2074 | $outerQuery->addOrderBy('id'); |
2075 | 2075 | |
2076 | - $offset = (int)$offset; |
|
2076 | + $offset = (int) $offset; |
|
2077 | 2077 | $outerQuery->setFirstResult($offset); |
2078 | 2078 | |
2079 | 2079 | $calendarObjects = []; |
@@ -2094,7 +2094,7 @@ discard block |
||
2094 | 2094 | * |
2095 | 2095 | * 25 rows and 3 retries is entirely arbitrary. |
2096 | 2096 | */ |
2097 | - $maxResults = (int)max($limit, 25); |
|
2097 | + $maxResults = (int) max($limit, 25); |
|
2098 | 2098 | $outerQuery->setMaxResults($maxResults); |
2099 | 2099 | |
2100 | 2100 | for ($attempt = $objectsCount = 0; $attempt < 3 && $objectsCount < $limit; $attempt++) { |
@@ -2108,7 +2108,7 @@ discard block |
||
2108 | 2108 | $calendarObjects = $this->searchCalendarObjects($outerQuery, $start, $end); |
2109 | 2109 | } |
2110 | 2110 | |
2111 | - $calendarObjects = array_map(function ($o) use ($options) { |
|
2111 | + $calendarObjects = array_map(function($o) use ($options) { |
|
2112 | 2112 | $calendarData = Reader::read($o['calendardata']); |
2113 | 2113 | |
2114 | 2114 | // Expand recurrences if an explicit time range is requested |
@@ -2136,16 +2136,16 @@ discard block |
||
2136 | 2136 | 'type' => $o['componenttype'], |
2137 | 2137 | 'uid' => $o['uid'], |
2138 | 2138 | 'uri' => $o['uri'], |
2139 | - 'objects' => array_map(function ($c) { |
|
2139 | + 'objects' => array_map(function($c) { |
|
2140 | 2140 | return $this->transformSearchData($c); |
2141 | 2141 | }, $objects), |
2142 | - 'timezones' => array_map(function ($c) { |
|
2142 | + 'timezones' => array_map(function($c) { |
|
2143 | 2143 | return $this->transformSearchData($c); |
2144 | 2144 | }, $timezones), |
2145 | 2145 | ]; |
2146 | 2146 | }, $calendarObjects); |
2147 | 2147 | |
2148 | - usort($calendarObjects, function (array $a, array $b) { |
|
2148 | + usort($calendarObjects, function(array $a, array $b) { |
|
2149 | 2149 | /** @var DateTimeImmutable $startA */ |
2150 | 2150 | $startA = $a['objects'][0]['DTSTART'][0] ?? new DateTimeImmutable(self::MAX_DATE); |
2151 | 2151 | /** @var DateTimeImmutable $startB */ |
@@ -2190,7 +2190,7 @@ discard block |
||
2190 | 2190 | 'time-range' => null, |
2191 | 2191 | ]); |
2192 | 2192 | } catch (MaxInstancesExceededException $ex) { |
2193 | - $this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: ' . $row['uri'], [ |
|
2193 | + $this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: '.$row['uri'], [ |
|
2194 | 2194 | 'app' => 'dav', |
2195 | 2195 | 'exception' => $ex, |
2196 | 2196 | ]); |
@@ -2221,7 +2221,7 @@ discard block |
||
2221 | 2221 | /** @var Component[] $subComponents */ |
2222 | 2222 | $subComponents = $comp->getComponents(); |
2223 | 2223 | /** @var Property[] $properties */ |
2224 | - $properties = array_filter($comp->children(), function ($c) { |
|
2224 | + $properties = array_filter($comp->children(), function($c) { |
|
2225 | 2225 | return $c instanceof Property; |
2226 | 2226 | }); |
2227 | 2227 | $validationRules = $comp->getValidationRules(); |
@@ -2289,7 +2289,7 @@ discard block |
||
2289 | 2289 | array $searchParameters, |
2290 | 2290 | array $options = [], |
2291 | 2291 | ): array { |
2292 | - return $this->atomic(function () use ($principalUri, $pattern, $componentTypes, $searchProperties, $searchParameters, $options) { |
|
2292 | + return $this->atomic(function() use ($principalUri, $pattern, $componentTypes, $searchProperties, $searchParameters, $options) { |
|
2293 | 2293 | $escapePattern = !\array_key_exists('escape_like_param', $options) || $options['escape_like_param'] !== false; |
2294 | 2294 | |
2295 | 2295 | $calendarObjectIdQuery = $this->db->getQueryBuilder(); |
@@ -2301,7 +2301,7 @@ discard block |
||
2301 | 2301 | $subscriptions = $this->getSubscriptionsForUser($principalUri); |
2302 | 2302 | foreach ($calendars as $calendar) { |
2303 | 2303 | $calendarAnd = $calendarObjectIdQuery->expr()->andX( |
2304 | - $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])), |
|
2304 | + $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id'])), |
|
2305 | 2305 | $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)), |
2306 | 2306 | ); |
2307 | 2307 | |
@@ -2315,7 +2315,7 @@ discard block |
||
2315 | 2315 | } |
2316 | 2316 | foreach ($subscriptions as $subscription) { |
2317 | 2317 | $subscriptionAnd = $calendarObjectIdQuery->expr()->andX( |
2318 | - $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])), |
|
2318 | + $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id'])), |
|
2319 | 2319 | $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)), |
2320 | 2320 | ); |
2321 | 2321 | |
@@ -2364,7 +2364,7 @@ discard block |
||
2364 | 2364 | if (!$escapePattern) { |
2365 | 2365 | $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern))); |
2366 | 2366 | } else { |
2367 | - $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
2367 | + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
2368 | 2368 | } |
2369 | 2369 | } |
2370 | 2370 | |
@@ -2392,7 +2392,7 @@ discard block |
||
2392 | 2392 | $result = $calendarObjectIdQuery->executeQuery(); |
2393 | 2393 | $matches = []; |
2394 | 2394 | while (($row = $result->fetch()) !== false) { |
2395 | - $matches[] = (int)$row['objectid']; |
|
2395 | + $matches[] = (int) $row['objectid']; |
|
2396 | 2396 | } |
2397 | 2397 | $result->closeCursor(); |
2398 | 2398 | |
@@ -2404,8 +2404,8 @@ discard block |
||
2404 | 2404 | $result = $query->executeQuery(); |
2405 | 2405 | $calendarObjects = []; |
2406 | 2406 | while (($array = $result->fetch()) !== false) { |
2407 | - $array['calendarid'] = (int)$array['calendarid']; |
|
2408 | - $array['calendartype'] = (int)$array['calendartype']; |
|
2407 | + $array['calendarid'] = (int) $array['calendarid']; |
|
2408 | + $array['calendartype'] = (int) $array['calendartype']; |
|
2409 | 2409 | $array['calendardata'] = $this->readBlob($array['calendardata']); |
2410 | 2410 | |
2411 | 2411 | $calendarObjects[] = $array; |
@@ -2451,7 +2451,7 @@ discard block |
||
2451 | 2451 | $row = $stmt->fetch(); |
2452 | 2452 | $stmt->closeCursor(); |
2453 | 2453 | if ($row) { |
2454 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
2454 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
2455 | 2455 | } |
2456 | 2456 | |
2457 | 2457 | return null; |
@@ -2477,14 +2477,14 @@ discard block |
||
2477 | 2477 | 'id' => $row['id'], |
2478 | 2478 | 'uri' => $row['uri'], |
2479 | 2479 | 'lastmodified' => $row['lastmodified'], |
2480 | - 'etag' => '"' . $row['etag'] . '"', |
|
2480 | + 'etag' => '"'.$row['etag'].'"', |
|
2481 | 2481 | 'calendarid' => $row['calendarid'], |
2482 | 2482 | 'calendaruri' => $row['calendaruri'], |
2483 | - 'size' => (int)$row['size'], |
|
2483 | + 'size' => (int) $row['size'], |
|
2484 | 2484 | 'calendardata' => $this->readBlob($row['calendardata']), |
2485 | 2485 | 'component' => strtolower($row['componenttype']), |
2486 | - 'classification' => (int)$row['classification'], |
|
2487 | - 'deleted_at' => isset($row['deleted_at']) ? ((int)$row['deleted_at']) : null, |
|
2486 | + 'classification' => (int) $row['classification'], |
|
2487 | + 'deleted_at' => isset($row['deleted_at']) ? ((int) $row['deleted_at']) : null, |
|
2488 | 2488 | ]; |
2489 | 2489 | } |
2490 | 2490 | |
@@ -2546,9 +2546,9 @@ discard block |
||
2546 | 2546 | * @return ?array |
2547 | 2547 | */ |
2548 | 2548 | public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
2549 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
2549 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
2550 | 2550 | |
2551 | - return $this->atomic(function () use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType, $table) { |
|
2551 | + return $this->atomic(function() use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType, $table) { |
|
2552 | 2552 | // Current synctoken |
2553 | 2553 | $qb = $this->db->getQueryBuilder(); |
2554 | 2554 | $qb->select('synctoken') |
@@ -2599,7 +2599,7 @@ discard block |
||
2599 | 2599 | while ($entry = $stmt->fetch(\PDO::FETCH_NUM)) { |
2600 | 2600 | // assign uri (column 0) to appropriate mutation based on operation (column 1) |
2601 | 2601 | // forced (int) is needed as doctrine with OCI returns the operation field as string not integer |
2602 | - match ((int)$entry[1]) { |
|
2602 | + match ((int) $entry[1]) { |
|
2603 | 2603 | 1 => $result['added'][] = $entry[0], |
2604 | 2604 | 2 => $result['modified'][] = $entry[0], |
2605 | 2605 | 3 => $result['deleted'][] = $entry[0], |
@@ -2670,7 +2670,7 @@ discard block |
||
2670 | 2670 | 'source' => $row['source'], |
2671 | 2671 | 'lastmodified' => $row['lastmodified'], |
2672 | 2672 | |
2673 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
2673 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
2674 | 2674 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
2675 | 2675 | ]; |
2676 | 2676 | |
@@ -2714,7 +2714,7 @@ discard block |
||
2714 | 2714 | } |
2715 | 2715 | } |
2716 | 2716 | |
2717 | - [$subscriptionId, $subscriptionRow] = $this->atomic(function () use ($values) { |
|
2717 | + [$subscriptionId, $subscriptionRow] = $this->atomic(function() use ($values) { |
|
2718 | 2718 | $valuesToInsert = []; |
2719 | 2719 | $query = $this->db->getQueryBuilder(); |
2720 | 2720 | foreach (array_keys($values) as $name) { |
@@ -2755,7 +2755,7 @@ discard block |
||
2755 | 2755 | $supportedProperties = array_keys($this->subscriptionPropertyMap); |
2756 | 2756 | $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
2757 | 2757 | |
2758 | - $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { |
|
2758 | + $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) { |
|
2759 | 2759 | $newValues = []; |
2760 | 2760 | |
2761 | 2761 | foreach ($mutations as $propertyName => $propertyValue) { |
@@ -2767,7 +2767,7 @@ discard block |
||
2767 | 2767 | } |
2768 | 2768 | } |
2769 | 2769 | |
2770 | - $subscriptionRow = $this->atomic(function () use ($subscriptionId, $newValues) { |
|
2770 | + $subscriptionRow = $this->atomic(function() use ($subscriptionId, $newValues) { |
|
2771 | 2771 | $query = $this->db->getQueryBuilder(); |
2772 | 2772 | $query->update('calendarsubscriptions') |
2773 | 2773 | ->set('lastmodified', $query->createNamedParameter(time())); |
@@ -2780,7 +2780,7 @@ discard block |
||
2780 | 2780 | return $this->getSubscriptionById($subscriptionId); |
2781 | 2781 | }, $this->db); |
2782 | 2782 | |
2783 | - $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); |
|
2783 | + $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations)); |
|
2784 | 2784 | |
2785 | 2785 | return true; |
2786 | 2786 | }); |
@@ -2793,7 +2793,7 @@ discard block |
||
2793 | 2793 | * @return void |
2794 | 2794 | */ |
2795 | 2795 | public function deleteSubscription($subscriptionId) { |
2796 | - $this->atomic(function () use ($subscriptionId): void { |
|
2796 | + $this->atomic(function() use ($subscriptionId): void { |
|
2797 | 2797 | $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
2798 | 2798 | |
2799 | 2799 | $query = $this->db->getQueryBuilder(); |
@@ -2818,7 +2818,7 @@ discard block |
||
2818 | 2818 | ->executeStatement(); |
2819 | 2819 | |
2820 | 2820 | if ($subscriptionRow) { |
2821 | - $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); |
|
2821 | + $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, [])); |
|
2822 | 2822 | } |
2823 | 2823 | }, $this->db); |
2824 | 2824 | } |
@@ -2857,8 +2857,8 @@ discard block |
||
2857 | 2857 | 'uri' => $row['uri'], |
2858 | 2858 | 'calendardata' => $row['calendardata'], |
2859 | 2859 | 'lastmodified' => $row['lastmodified'], |
2860 | - 'etag' => '"' . $row['etag'] . '"', |
|
2861 | - 'size' => (int)$row['size'], |
|
2860 | + 'etag' => '"'.$row['etag'].'"', |
|
2861 | + 'size' => (int) $row['size'], |
|
2862 | 2862 | ]; |
2863 | 2863 | } |
2864 | 2864 | |
@@ -2886,8 +2886,8 @@ discard block |
||
2886 | 2886 | 'calendardata' => $row['calendardata'], |
2887 | 2887 | 'uri' => $row['uri'], |
2888 | 2888 | 'lastmodified' => $row['lastmodified'], |
2889 | - 'etag' => '"' . $row['etag'] . '"', |
|
2890 | - 'size' => (int)$row['size'], |
|
2889 | + 'etag' => '"'.$row['etag'].'"', |
|
2890 | + 'size' => (int) $row['size'], |
|
2891 | 2891 | ]; |
2892 | 2892 | } |
2893 | 2893 | $stmt->closeCursor(); |
@@ -2929,8 +2929,8 @@ discard block |
||
2929 | 2929 | if ($count === 0) { |
2930 | 2930 | return; |
2931 | 2931 | } |
2932 | - $ids = array_map(static function (array $id) { |
|
2933 | - return (int)$id[0]; |
|
2932 | + $ids = array_map(static function(array $id) { |
|
2933 | + return (int) $id[0]; |
|
2934 | 2934 | }, $result->fetchAll(\PDO::FETCH_NUM)); |
2935 | 2935 | $result->closeCursor(); |
2936 | 2936 | |
@@ -2983,15 +2983,15 @@ discard block |
||
2983 | 2983 | */ |
2984 | 2984 | protected function addChanges(int $calendarId, array $objectUris, int $operation, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void { |
2985 | 2985 | $this->cachedObjects = []; |
2986 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
2986 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
2987 | 2987 | |
2988 | - $this->atomic(function () use ($calendarId, $objectUris, $operation, $calendarType, $table): void { |
|
2988 | + $this->atomic(function() use ($calendarId, $objectUris, $operation, $calendarType, $table): void { |
|
2989 | 2989 | $query = $this->db->getQueryBuilder(); |
2990 | 2990 | $query->select('synctoken') |
2991 | 2991 | ->from($table) |
2992 | 2992 | ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
2993 | 2993 | $result = $query->executeQuery(); |
2994 | - $syncToken = (int)$result->fetchOne(); |
|
2994 | + $syncToken = (int) $result->fetchOne(); |
|
2995 | 2995 | $result->closeCursor(); |
2996 | 2996 | |
2997 | 2997 | $query = $this->db->getQueryBuilder(); |
@@ -3020,7 +3020,7 @@ discard block |
||
3020 | 3020 | public function restoreChanges(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void { |
3021 | 3021 | $this->cachedObjects = []; |
3022 | 3022 | |
3023 | - $this->atomic(function () use ($calendarId, $calendarType): void { |
|
3023 | + $this->atomic(function() use ($calendarId, $calendarType): void { |
|
3024 | 3024 | $qbAdded = $this->db->getQueryBuilder(); |
3025 | 3025 | $qbAdded->select('uri') |
3026 | 3026 | ->from('calendarobjects') |
@@ -3050,7 +3050,7 @@ discard block |
||
3050 | 3050 | ) |
3051 | 3051 | ); |
3052 | 3052 | $resultDeleted = $qbDeleted->executeQuery(); |
3053 | - $deletedUris = array_map(function (string $uri) { |
|
3053 | + $deletedUris = array_map(function(string $uri) { |
|
3054 | 3054 | return str_replace('-deleted.ics', '.ics', $uri); |
3055 | 3055 | }, $resultDeleted->fetchAll(\PDO::FETCH_COLUMN)); |
3056 | 3056 | $resultDeleted->closeCursor(); |
@@ -3095,7 +3095,7 @@ discard block |
||
3095 | 3095 | // Track first component type and uid |
3096 | 3096 | if ($uid === null) { |
3097 | 3097 | $componentType = $component->name; |
3098 | - $uid = (string)$component->UID; |
|
3098 | + $uid = (string) $component->UID; |
|
3099 | 3099 | } |
3100 | 3100 | } |
3101 | 3101 | } |
@@ -3186,11 +3186,11 @@ discard block |
||
3186 | 3186 | * @param list<string> $remove |
3187 | 3187 | */ |
3188 | 3188 | public function updateShares(IShareable $shareable, array $add, array $remove): void { |
3189 | - $this->atomic(function () use ($shareable, $add, $remove): void { |
|
3189 | + $this->atomic(function() use ($shareable, $add, $remove): void { |
|
3190 | 3190 | $calendarId = $shareable->getResourceId(); |
3191 | 3191 | $calendarRow = $this->getCalendarById($calendarId); |
3192 | 3192 | if ($calendarRow === null) { |
3193 | - throw new \RuntimeException('Trying to update shares for non-existing calendar: ' . $calendarId); |
|
3193 | + throw new \RuntimeException('Trying to update shares for non-existing calendar: '.$calendarId); |
|
3194 | 3194 | } |
3195 | 3195 | $oldShares = $this->getShares($calendarId); |
3196 | 3196 | |
@@ -3221,7 +3221,7 @@ discard block |
||
3221 | 3221 | * @return string|null |
3222 | 3222 | */ |
3223 | 3223 | public function setPublishStatus($value, $calendar) { |
3224 | - return $this->atomic(function () use ($value, $calendar) { |
|
3224 | + return $this->atomic(function() use ($value, $calendar) { |
|
3225 | 3225 | $calendarId = $calendar->getResourceId(); |
3226 | 3226 | $calendarData = $this->getCalendarById($calendarId); |
3227 | 3227 | |
@@ -3288,7 +3288,7 @@ discard block |
||
3288 | 3288 | */ |
3289 | 3289 | public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
3290 | 3290 | $this->cachedObjects = []; |
3291 | - $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $calendarType): void { |
|
3291 | + $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $calendarType): void { |
|
3292 | 3292 | $objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType); |
3293 | 3293 | |
3294 | 3294 | try { |
@@ -3360,7 +3360,7 @@ discard block |
||
3360 | 3360 | * deletes all birthday calendars |
3361 | 3361 | */ |
3362 | 3362 | public function deleteAllBirthdayCalendars() { |
3363 | - $this->atomic(function (): void { |
|
3363 | + $this->atomic(function(): void { |
|
3364 | 3364 | $query = $this->db->getQueryBuilder(); |
3365 | 3365 | $result = $query->select(['id'])->from('calendars') |
3366 | 3366 | ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) |
@@ -3380,7 +3380,7 @@ discard block |
||
3380 | 3380 | * @param $subscriptionId |
3381 | 3381 | */ |
3382 | 3382 | public function purgeAllCachedEventsForSubscription($subscriptionId) { |
3383 | - $this->atomic(function () use ($subscriptionId): void { |
|
3383 | + $this->atomic(function() use ($subscriptionId): void { |
|
3384 | 3384 | $query = $this->db->getQueryBuilder(); |
3385 | 3385 | $query->select('uri') |
3386 | 3386 | ->from('calendarobjects') |
@@ -3426,7 +3426,7 @@ discard block |
||
3426 | 3426 | return; |
3427 | 3427 | } |
3428 | 3428 | |
3429 | - $this->atomic(function () use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void { |
|
3429 | + $this->atomic(function() use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void { |
|
3430 | 3430 | foreach (array_chunk($calendarObjectIds, 1000) as $chunk) { |
3431 | 3431 | $query = $this->db->getQueryBuilder(); |
3432 | 3432 | $query->delete($this->dbObjectPropertiesTable) |
@@ -3519,10 +3519,10 @@ discard block |
||
3519 | 3519 | $result->closeCursor(); |
3520 | 3520 | |
3521 | 3521 | if (!isset($objectIds['id'])) { |
3522 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
3522 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
3523 | 3523 | } |
3524 | 3524 | |
3525 | - return (int)$objectIds['id']; |
|
3525 | + return (int) $objectIds['id']; |
|
3526 | 3526 | } |
3527 | 3527 | |
3528 | 3528 | /** |
@@ -3538,7 +3538,7 @@ discard block |
||
3538 | 3538 | ->from('calendarchanges'); |
3539 | 3539 | |
3540 | 3540 | $result = $query->executeQuery(); |
3541 | - $maxId = (int)$result->fetchOne(); |
|
3541 | + $maxId = (int) $result->fetchOne(); |
|
3542 | 3542 | $result->closeCursor(); |
3543 | 3543 | if (!$maxId || $maxId < $keep) { |
3544 | 3544 | return 0; |
@@ -3576,8 +3576,8 @@ discard block |
||
3576 | 3576 | * |
3577 | 3577 | */ |
3578 | 3578 | private function addOwnerPrincipalToCalendar(array $calendarInfo): array { |
3579 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
3580 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
3579 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
3580 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
3581 | 3581 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
3582 | 3582 | $uri = $calendarInfo[$ownerPrincipalKey]; |
3583 | 3583 | } else { |
@@ -3686,10 +3686,10 @@ discard block |
||
3686 | 3686 | } |
3687 | 3687 | |
3688 | 3688 | public function unshare(IShareable $shareable, string $principal): void { |
3689 | - $this->atomic(function () use ($shareable, $principal): void { |
|
3689 | + $this->atomic(function() use ($shareable, $principal): void { |
|
3690 | 3690 | $calendarData = $this->getCalendarById($shareable->getResourceId()); |
3691 | 3691 | if ($calendarData === null) { |
3692 | - throw new \RuntimeException('Trying to update shares for non-existing calendar: ' . $shareable->getResourceId()); |
|
3692 | + throw new \RuntimeException('Trying to update shares for non-existing calendar: '.$shareable->getResourceId()); |
|
3693 | 3693 | } |
3694 | 3694 | |
3695 | 3695 | $oldShares = $this->getShares($shareable->getResourceId()); |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | ], |
124 | 124 | [ |
125 | 125 | 'privilege' => '{DAV:}read', |
126 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
126 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
127 | 127 | 'protected' => true, |
128 | 128 | ], |
129 | 129 | [ |
130 | 130 | 'privilege' => '{DAV:}read', |
131 | - 'principal' => $this->getOwner() . '/calendar-proxy-read', |
|
131 | + 'principal' => $this->getOwner().'/calendar-proxy-read', |
|
132 | 132 | 'protected' => true, |
133 | 133 | ], |
134 | 134 | ]; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | ]; |
142 | 142 | $acl[] = [ |
143 | 143 | 'privilege' => '{DAV:}write', |
144 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
144 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
145 | 145 | 'protected' => true, |
146 | 146 | ]; |
147 | 147 | } else { |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | ]; |
153 | 153 | $acl[] = [ |
154 | 154 | 'privilege' => '{DAV:}write-properties', |
155 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
155 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
156 | 156 | 'protected' => true, |
157 | 157 | ]; |
158 | 158 | } |
159 | 159 | |
160 | 160 | $acl[] = [ |
161 | 161 | 'privilege' => '{DAV:}write-properties', |
162 | - 'principal' => $this->getOwner() . '/calendar-proxy-read', |
|
162 | + 'principal' => $this->getOwner().'/calendar-proxy-read', |
|
163 | 163 | 'protected' => true, |
164 | 164 | ]; |
165 | 165 | |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | $acl = $this->caldavBackend->applyShareAcl($this->getResourceId(), $acl); |
199 | 199 | $allowedPrincipals = [ |
200 | 200 | $this->getOwner(), |
201 | - $this->getOwner() . '/calendar-proxy-read', |
|
202 | - $this->getOwner() . '/calendar-proxy-write', |
|
201 | + $this->getOwner().'/calendar-proxy-read', |
|
202 | + $this->getOwner().'/calendar-proxy-write', |
|
203 | 203 | parent::getOwner(), |
204 | 204 | 'principals/system/public', |
205 | 205 | ]; |
206 | 206 | /** @var list<array{privilege: string, principal: string, protected: bool}> $acl */ |
207 | - $acl = array_filter($acl, function (array $rule) use ($allowedPrincipals): bool { |
|
207 | + $acl = array_filter($acl, function(array $rule) use ($allowedPrincipals): bool { |
|
208 | 208 | return \in_array($rule['principal'], $allowedPrincipals, true); |
209 | 209 | }); |
210 | 210 | return $acl; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | public function delete() { |
225 | 225 | if ($this->isShared()) { |
226 | - $this->caldavBackend->unshare($this, 'principal:' . $this->getPrincipalURI()); |
|
226 | + $this->caldavBackend->unshare($this, 'principal:'.$this->getPrincipalURI()); |
|
227 | 227 | return; |
228 | 228 | } |
229 | 229 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | public function calendarQuery(array $filters) { |
308 | 308 | $uris = $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters, $this->getCalendarType()); |
309 | 309 | if ($this->isShared()) { |
310 | - return array_filter($uris, function ($uri) { |
|
310 | + return array_filter($uris, function($uri) { |
|
311 | 311 | return $this->childExists($uri); |
312 | 312 | }); |
313 | 313 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @inheritDoc |
382 | 382 | */ |
383 | 383 | public function restore(): void { |
384 | - $this->caldavBackend->restoreCalendar((int)$this->calendarInfo['id']); |
|
384 | + $this->caldavBackend->restoreCalendar((int) $this->calendarInfo['id']); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | public function disableTrashbin(): void { |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | $targetName, |
405 | 405 | ); |
406 | 406 | } catch (Exception $e) { |
407 | - $this->logger->error('Could not move calendar object: ' . $e->getMessage(), ['exception' => $e]); |
|
407 | + $this->logger->error('Could not move calendar object: '.$e->getMessage(), ['exception' => $e]); |
|
408 | 408 | return false; |
409 | 409 | } |
410 | 410 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | if (isset($status[200])) { |
71 | 71 | $absoluteUrl = $this->prepareUri($url, $resource); |
72 | 72 | $vCard = $this->download($absoluteUrl, $username, $sharedSecret); |
73 | - $this->atomic(function () use ($calendar, $objectUri, $vCard): void { |
|
73 | + $this->atomic(function() use ($calendar, $objectUri, $vCard): void { |
|
74 | 74 | $existingObject = $this->backend->getCalendarObject($calendar->getId(), $objectUri, CalDavBackend::CALENDAR_TYPE_FEDERATED); |
75 | 75 | if (!$existingObject) { |
76 | 76 | $this->backend->createCalendarObject($calendar->getId(), $objectUri, $vCard, CalDavBackend::CALENDAR_TYPE_FEDERATED); |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | public function getSyncTokenForSabre(): string { |
73 | - return 'http://sabre.io/ns/sync/' . $this->getSyncToken(); |
|
73 | + return 'http://sabre.io/ns/sync/'.$this->getSyncToken(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function getSharedByPrincipal(): string { |
77 | - return RemoteUserPrincipalBackend::PRINCIPAL_PREFIX . '/' . base64_encode($this->getSharedBy()); |
|
77 | + return RemoteUserPrincipalBackend::PRINCIPAL_PREFIX.'/'.base64_encode($this->getSharedBy()); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | public function getSupportedCalendarComponentSet(): SupportedCalendarComponentSet { |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | |
92 | 92 | '{DAV:}displayname' => $this->getDisplayName(), |
93 | 93 | '{http://sabredav.org/ns}sync-token' => $this->getSyncToken(), |
94 | - '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => $this->getSyncTokenForSabre(), |
|
95 | - '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => $this->getSupportedCalendarComponentSet(), |
|
96 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->getSharedByPrincipal(), |
|
94 | + '{'.\Sabre\CalDAV\Plugin::NS_CALENDARSERVER.'}getctag' => $this->getSyncTokenForSabre(), |
|
95 | + '{'.\Sabre\CalDAV\Plugin::NS_CALDAV.'}supported-calendar-component-set' => $this->getSupportedCalendarComponentSet(), |
|
96 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->getSharedByPrincipal(), |
|
97 | 97 | // TODO: implement read-write sharing |
98 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => 1 |
|
98 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => 1 |
|
99 | 99 | ]; |
100 | 100 | } |
101 | 101 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // 1. Validate share data |
74 | 74 | $shareWith = $this->decodeRemoteUserPrincipal($principal); |
75 | 75 | if ($shareWith === null) { |
76 | - $this->logger->error($baseError . 'Principal of sharee is not belonging to a remote user', [ |
|
76 | + $this->logger->error($baseError.'Principal of sharee is not belonging to a remote user', [ |
|
77 | 77 | 'shareable' => $shareable->getName(), |
78 | 78 | 'encodedShareWith' => $principal, |
79 | 79 | ]); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | [,, $ownerUid] = explode('/', $shareable->getOwner()); |
84 | 84 | $owner = $this->userManager->get($ownerUid); |
85 | 85 | if ($owner === null) { |
86 | - $this->logger->error($baseError . 'Shareable is not owned by a user on this server', [ |
|
86 | + $this->logger->error($baseError.'Shareable is not owned by a user on this server', [ |
|
87 | 87 | 'shareable' => $shareable->getName(), |
88 | 88 | 'shareWith' => $shareWith, |
89 | 89 | ]); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | // Need a calendar instance to extract properties for the protocol |
94 | 94 | $calendar = $shareable; |
95 | 95 | if (!($calendar instanceof Calendar)) { |
96 | - $this->logger->error($baseError . 'Shareable is not a calendar', [ |
|
96 | + $this->logger->error($baseError.'Shareable is not a calendar', [ |
|
97 | 97 | 'shareable' => $shareable->getName(), |
98 | 98 | 'owner' => $owner, |
99 | 99 | 'shareWith' => $shareWith, |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | |
124 | 124 | // 2. Send share to federated instance |
125 | 125 | $shareWithEncoded = base64_encode($shareWith); |
126 | - $relativeCalendarUrl = "remote-calendars/$shareWithEncoded/" . $calendar->getName() . '_shared_by_' . $ownerUid; |
|
127 | - $calendarUrl = $this->url->linkTo('', 'remote.php') . "/dav/$relativeCalendarUrl"; |
|
126 | + $relativeCalendarUrl = "remote-calendars/$shareWithEncoded/".$calendar->getName().'_shared_by_'.$ownerUid; |
|
127 | + $calendarUrl = $this->url->linkTo('', 'remote.php')."/dav/$relativeCalendarUrl"; |
|
128 | 128 | $calendarUrl = $this->url->getAbsoluteURL($calendarUrl); |
129 | 129 | $protocol = new CalendarFederationProtocolV1(); |
130 | 130 | $protocol->setUrl($calendarUrl); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | try { |
144 | 144 | $response = $this->federationManager->sendCloudShare($share); |
145 | 145 | } catch (OCMProviderException $e) { |
146 | - $this->logger->error($baseError . $e->getMessage(), [ |
|
146 | + $this->logger->error($baseError.$e->getMessage(), [ |
|
147 | 147 | 'exception' => $e, |
148 | 148 | 'owner' => $owner->getUID(), |
149 | 149 | 'calendar' => $shareable->getName(), |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | if ($response->getStatusCode() !== Http::STATUS_CREATED) { |
156 | - $this->logger->error($baseError . 'Server replied with code ' . $response->getStatusCode(), [ |
|
156 | + $this->logger->error($baseError.'Server replied with code '.$response->getStatusCode(), [ |
|
157 | 157 | 'responseBody' => $response->getBody(), |
158 | 158 | 'owner' => $owner->getUID(), |
159 | 159 | 'calendar' => $shareable->getName(), |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | // 3. Create a local DAV share to track the token for authentication |
166 | - $shareWithPrincipalUri = RemoteUserPrincipalBackend::PRINCIPAL_PREFIX . '/' . $shareWithEncoded; |
|
166 | + $shareWithPrincipalUri = RemoteUserPrincipalBackend::PRINCIPAL_PREFIX.'/'.$shareWithEncoded; |
|
167 | 167 | $this->sharingMapper->deleteShare( |
168 | 168 | $shareable->getResourceId(), |
169 | 169 | 'calendar', |