@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => ['timezone', 'string'], |
| 151 | 151 | '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], |
| 152 | 152 | '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], |
| 153 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int'], |
|
| 153 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => ['deleted_at', 'int'], |
|
| 154 | 154 | ]; |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | $result = $query->executeQuery(); |
| 249 | - $column = (int)$result->fetchOne(); |
|
| 249 | + $column = (int) $result->fetchOne(); |
|
| 250 | 250 | $result->closeCursor(); |
| 251 | 251 | return $column; |
| 252 | 252 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | $result = $query->executeQuery(); |
| 270 | - $column = (int)$result->fetchOne(); |
|
| 270 | + $column = (int) $result->fetchOne(); |
|
| 271 | 271 | $result->closeCursor(); |
| 272 | 272 | return $column; |
| 273 | 273 | } |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | $calendars = []; |
| 286 | 286 | while (($row = $result->fetchAssociative()) !== false) { |
| 287 | 287 | $calendars[] = [ |
| 288 | - 'id' => (int)$row['id'], |
|
| 289 | - 'deleted_at' => (int)$row['deleted_at'], |
|
| 288 | + 'id' => (int) $row['id'], |
|
| 289 | + 'deleted_at' => (int) $row['deleted_at'], |
|
| 290 | 290 | ]; |
| 291 | 291 | } |
| 292 | 292 | $result->closeCursor(); |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | * @return array |
| 320 | 320 | */ |
| 321 | 321 | public function getCalendarsForUser($principalUri) { |
| 322 | - return $this->atomic(function () use ($principalUri) { |
|
| 322 | + return $this->atomic(function() use ($principalUri) { |
|
| 323 | 323 | $principalUriOriginal = $principalUri; |
| 324 | 324 | $principalUri = $this->convertPrincipal($principalUri, true); |
| 325 | 325 | $fields = array_column($this->propertyMap, 0); |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | $calendars = []; |
| 348 | 348 | while ($row = $result->fetchAssociative()) { |
| 349 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 349 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 350 | 350 | $components = []; |
| 351 | 351 | if ($row['components']) { |
| 352 | 352 | $components = explode(',', $row['components']); |
@@ -356,11 +356,11 @@ discard block |
||
| 356 | 356 | 'id' => $row['id'], |
| 357 | 357 | 'uri' => $row['uri'], |
| 358 | 358 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 359 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 359 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 360 | 360 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 361 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 362 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 363 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 361 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 362 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 363 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 364 | 364 | ]; |
| 365 | 365 | |
| 366 | 366 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -379,8 +379,8 @@ discard block |
||
| 379 | 379 | $principals[] = $principalUri; |
| 380 | 380 | |
| 381 | 381 | $fields = array_column($this->propertyMap, 0); |
| 382 | - $fields = array_map(function (string $field) { |
|
| 383 | - return 'a.' . $field; |
|
| 382 | + $fields = array_map(function(string $field) { |
|
| 383 | + return 'a.'.$field; |
|
| 384 | 384 | }, $fields); |
| 385 | 385 | $fields[] = 'a.id'; |
| 386 | 386 | $fields[] = 'a.uri'; |
@@ -407,14 +407,14 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | $results = $select->executeQuery(); |
| 409 | 409 | |
| 410 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 410 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
| 411 | 411 | while ($row = $results->fetchAssociative()) { |
| 412 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 412 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 413 | 413 | if ($row['principaluri'] === $principalUri) { |
| 414 | 414 | continue; |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - $readOnly = (int)$row['access'] === Backend::ACCESS_READ; |
|
| 417 | + $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
| 418 | 418 | if (isset($calendars[$row['id']])) { |
| 419 | 419 | if ($readOnly) { |
| 420 | 420 | // New share can not have more permissions than the old one. |
@@ -428,8 +428,8 @@ discard block |
||
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | [, $name] = Uri\split($row['principaluri']); |
| 431 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 432 | - $row['displayname'] = $row['displayname'] . ' (' . ($this->userManager->getDisplayName($name) ?? ($name ?? '')) . ')'; |
|
| 431 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
| 432 | + $row['displayname'] = $row['displayname'].' ('.($this->userManager->getDisplayName($name) ?? ($name ?? '')).')'; |
|
| 433 | 433 | $components = []; |
| 434 | 434 | if ($row['components']) { |
| 435 | 435 | $components = explode(',', $row['components']); |
@@ -438,11 +438,11 @@ discard block |
||
| 438 | 438 | 'id' => $row['id'], |
| 439 | 439 | 'uri' => $uri, |
| 440 | 440 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
| 441 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 441 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 442 | 442 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 443 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 444 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 445 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 443 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 444 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 445 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 446 | 446 | $readOnlyPropertyName => $readOnly, |
| 447 | 447 | ]; |
| 448 | 448 | |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | $stmt = $query->executeQuery(); |
| 480 | 480 | $calendars = []; |
| 481 | 481 | while ($row = $stmt->fetchAssociative()) { |
| 482 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 482 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 483 | 483 | $components = []; |
| 484 | 484 | if ($row['components']) { |
| 485 | 485 | $components = explode(',', $row['components']); |
@@ -488,10 +488,10 @@ discard block |
||
| 488 | 488 | 'id' => $row['id'], |
| 489 | 489 | 'uri' => $row['uri'], |
| 490 | 490 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 491 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 491 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 492 | 492 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 493 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 494 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 493 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 494 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 495 | 495 | ]; |
| 496 | 496 | |
| 497 | 497 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -529,9 +529,9 @@ discard block |
||
| 529 | 529 | ->executeQuery(); |
| 530 | 530 | |
| 531 | 531 | while ($row = $result->fetchAssociative()) { |
| 532 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 532 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 533 | 533 | [, $name] = Uri\split($row['principaluri']); |
| 534 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
| 534 | + $row['displayname'] = $row['displayname']."($name)"; |
|
| 535 | 535 | $components = []; |
| 536 | 536 | if ($row['components']) { |
| 537 | 537 | $components = explode(',', $row['components']); |
@@ -540,13 +540,13 @@ discard block |
||
| 540 | 540 | 'id' => $row['id'], |
| 541 | 541 | 'uri' => $row['publicuri'], |
| 542 | 542 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 543 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 543 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 544 | 544 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 545 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 546 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 547 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 548 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => true, |
|
| 549 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 545 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 546 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 547 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 548 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => true, |
|
| 549 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 550 | 550 | ]; |
| 551 | 551 | |
| 552 | 552 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -591,12 +591,12 @@ discard block |
||
| 591 | 591 | $result->closeCursor(); |
| 592 | 592 | |
| 593 | 593 | if ($row === false) { |
| 594 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
| 594 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 597 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 598 | 598 | [, $name] = Uri\split($row['principaluri']); |
| 599 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
| 599 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
| 600 | 600 | $components = []; |
| 601 | 601 | if ($row['components']) { |
| 602 | 602 | $components = explode(',', $row['components']); |
@@ -605,13 +605,13 @@ discard block |
||
| 605 | 605 | 'id' => $row['id'], |
| 606 | 606 | 'uri' => $row['publicuri'], |
| 607 | 607 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 608 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 608 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 609 | 609 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 610 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 611 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 612 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 613 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => true, |
|
| 614 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 610 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 611 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 612 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 613 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => true, |
|
| 614 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 615 | 615 | ]; |
| 616 | 616 | |
| 617 | 617 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | return null; |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 652 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 653 | 653 | $components = []; |
| 654 | 654 | if ($row['components']) { |
| 655 | 655 | $components = explode(',', $row['components']); |
@@ -659,10 +659,10 @@ discard block |
||
| 659 | 659 | 'id' => $row['id'], |
| 660 | 660 | 'uri' => $row['uri'], |
| 661 | 661 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 662 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 662 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 663 | 663 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 664 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 665 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 664 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 665 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 666 | 666 | ]; |
| 667 | 667 | |
| 668 | 668 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | return null; |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 701 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 702 | 702 | $components = []; |
| 703 | 703 | if ($row['components']) { |
| 704 | 704 | $components = explode(',', $row['components']); |
@@ -708,10 +708,10 @@ discard block |
||
| 708 | 708 | 'id' => $row['id'], |
| 709 | 709 | 'uri' => $row['uri'], |
| 710 | 710 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 711 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 711 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 712 | 712 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?? 0, |
| 713 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 714 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 713 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 714 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 715 | 715 | ]; |
| 716 | 716 | |
| 717 | 717 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -746,14 +746,14 @@ discard block |
||
| 746 | 746 | return null; |
| 747 | 747 | } |
| 748 | 748 | |
| 749 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 749 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 750 | 750 | $subscription = [ |
| 751 | 751 | 'id' => $row['id'], |
| 752 | 752 | 'uri' => $row['uri'], |
| 753 | 753 | 'principaluri' => $row['principaluri'], |
| 754 | 754 | 'source' => $row['source'], |
| 755 | 755 | 'lastmodified' => $row['lastmodified'], |
| 756 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 756 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 757 | 757 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 758 | 758 | ]; |
| 759 | 759 | |
@@ -783,14 +783,14 @@ discard block |
||
| 783 | 783 | return null; |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 786 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 787 | 787 | $subscription = [ |
| 788 | 788 | 'id' => $row['id'], |
| 789 | 789 | 'uri' => $row['uri'], |
| 790 | 790 | 'principaluri' => $row['principaluri'], |
| 791 | 791 | 'source' => $row['source'], |
| 792 | 792 | 'lastmodified' => $row['lastmodified'], |
| 793 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 793 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 794 | 794 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 795 | 795 | ]; |
| 796 | 796 | |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
| 829 | 829 | if (isset($properties[$sccs])) { |
| 830 | 830 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
| 831 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 831 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 832 | 832 | } |
| 833 | 833 | $values['components'] = implode(',', $properties[$sccs]->getValue()); |
| 834 | 834 | } elseif (isset($properties['components'])) { |
@@ -837,9 +837,9 @@ discard block |
||
| 837 | 837 | $values['components'] = $properties['components']; |
| 838 | 838 | } |
| 839 | 839 | |
| 840 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 840 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 841 | 841 | if (isset($properties[$transp])) { |
| 842 | - $values['transparent'] = (int)($properties[$transp]->getValue() === 'transparent'); |
|
| 842 | + $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
|
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | foreach ($this->propertyMap as $xmlName => [$dbName, $type]) { |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | } |
| 849 | 849 | } |
| 850 | 850 | |
| 851 | - [$calendarId, $calendarData] = $this->atomic(function () use ($values) { |
|
| 851 | + [$calendarId, $calendarData] = $this->atomic(function() use ($values) { |
|
| 852 | 852 | $query = $this->db->getQueryBuilder(); |
| 853 | 853 | $query->insert('calendars'); |
| 854 | 854 | foreach ($values as $column => $value) { |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | return [$calendarId, $calendarData]; |
| 862 | 862 | }, $this->db); |
| 863 | 863 | |
| 864 | - $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); |
|
| 864 | + $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData)); |
|
| 865 | 865 | |
| 866 | 866 | return $calendarId; |
| 867 | 867 | } |
@@ -884,15 +884,15 @@ discard block |
||
| 884 | 884 | */ |
| 885 | 885 | public function updateCalendar($calendarId, PropPatch $propPatch) { |
| 886 | 886 | $supportedProperties = array_keys($this->propertyMap); |
| 887 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 887 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 888 | 888 | |
| 889 | - $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { |
|
| 889 | + $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
|
| 890 | 890 | $newValues = []; |
| 891 | 891 | foreach ($mutations as $propertyName => $propertyValue) { |
| 892 | 892 | switch ($propertyName) { |
| 893 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': |
|
| 893 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp': |
|
| 894 | 894 | $fieldName = 'transparent'; |
| 895 | - $newValues[$fieldName] = (int)($propertyValue->getValue() === 'transparent'); |
|
| 895 | + $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
|
| 896 | 896 | break; |
| 897 | 897 | default: |
| 898 | 898 | $fieldName = $this->propertyMap[$propertyName][0]; |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | break; |
| 901 | 901 | } |
| 902 | 902 | } |
| 903 | - [$calendarData, $shares] = $this->atomic(function () use ($calendarId, $newValues) { |
|
| 903 | + [$calendarData, $shares] = $this->atomic(function() use ($calendarId, $newValues) { |
|
| 904 | 904 | $query = $this->db->getQueryBuilder(); |
| 905 | 905 | $query->update('calendars'); |
| 906 | 906 | foreach ($newValues as $fieldName => $value) { |
@@ -929,9 +929,9 @@ discard block |
||
| 929 | 929 | * @return void |
| 930 | 930 | */ |
| 931 | 931 | public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) { |
| 932 | - $this->publishStatusCache->remove((string)$calendarId); |
|
| 932 | + $this->publishStatusCache->remove((string) $calendarId); |
|
| 933 | 933 | |
| 934 | - $this->atomic(function () use ($calendarId, $forceDeletePermanently): void { |
|
| 934 | + $this->atomic(function() use ($calendarId, $forceDeletePermanently): void { |
|
| 935 | 935 | // The calendar is deleted right away if this is either enforced by the caller |
| 936 | 936 | // or the special contacts birthday calendar or when the preference of an empty |
| 937 | 937 | // retention (0 seconds) is set, which signals a disabled trashbin. |
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | public function restoreCalendar(int $id): void { |
| 997 | - $this->atomic(function () use ($id): void { |
|
| 997 | + $this->atomic(function() use ($id): void { |
|
| 998 | 998 | $qb = $this->db->getQueryBuilder(); |
| 999 | 999 | $update = $qb->update('calendars') |
| 1000 | 1000 | ->set('deleted_at', $qb->createNamedParameter(null)) |
@@ -1141,11 +1141,11 @@ discard block |
||
| 1141 | 1141 | 'id' => $row['id'], |
| 1142 | 1142 | 'uri' => $row['uri'], |
| 1143 | 1143 | 'lastmodified' => $row['lastmodified'], |
| 1144 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1144 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1145 | 1145 | 'calendarid' => $row['calendarid'], |
| 1146 | - 'size' => (int)$row['size'], |
|
| 1146 | + 'size' => (int) $row['size'], |
|
| 1147 | 1147 | 'component' => strtolower($row['componenttype']), |
| 1148 | - 'classification' => (int)$row['classification'] |
|
| 1148 | + 'classification' => (int) $row['classification'] |
|
| 1149 | 1149 | ]; |
| 1150 | 1150 | } |
| 1151 | 1151 | $stmt->closeCursor(); |
@@ -1168,13 +1168,13 @@ discard block |
||
| 1168 | 1168 | 'id' => $row['id'], |
| 1169 | 1169 | 'uri' => $row['uri'], |
| 1170 | 1170 | 'lastmodified' => $row['lastmodified'], |
| 1171 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1172 | - 'calendarid' => (int)$row['calendarid'], |
|
| 1173 | - 'calendartype' => (int)$row['calendartype'], |
|
| 1174 | - 'size' => (int)$row['size'], |
|
| 1171 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1172 | + 'calendarid' => (int) $row['calendarid'], |
|
| 1173 | + 'calendartype' => (int) $row['calendartype'], |
|
| 1174 | + 'size' => (int) $row['size'], |
|
| 1175 | 1175 | 'component' => strtolower($row['componenttype']), |
| 1176 | - 'classification' => (int)$row['classification'], |
|
| 1177 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
| 1176 | + 'classification' => (int) $row['classification'], |
|
| 1177 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
| 1178 | 1178 | ]; |
| 1179 | 1179 | } |
| 1180 | 1180 | $stmt->closeCursor(); |
@@ -1207,13 +1207,13 @@ discard block |
||
| 1207 | 1207 | 'id' => $row['id'], |
| 1208 | 1208 | 'uri' => $row['uri'], |
| 1209 | 1209 | 'lastmodified' => $row['lastmodified'], |
| 1210 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1210 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1211 | 1211 | 'calendarid' => $row['calendarid'], |
| 1212 | 1212 | 'calendaruri' => $row['calendaruri'], |
| 1213 | - 'size' => (int)$row['size'], |
|
| 1213 | + 'size' => (int) $row['size'], |
|
| 1214 | 1214 | 'component' => strtolower($row['componenttype']), |
| 1215 | - 'classification' => (int)$row['classification'], |
|
| 1216 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
| 1215 | + 'classification' => (int) $row['classification'], |
|
| 1216 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
| 1217 | 1217 | ]; |
| 1218 | 1218 | } |
| 1219 | 1219 | $stmt->closeCursor(); |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | * @return array|null |
| 1240 | 1240 | */ |
| 1241 | 1241 | public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
| 1242 | - $key = $calendarId . '::' . $objectUri . '::' . $calendarType; |
|
| 1242 | + $key = $calendarId.'::'.$objectUri.'::'.$calendarType; |
|
| 1243 | 1243 | if (isset($this->cachedObjects[$key])) { |
| 1244 | 1244 | return $this->cachedObjects[$key]; |
| 1245 | 1245 | } |
@@ -1268,13 +1268,13 @@ discard block |
||
| 1268 | 1268 | 'uri' => $row['uri'], |
| 1269 | 1269 | 'uid' => $row['uid'], |
| 1270 | 1270 | 'lastmodified' => $row['lastmodified'], |
| 1271 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1271 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1272 | 1272 | 'calendarid' => $row['calendarid'], |
| 1273 | - 'size' => (int)$row['size'], |
|
| 1273 | + 'size' => (int) $row['size'], |
|
| 1274 | 1274 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 1275 | 1275 | 'component' => strtolower($row['componenttype']), |
| 1276 | - 'classification' => (int)$row['classification'], |
|
| 1277 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
| 1276 | + 'classification' => (int) $row['classification'], |
|
| 1277 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
| 1278 | 1278 | ]; |
| 1279 | 1279 | } |
| 1280 | 1280 | |
@@ -1316,12 +1316,12 @@ discard block |
||
| 1316 | 1316 | 'id' => $row['id'], |
| 1317 | 1317 | 'uri' => $row['uri'], |
| 1318 | 1318 | 'lastmodified' => $row['lastmodified'], |
| 1319 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1319 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1320 | 1320 | 'calendarid' => $row['calendarid'], |
| 1321 | - 'size' => (int)$row['size'], |
|
| 1321 | + 'size' => (int) $row['size'], |
|
| 1322 | 1322 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 1323 | 1323 | 'component' => strtolower($row['componenttype']), |
| 1324 | - 'classification' => (int)$row['classification'] |
|
| 1324 | + 'classification' => (int) $row['classification'] |
|
| 1325 | 1325 | ]; |
| 1326 | 1326 | } |
| 1327 | 1327 | $result->closeCursor(); |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | $this->cachedObjects = []; |
| 1354 | 1354 | $extraData = $this->getDenormalizedData($calendarData); |
| 1355 | 1355 | |
| 1356 | - return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
| 1356 | + return $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
| 1357 | 1357 | // Try to detect duplicates |
| 1358 | 1358 | $qb = $this->db->getQueryBuilder(); |
| 1359 | 1359 | $qb->select($qb->func()->count('*')) |
@@ -1363,7 +1363,7 @@ discard block |
||
| 1363 | 1363 | ->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))) |
| 1364 | 1364 | ->andWhere($qb->expr()->isNull('deleted_at')); |
| 1365 | 1365 | $result = $qb->executeQuery(); |
| 1366 | - $count = (int)$result->fetchOne(); |
|
| 1366 | + $count = (int) $result->fetchOne(); |
|
| 1367 | 1367 | $result->closeCursor(); |
| 1368 | 1368 | |
| 1369 | 1369 | if ($count !== 0) { |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | // TODO: implement custom event for federated calendars |
| 1424 | 1424 | } |
| 1425 | 1425 | |
| 1426 | - return '"' . $extraData['etag'] . '"'; |
|
| 1426 | + return '"'.$extraData['etag'].'"'; |
|
| 1427 | 1427 | }, $this->db); |
| 1428 | 1428 | } |
| 1429 | 1429 | |
@@ -1450,7 +1450,7 @@ discard block |
||
| 1450 | 1450 | $this->cachedObjects = []; |
| 1451 | 1451 | $extraData = $this->getDenormalizedData($calendarData); |
| 1452 | 1452 | |
| 1453 | - return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
| 1453 | + return $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
| 1454 | 1454 | $query = $this->db->getQueryBuilder(); |
| 1455 | 1455 | $query->update('calendarobjects') |
| 1456 | 1456 | ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) |
@@ -1486,7 +1486,7 @@ discard block |
||
| 1486 | 1486 | } |
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | - return '"' . $extraData['etag'] . '"'; |
|
| 1489 | + return '"'.$extraData['etag'].'"'; |
|
| 1490 | 1490 | }, $this->db); |
| 1491 | 1491 | } |
| 1492 | 1492 | |
@@ -1504,7 +1504,7 @@ discard block |
||
| 1504 | 1504 | */ |
| 1505 | 1505 | public function moveCalendarObject(string $sourcePrincipalUri, int $sourceObjectId, string $targetPrincipalUri, int $targetCalendarId, string $tragetObjectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR): bool { |
| 1506 | 1506 | $this->cachedObjects = []; |
| 1507 | - return $this->atomic(function () use ($sourcePrincipalUri, $sourceObjectId, $targetPrincipalUri, $targetCalendarId, $tragetObjectUri, $calendarType) { |
|
| 1507 | + return $this->atomic(function() use ($sourcePrincipalUri, $sourceObjectId, $targetPrincipalUri, $targetCalendarId, $tragetObjectUri, $calendarType) { |
|
| 1508 | 1508 | $object = $this->getCalendarObjectById($sourcePrincipalUri, $sourceObjectId); |
| 1509 | 1509 | if (empty($object)) { |
| 1510 | 1510 | return false; |
@@ -1561,7 +1561,7 @@ discard block |
||
| 1561 | 1561 | */ |
| 1562 | 1562 | public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) { |
| 1563 | 1563 | $this->cachedObjects = []; |
| 1564 | - $this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void { |
|
| 1564 | + $this->atomic(function() use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void { |
|
| 1565 | 1565 | $data = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
| 1566 | 1566 | |
| 1567 | 1567 | if ($data === null) { |
@@ -1645,8 +1645,8 @@ discard block |
||
| 1645 | 1645 | */ |
| 1646 | 1646 | public function restoreCalendarObject(array $objectData): void { |
| 1647 | 1647 | $this->cachedObjects = []; |
| 1648 | - $this->atomic(function () use ($objectData): void { |
|
| 1649 | - $id = (int)$objectData['id']; |
|
| 1648 | + $this->atomic(function() use ($objectData): void { |
|
| 1649 | + $id = (int) $objectData['id']; |
|
| 1650 | 1650 | $restoreUri = str_replace('-deleted.ics', '.ics', $objectData['uri']); |
| 1651 | 1651 | $targetObject = $this->getCalendarObject( |
| 1652 | 1652 | $objectData['calendarid'], |
@@ -1676,17 +1676,17 @@ discard block |
||
| 1676 | 1676 | // Welp, this should possibly not have happened, but let's ignore |
| 1677 | 1677 | return; |
| 1678 | 1678 | } |
| 1679 | - $this->addChanges($row['calendarid'], [$row['uri']], 1, (int)$row['calendartype']); |
|
| 1679 | + $this->addChanges($row['calendarid'], [$row['uri']], 1, (int) $row['calendartype']); |
|
| 1680 | 1680 | |
| 1681 | - $calendarRow = $this->getCalendarById((int)$row['calendarid']); |
|
| 1681 | + $calendarRow = $this->getCalendarById((int) $row['calendarid']); |
|
| 1682 | 1682 | if ($calendarRow === null) { |
| 1683 | 1683 | throw new RuntimeException('Calendar object data that was just written can\'t be read back. Check your database configuration.'); |
| 1684 | 1684 | } |
| 1685 | 1685 | $this->dispatcher->dispatchTyped( |
| 1686 | 1686 | new CalendarObjectRestoredEvent( |
| 1687 | - (int)$objectData['calendarid'], |
|
| 1687 | + (int) $objectData['calendarid'], |
|
| 1688 | 1688 | $calendarRow, |
| 1689 | - $this->getShares((int)$row['calendarid']), |
|
| 1689 | + $this->getShares((int) $row['calendarid']), |
|
| 1690 | 1690 | $row |
| 1691 | 1691 | ) |
| 1692 | 1692 | ); |
@@ -1805,19 +1805,19 @@ discard block |
||
| 1805 | 1805 | try { |
| 1806 | 1806 | $matches = $this->validateFilterForObject($row, $filters); |
| 1807 | 1807 | } catch (ParseException $ex) { |
| 1808 | - $this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [ |
|
| 1808 | + $this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [ |
|
| 1809 | 1809 | 'app' => 'dav', |
| 1810 | 1810 | 'exception' => $ex, |
| 1811 | 1811 | ]); |
| 1812 | 1812 | continue; |
| 1813 | 1813 | } catch (InvalidDataException $ex) { |
| 1814 | - $this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [ |
|
| 1814 | + $this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [ |
|
| 1815 | 1815 | 'app' => 'dav', |
| 1816 | 1816 | 'exception' => $ex, |
| 1817 | 1817 | ]); |
| 1818 | 1818 | continue; |
| 1819 | 1819 | } catch (MaxInstancesExceededException $ex) { |
| 1820 | - $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'], [ |
|
| 1820 | + $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'], [ |
|
| 1821 | 1821 | 'app' => 'dav', |
| 1822 | 1822 | 'exception' => $ex, |
| 1823 | 1823 | ]); |
@@ -1829,7 +1829,7 @@ discard block |
||
| 1829 | 1829 | } |
| 1830 | 1830 | } |
| 1831 | 1831 | $result[] = $row['uri']; |
| 1832 | - $key = $calendarId . '::' . $row['uri'] . '::' . $calendarType; |
|
| 1832 | + $key = $calendarId.'::'.$row['uri'].'::'.$calendarType; |
|
| 1833 | 1833 | $this->cachedObjects[$key] = $this->rowToCalendarObject($row); |
| 1834 | 1834 | } |
| 1835 | 1835 | |
@@ -1848,7 +1848,7 @@ discard block |
||
| 1848 | 1848 | * @return array |
| 1849 | 1849 | */ |
| 1850 | 1850 | public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
| 1851 | - return $this->atomic(function () use ($principalUri, $filters, $limit, $offset) { |
|
| 1851 | + return $this->atomic(function() use ($principalUri, $filters, $limit, $offset) { |
|
| 1852 | 1852 | $calendars = $this->getCalendarsForUser($principalUri); |
| 1853 | 1853 | $ownCalendars = []; |
| 1854 | 1854 | $sharedCalendars = []; |
@@ -1940,7 +1940,7 @@ discard block |
||
| 1940 | 1940 | ->andWhere($compExpr) |
| 1941 | 1941 | ->andWhere($propParamExpr) |
| 1942 | 1942 | ->andWhere($query->expr()->iLike('i.value', |
| 1943 | - $query->createNamedParameter('%' . $this->db->escapeLikeParameter($filters['search-term']) . '%'))) |
|
| 1943 | + $query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%'))) |
|
| 1944 | 1944 | ->andWhere($query->expr()->isNull('deleted_at')); |
| 1945 | 1945 | |
| 1946 | 1946 | if ($offset) { |
@@ -1954,7 +1954,7 @@ discard block |
||
| 1954 | 1954 | |
| 1955 | 1955 | $result = []; |
| 1956 | 1956 | while ($row = $stmt->fetchAssociative()) { |
| 1957 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
| 1957 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
| 1958 | 1958 | if (!in_array($path, $result)) { |
| 1959 | 1959 | $result[] = $path; |
| 1960 | 1960 | } |
@@ -2024,7 +2024,7 @@ discard block |
||
| 2024 | 2024 | if ($pattern !== '') { |
| 2025 | 2025 | $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
| 2026 | 2026 | $outerQuery->createNamedParameter('%' |
| 2027 | - . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 2027 | + . $this->db->escapeLikeParameter($pattern).'%'))); |
|
| 2028 | 2028 | } |
| 2029 | 2029 | |
| 2030 | 2030 | $start = null; |
@@ -2076,7 +2076,7 @@ discard block |
||
| 2076 | 2076 | // For the pagination with hasLimit and hasTimeRange, a stable ordering is helpful. |
| 2077 | 2077 | $outerQuery->addOrderBy('id'); |
| 2078 | 2078 | |
| 2079 | - $offset = (int)$offset; |
|
| 2079 | + $offset = (int) $offset; |
|
| 2080 | 2080 | $outerQuery->setFirstResult($offset); |
| 2081 | 2081 | |
| 2082 | 2082 | $calendarObjects = []; |
@@ -2097,7 +2097,7 @@ discard block |
||
| 2097 | 2097 | * |
| 2098 | 2098 | * 25 rows and 3 retries is entirely arbitrary. |
| 2099 | 2099 | */ |
| 2100 | - $maxResults = (int)max($limit, 25); |
|
| 2100 | + $maxResults = (int) max($limit, 25); |
|
| 2101 | 2101 | $outerQuery->setMaxResults($maxResults); |
| 2102 | 2102 | |
| 2103 | 2103 | for ($attempt = $objectsCount = 0; $attempt < 3 && $objectsCount < $limit; $attempt++) { |
@@ -2111,7 +2111,7 @@ discard block |
||
| 2111 | 2111 | $calendarObjects = $this->searchCalendarObjects($outerQuery, $start, $end); |
| 2112 | 2112 | } |
| 2113 | 2113 | |
| 2114 | - $calendarObjects = array_map(function ($o) use ($options) { |
|
| 2114 | + $calendarObjects = array_map(function($o) use ($options) { |
|
| 2115 | 2115 | $calendarData = Reader::read($o['calendardata']); |
| 2116 | 2116 | |
| 2117 | 2117 | // Expand recurrences if an explicit time range is requested |
@@ -2139,16 +2139,16 @@ discard block |
||
| 2139 | 2139 | 'type' => $o['componenttype'], |
| 2140 | 2140 | 'uid' => $o['uid'], |
| 2141 | 2141 | 'uri' => $o['uri'], |
| 2142 | - 'objects' => array_map(function ($c) { |
|
| 2142 | + 'objects' => array_map(function($c) { |
|
| 2143 | 2143 | return $this->transformSearchData($c); |
| 2144 | 2144 | }, $objects), |
| 2145 | - 'timezones' => array_map(function ($c) { |
|
| 2145 | + 'timezones' => array_map(function($c) { |
|
| 2146 | 2146 | return $this->transformSearchData($c); |
| 2147 | 2147 | }, $timezones), |
| 2148 | 2148 | ]; |
| 2149 | 2149 | }, $calendarObjects); |
| 2150 | 2150 | |
| 2151 | - usort($calendarObjects, function (array $a, array $b) { |
|
| 2151 | + usort($calendarObjects, function(array $a, array $b) { |
|
| 2152 | 2152 | /** @var DateTimeImmutable $startA */ |
| 2153 | 2153 | $startA = $a['objects'][0]['DTSTART'][0] ?? new DateTimeImmutable(self::MAX_DATE); |
| 2154 | 2154 | /** @var DateTimeImmutable $startB */ |
@@ -2193,7 +2193,7 @@ discard block |
||
| 2193 | 2193 | 'time-range' => null, |
| 2194 | 2194 | ]); |
| 2195 | 2195 | } catch (MaxInstancesExceededException $ex) { |
| 2196 | - $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'], [ |
|
| 2196 | + $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'], [ |
|
| 2197 | 2197 | 'app' => 'dav', |
| 2198 | 2198 | 'exception' => $ex, |
| 2199 | 2199 | ]); |
@@ -2224,7 +2224,7 @@ discard block |
||
| 2224 | 2224 | /** @var Component[] $subComponents */ |
| 2225 | 2225 | $subComponents = $comp->getComponents(); |
| 2226 | 2226 | /** @var Property[] $properties */ |
| 2227 | - $properties = array_filter($comp->children(), function ($c) { |
|
| 2227 | + $properties = array_filter($comp->children(), function($c) { |
|
| 2228 | 2228 | return $c instanceof Property; |
| 2229 | 2229 | }); |
| 2230 | 2230 | $validationRules = $comp->getValidationRules(); |
@@ -2292,7 +2292,7 @@ discard block |
||
| 2292 | 2292 | array $searchParameters, |
| 2293 | 2293 | array $options = [], |
| 2294 | 2294 | ): array { |
| 2295 | - return $this->atomic(function () use ($principalUri, $pattern, $componentTypes, $searchProperties, $searchParameters, $options) { |
|
| 2295 | + return $this->atomic(function() use ($principalUri, $pattern, $componentTypes, $searchProperties, $searchParameters, $options) { |
|
| 2296 | 2296 | $escapePattern = !\array_key_exists('escape_like_param', $options) || $options['escape_like_param'] !== false; |
| 2297 | 2297 | |
| 2298 | 2298 | $calendarObjectIdQuery = $this->db->getQueryBuilder(); |
@@ -2304,7 +2304,7 @@ discard block |
||
| 2304 | 2304 | $subscriptions = $this->getSubscriptionsForUser($principalUri); |
| 2305 | 2305 | foreach ($calendars as $calendar) { |
| 2306 | 2306 | $calendarAnd = $calendarObjectIdQuery->expr()->andX( |
| 2307 | - $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])), |
|
| 2307 | + $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id'])), |
|
| 2308 | 2308 | $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)), |
| 2309 | 2309 | ); |
| 2310 | 2310 | |
@@ -2318,7 +2318,7 @@ discard block |
||
| 2318 | 2318 | } |
| 2319 | 2319 | foreach ($subscriptions as $subscription) { |
| 2320 | 2320 | $subscriptionAnd = $calendarObjectIdQuery->expr()->andX( |
| 2321 | - $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])), |
|
| 2321 | + $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id'])), |
|
| 2322 | 2322 | $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)), |
| 2323 | 2323 | ); |
| 2324 | 2324 | |
@@ -2367,7 +2367,7 @@ discard block |
||
| 2367 | 2367 | if (!$escapePattern) { |
| 2368 | 2368 | $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern))); |
| 2369 | 2369 | } else { |
| 2370 | - $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 2370 | + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
| 2371 | 2371 | } |
| 2372 | 2372 | } |
| 2373 | 2373 | |
@@ -2395,7 +2395,7 @@ discard block |
||
| 2395 | 2395 | $result = $calendarObjectIdQuery->executeQuery(); |
| 2396 | 2396 | $matches = []; |
| 2397 | 2397 | while (($row = $result->fetchAssociative()) !== false) { |
| 2398 | - $matches[] = (int)$row['objectid']; |
|
| 2398 | + $matches[] = (int) $row['objectid']; |
|
| 2399 | 2399 | } |
| 2400 | 2400 | $result->closeCursor(); |
| 2401 | 2401 | |
@@ -2407,8 +2407,8 @@ discard block |
||
| 2407 | 2407 | $result = $query->executeQuery(); |
| 2408 | 2408 | $calendarObjects = []; |
| 2409 | 2409 | while (($array = $result->fetchAssociative()) !== false) { |
| 2410 | - $array['calendarid'] = (int)$array['calendarid']; |
|
| 2411 | - $array['calendartype'] = (int)$array['calendartype']; |
|
| 2410 | + $array['calendarid'] = (int) $array['calendarid']; |
|
| 2411 | + $array['calendartype'] = (int) $array['calendartype']; |
|
| 2412 | 2412 | $array['calendardata'] = $this->readBlob($array['calendardata']); |
| 2413 | 2413 | |
| 2414 | 2414 | $calendarObjects[] = $array; |
@@ -2454,7 +2454,7 @@ discard block |
||
| 2454 | 2454 | $row = $stmt->fetchAssociative(); |
| 2455 | 2455 | $stmt->closeCursor(); |
| 2456 | 2456 | if ($row) { |
| 2457 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
| 2457 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
| 2458 | 2458 | } |
| 2459 | 2459 | |
| 2460 | 2460 | return null; |
@@ -2480,14 +2480,14 @@ discard block |
||
| 2480 | 2480 | 'id' => $row['id'], |
| 2481 | 2481 | 'uri' => $row['uri'], |
| 2482 | 2482 | 'lastmodified' => $row['lastmodified'], |
| 2483 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2483 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2484 | 2484 | 'calendarid' => $row['calendarid'], |
| 2485 | 2485 | 'calendaruri' => $row['calendaruri'], |
| 2486 | - 'size' => (int)$row['size'], |
|
| 2486 | + 'size' => (int) $row['size'], |
|
| 2487 | 2487 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 2488 | 2488 | 'component' => strtolower($row['componenttype']), |
| 2489 | - 'classification' => (int)$row['classification'], |
|
| 2490 | - 'deleted_at' => isset($row['deleted_at']) ? ((int)$row['deleted_at']) : null, |
|
| 2489 | + 'classification' => (int) $row['classification'], |
|
| 2490 | + 'deleted_at' => isset($row['deleted_at']) ? ((int) $row['deleted_at']) : null, |
|
| 2491 | 2491 | ]; |
| 2492 | 2492 | } |
| 2493 | 2493 | |
@@ -2549,9 +2549,9 @@ discard block |
||
| 2549 | 2549 | * @return ?array |
| 2550 | 2550 | */ |
| 2551 | 2551 | public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
| 2552 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
| 2552 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
| 2553 | 2553 | |
| 2554 | - return $this->atomic(function () use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType, $table) { |
|
| 2554 | + return $this->atomic(function() use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType, $table) { |
|
| 2555 | 2555 | // Current synctoken |
| 2556 | 2556 | $qb = $this->db->getQueryBuilder(); |
| 2557 | 2557 | $qb->select('synctoken') |
@@ -2602,7 +2602,7 @@ discard block |
||
| 2602 | 2602 | while ($entry = $stmt->fetchNumeric()) { |
| 2603 | 2603 | // assign uri (column 0) to appropriate mutation based on operation (column 1) |
| 2604 | 2604 | // forced (int) is needed as doctrine with OCI returns the operation field as string not integer |
| 2605 | - match ((int)$entry[1]) { |
|
| 2605 | + match ((int) $entry[1]) { |
|
| 2606 | 2606 | 1 => $result['added'][] = $entry[0], |
| 2607 | 2607 | 2 => $result['modified'][] = $entry[0], |
| 2608 | 2608 | 3 => $result['deleted'][] = $entry[0], |
@@ -2673,7 +2673,7 @@ discard block |
||
| 2673 | 2673 | 'source' => $row['source'], |
| 2674 | 2674 | 'lastmodified' => $row['lastmodified'], |
| 2675 | 2675 | |
| 2676 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 2676 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 2677 | 2677 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 2678 | 2678 | ]; |
| 2679 | 2679 | |
@@ -2717,7 +2717,7 @@ discard block |
||
| 2717 | 2717 | } |
| 2718 | 2718 | } |
| 2719 | 2719 | |
| 2720 | - [$subscriptionId, $subscriptionRow] = $this->atomic(function () use ($values) { |
|
| 2720 | + [$subscriptionId, $subscriptionRow] = $this->atomic(function() use ($values) { |
|
| 2721 | 2721 | $valuesToInsert = []; |
| 2722 | 2722 | $query = $this->db->getQueryBuilder(); |
| 2723 | 2723 | foreach (array_keys($values) as $name) { |
@@ -2758,7 +2758,7 @@ discard block |
||
| 2758 | 2758 | $supportedProperties = array_keys($this->subscriptionPropertyMap); |
| 2759 | 2759 | $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
| 2760 | 2760 | |
| 2761 | - $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { |
|
| 2761 | + $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) { |
|
| 2762 | 2762 | $newValues = []; |
| 2763 | 2763 | |
| 2764 | 2764 | foreach ($mutations as $propertyName => $propertyValue) { |
@@ -2770,7 +2770,7 @@ discard block |
||
| 2770 | 2770 | } |
| 2771 | 2771 | } |
| 2772 | 2772 | |
| 2773 | - $subscriptionRow = $this->atomic(function () use ($subscriptionId, $newValues) { |
|
| 2773 | + $subscriptionRow = $this->atomic(function() use ($subscriptionId, $newValues) { |
|
| 2774 | 2774 | $query = $this->db->getQueryBuilder(); |
| 2775 | 2775 | $query->update('calendarsubscriptions') |
| 2776 | 2776 | ->set('lastmodified', $query->createNamedParameter(time())); |
@@ -2783,7 +2783,7 @@ discard block |
||
| 2783 | 2783 | return $this->getSubscriptionById($subscriptionId); |
| 2784 | 2784 | }, $this->db); |
| 2785 | 2785 | |
| 2786 | - $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); |
|
| 2786 | + $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations)); |
|
| 2787 | 2787 | |
| 2788 | 2788 | return true; |
| 2789 | 2789 | }); |
@@ -2796,7 +2796,7 @@ discard block |
||
| 2796 | 2796 | * @return void |
| 2797 | 2797 | */ |
| 2798 | 2798 | public function deleteSubscription($subscriptionId) { |
| 2799 | - $this->atomic(function () use ($subscriptionId): void { |
|
| 2799 | + $this->atomic(function() use ($subscriptionId): void { |
|
| 2800 | 2800 | $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
| 2801 | 2801 | |
| 2802 | 2802 | $query = $this->db->getQueryBuilder(); |
@@ -2821,7 +2821,7 @@ discard block |
||
| 2821 | 2821 | ->executeStatement(); |
| 2822 | 2822 | |
| 2823 | 2823 | if ($subscriptionRow) { |
| 2824 | - $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); |
|
| 2824 | + $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, [])); |
|
| 2825 | 2825 | } |
| 2826 | 2826 | }, $this->db); |
| 2827 | 2827 | } |
@@ -2860,8 +2860,8 @@ discard block |
||
| 2860 | 2860 | 'uri' => $row['uri'], |
| 2861 | 2861 | 'calendardata' => $row['calendardata'], |
| 2862 | 2862 | 'lastmodified' => $row['lastmodified'], |
| 2863 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2864 | - 'size' => (int)$row['size'], |
|
| 2863 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2864 | + 'size' => (int) $row['size'], |
|
| 2865 | 2865 | ]; |
| 2866 | 2866 | } |
| 2867 | 2867 | |
@@ -2889,8 +2889,8 @@ discard block |
||
| 2889 | 2889 | 'calendardata' => $row['calendardata'], |
| 2890 | 2890 | 'uri' => $row['uri'], |
| 2891 | 2891 | 'lastmodified' => $row['lastmodified'], |
| 2892 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2893 | - 'size' => (int)$row['size'], |
|
| 2892 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2893 | + 'size' => (int) $row['size'], |
|
| 2894 | 2894 | ]; |
| 2895 | 2895 | } |
| 2896 | 2896 | $stmt->closeCursor(); |
@@ -2932,8 +2932,8 @@ discard block |
||
| 2932 | 2932 | if ($count === 0) { |
| 2933 | 2933 | return; |
| 2934 | 2934 | } |
| 2935 | - $ids = array_map(static function (array $id) { |
|
| 2936 | - return (int)$id[0]; |
|
| 2935 | + $ids = array_map(static function(array $id) { |
|
| 2936 | + return (int) $id[0]; |
|
| 2937 | 2937 | }, $result->fetchAllNumeric()); |
| 2938 | 2938 | $result->closeCursor(); |
| 2939 | 2939 | |
@@ -2986,15 +2986,15 @@ discard block |
||
| 2986 | 2986 | */ |
| 2987 | 2987 | protected function addChanges(int $calendarId, array $objectUris, int $operation, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void { |
| 2988 | 2988 | $this->cachedObjects = []; |
| 2989 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
| 2989 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
| 2990 | 2990 | |
| 2991 | - $this->atomic(function () use ($calendarId, $objectUris, $operation, $calendarType, $table): void { |
|
| 2991 | + $this->atomic(function() use ($calendarId, $objectUris, $operation, $calendarType, $table): void { |
|
| 2992 | 2992 | $query = $this->db->getQueryBuilder(); |
| 2993 | 2993 | $query->select('synctoken') |
| 2994 | 2994 | ->from($table) |
| 2995 | 2995 | ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
| 2996 | 2996 | $result = $query->executeQuery(); |
| 2997 | - $syncToken = (int)$result->fetchOne(); |
|
| 2997 | + $syncToken = (int) $result->fetchOne(); |
|
| 2998 | 2998 | $result->closeCursor(); |
| 2999 | 2999 | |
| 3000 | 3000 | $query = $this->db->getQueryBuilder(); |
@@ -3023,7 +3023,7 @@ discard block |
||
| 3023 | 3023 | public function restoreChanges(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void { |
| 3024 | 3024 | $this->cachedObjects = []; |
| 3025 | 3025 | |
| 3026 | - $this->atomic(function () use ($calendarId, $calendarType): void { |
|
| 3026 | + $this->atomic(function() use ($calendarId, $calendarType): void { |
|
| 3027 | 3027 | $qbAdded = $this->db->getQueryBuilder(); |
| 3028 | 3028 | $qbAdded->select('uri') |
| 3029 | 3029 | ->from('calendarobjects') |
@@ -3053,7 +3053,7 @@ discard block |
||
| 3053 | 3053 | ) |
| 3054 | 3054 | ); |
| 3055 | 3055 | $resultDeleted = $qbDeleted->executeQuery(); |
| 3056 | - $deletedUris = array_map(function (string $uri) { |
|
| 3056 | + $deletedUris = array_map(function(string $uri) { |
|
| 3057 | 3057 | return str_replace('-deleted.ics', '.ics', $uri); |
| 3058 | 3058 | }, $resultDeleted->fetchFirstColumn()); |
| 3059 | 3059 | $resultDeleted->closeCursor(); |
@@ -3098,7 +3098,7 @@ discard block |
||
| 3098 | 3098 | // Track first component type and uid |
| 3099 | 3099 | if ($uid === null) { |
| 3100 | 3100 | $componentType = $component->name; |
| 3101 | - $uid = (string)$component->UID; |
|
| 3101 | + $uid = (string) $component->UID; |
|
| 3102 | 3102 | } |
| 3103 | 3103 | } |
| 3104 | 3104 | } |
@@ -3189,11 +3189,11 @@ discard block |
||
| 3189 | 3189 | * @param list<string> $remove |
| 3190 | 3190 | */ |
| 3191 | 3191 | public function updateShares(IShareable $shareable, array $add, array $remove): void { |
| 3192 | - $this->atomic(function () use ($shareable, $add, $remove): void { |
|
| 3192 | + $this->atomic(function() use ($shareable, $add, $remove): void { |
|
| 3193 | 3193 | $calendarId = $shareable->getResourceId(); |
| 3194 | 3194 | $calendarRow = $this->getCalendarById($calendarId); |
| 3195 | 3195 | if ($calendarRow === null) { |
| 3196 | - throw new \RuntimeException('Trying to update shares for non-existing calendar: ' . $calendarId); |
|
| 3196 | + throw new \RuntimeException('Trying to update shares for non-existing calendar: '.$calendarId); |
|
| 3197 | 3197 | } |
| 3198 | 3198 | $oldShares = $this->getShares($calendarId); |
| 3199 | 3199 | |
@@ -3224,7 +3224,7 @@ discard block |
||
| 3224 | 3224 | * @return string|null |
| 3225 | 3225 | */ |
| 3226 | 3226 | public function setPublishStatus($value, $calendar) { |
| 3227 | - $publishStatus = $this->atomic(function () use ($value, $calendar) { |
|
| 3227 | + $publishStatus = $this->atomic(function() use ($value, $calendar) { |
|
| 3228 | 3228 | $calendarId = $calendar->getResourceId(); |
| 3229 | 3229 | $calendarData = $this->getCalendarById($calendarId); |
| 3230 | 3230 | |
@@ -3253,7 +3253,7 @@ discard block |
||
| 3253 | 3253 | return null; |
| 3254 | 3254 | }, $this->db); |
| 3255 | 3255 | |
| 3256 | - $this->publishStatusCache->set((string)$calendar->getResourceId(), $publishStatus ?? false); |
|
| 3256 | + $this->publishStatusCache->set((string) $calendar->getResourceId(), $publishStatus ?? false); |
|
| 3257 | 3257 | return $publishStatus; |
| 3258 | 3258 | } |
| 3259 | 3259 | |
@@ -3262,7 +3262,7 @@ discard block |
||
| 3262 | 3262 | * @return string|false |
| 3263 | 3263 | */ |
| 3264 | 3264 | public function getPublishStatus($calendar) { |
| 3265 | - $cached = $this->publishStatusCache->get((string)$calendar->getResourceId()); |
|
| 3265 | + $cached = $this->publishStatusCache->get((string) $calendar->getResourceId()); |
|
| 3266 | 3266 | if ($cached !== null) { |
| 3267 | 3267 | return $cached; |
| 3268 | 3268 | } |
@@ -3277,7 +3277,7 @@ discard block |
||
| 3277 | 3277 | $publishStatus = $result->fetchOne(); |
| 3278 | 3278 | $result->closeCursor(); |
| 3279 | 3279 | |
| 3280 | - $this->publishStatusCache->set((string)$calendar->getResourceId(), $publishStatus); |
|
| 3280 | + $this->publishStatusCache->set((string) $calendar->getResourceId(), $publishStatus); |
|
| 3281 | 3281 | return $publishStatus; |
| 3282 | 3282 | } |
| 3283 | 3283 | |
@@ -3302,14 +3302,14 @@ discard block |
||
| 3302 | 3302 | |
| 3303 | 3303 | $hasPublishStatuses = []; |
| 3304 | 3304 | while ($row = $result->fetchAssociative()) { |
| 3305 | - $this->publishStatusCache->set((string)$row['resourceid'], $row['publicuri']); |
|
| 3306 | - $hasPublishStatuses[(int)$row['resourceid']] = true; |
|
| 3305 | + $this->publishStatusCache->set((string) $row['resourceid'], $row['publicuri']); |
|
| 3306 | + $hasPublishStatuses[(int) $row['resourceid']] = true; |
|
| 3307 | 3307 | } |
| 3308 | 3308 | |
| 3309 | 3309 | // Also remember resources with no publish status |
| 3310 | 3310 | foreach ($resourceIds as $resourceId) { |
| 3311 | 3311 | if (!isset($hasPublishStatuses[$resourceId])) { |
| 3312 | - $this->publishStatusCache->set((string)$resourceId, false); |
|
| 3312 | + $this->publishStatusCache->set((string) $resourceId, false); |
|
| 3313 | 3313 | } |
| 3314 | 3314 | } |
| 3315 | 3315 | |
@@ -3336,7 +3336,7 @@ discard block |
||
| 3336 | 3336 | */ |
| 3337 | 3337 | public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
| 3338 | 3338 | $this->cachedObjects = []; |
| 3339 | - $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $calendarType): void { |
|
| 3339 | + $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $calendarType): void { |
|
| 3340 | 3340 | $objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType); |
| 3341 | 3341 | |
| 3342 | 3342 | try { |
@@ -3408,7 +3408,7 @@ discard block |
||
| 3408 | 3408 | * deletes all birthday calendars |
| 3409 | 3409 | */ |
| 3410 | 3410 | public function deleteAllBirthdayCalendars() { |
| 3411 | - $this->atomic(function (): void { |
|
| 3411 | + $this->atomic(function(): void { |
|
| 3412 | 3412 | $query = $this->db->getQueryBuilder(); |
| 3413 | 3413 | $result = $query->select(['id'])->from('calendars') |
| 3414 | 3414 | ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) |
@@ -3428,7 +3428,7 @@ discard block |
||
| 3428 | 3428 | * @param $subscriptionId |
| 3429 | 3429 | */ |
| 3430 | 3430 | public function purgeAllCachedEventsForSubscription($subscriptionId) { |
| 3431 | - $this->atomic(function () use ($subscriptionId): void { |
|
| 3431 | + $this->atomic(function() use ($subscriptionId): void { |
|
| 3432 | 3432 | $query = $this->db->getQueryBuilder(); |
| 3433 | 3433 | $query->select('uri') |
| 3434 | 3434 | ->from('calendarobjects') |
@@ -3474,7 +3474,7 @@ discard block |
||
| 3474 | 3474 | return; |
| 3475 | 3475 | } |
| 3476 | 3476 | |
| 3477 | - $this->atomic(function () use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void { |
|
| 3477 | + $this->atomic(function() use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void { |
|
| 3478 | 3478 | foreach (array_chunk($calendarObjectIds, 1000) as $chunk) { |
| 3479 | 3479 | $query = $this->db->getQueryBuilder(); |
| 3480 | 3480 | $query->delete($this->dbObjectPropertiesTable) |
@@ -3567,10 +3567,10 @@ discard block |
||
| 3567 | 3567 | $result->closeCursor(); |
| 3568 | 3568 | |
| 3569 | 3569 | if (!isset($objectIds['id'])) { |
| 3570 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
| 3570 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
| 3571 | 3571 | } |
| 3572 | 3572 | |
| 3573 | - return (int)$objectIds['id']; |
|
| 3573 | + return (int) $objectIds['id']; |
|
| 3574 | 3574 | } |
| 3575 | 3575 | |
| 3576 | 3576 | /** |
@@ -3586,7 +3586,7 @@ discard block |
||
| 3586 | 3586 | ->from('calendarchanges'); |
| 3587 | 3587 | |
| 3588 | 3588 | $result = $query->executeQuery(); |
| 3589 | - $maxId = (int)$result->fetchOne(); |
|
| 3589 | + $maxId = (int) $result->fetchOne(); |
|
| 3590 | 3590 | $result->closeCursor(); |
| 3591 | 3591 | if (!$maxId || $maxId < $keep) { |
| 3592 | 3592 | return 0; |
@@ -3624,8 +3624,8 @@ discard block |
||
| 3624 | 3624 | * |
| 3625 | 3625 | */ |
| 3626 | 3626 | private function addOwnerPrincipalToCalendar(array $calendarInfo): array { |
| 3627 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 3628 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 3627 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
| 3628 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
| 3629 | 3629 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
| 3630 | 3630 | $uri = $calendarInfo[$ownerPrincipalKey]; |
| 3631 | 3631 | } else { |
@@ -3736,10 +3736,10 @@ discard block |
||
| 3736 | 3736 | } |
| 3737 | 3737 | |
| 3738 | 3738 | public function unshare(IShareable $shareable, string $principal): void { |
| 3739 | - $this->atomic(function () use ($shareable, $principal): void { |
|
| 3739 | + $this->atomic(function() use ($shareable, $principal): void { |
|
| 3740 | 3740 | $calendarData = $this->getCalendarById($shareable->getResourceId()); |
| 3741 | 3741 | if ($calendarData === null) { |
| 3742 | - throw new \RuntimeException('Trying to update shares for non-existing calendar: ' . $shareable->getResourceId()); |
|
| 3742 | + throw new \RuntimeException('Trying to update shares for non-existing calendar: '.$shareable->getResourceId()); |
|
| 3743 | 3743 | } |
| 3744 | 3744 | |
| 3745 | 3745 | $oldShares = $this->getShares($shareable->getResourceId()); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $stripAttachments = ($subscription[self::STRIP_ATTACHMENTS] ?? 1) === 1; |
| 67 | 67 | |
| 68 | 68 | try { |
| 69 | - $existingObjects = $this->calDavBackend->getLimitedCalendarObjects((int)$subscription['id'], CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION, ['id', 'uid', 'etag', 'uri']); |
|
| 69 | + $existingObjects = $this->calDavBackend->getLimitedCalendarObjects((int) $subscription['id'], CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION, ['id', 'uid', 'etag', 'uri']); |
|
| 70 | 70 | |
| 71 | 71 | $generator = match ($format) { |
| 72 | 72 | 'xcal' => $this->importService->importXml(...), |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | try { |
| 119 | 119 | $this->calDavBackend->createCalendarObject( |
| 120 | 120 | $subscription['id'], |
| 121 | - UUIDUtil::getUUID() . '.ics', |
|
| 121 | + UUIDUtil::getUUID().'.ics', |
|
| 122 | 122 | $sObject, |
| 123 | 123 | CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION |
| 124 | 124 | ); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | if (!empty($existingObjects)) { |
| 150 | 150 | $ids = array_map('intval', array_column($existingObjects, 'id')); |
| 151 | 151 | $uris = array_column($existingObjects, 'uri'); |
| 152 | - $this->calDavBackend->purgeCachedEventsForSubscription((int)$subscription['id'], $ids, $uris); |
|
| 152 | + $this->calDavBackend->purgeCachedEventsForSubscription((int) $subscription['id'], $ids, $uris); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // Update refresh rate from the last processed object |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | public function getSubscription(string $principalUri, string $uri): ?array { |
| 173 | 173 | $subscriptions = array_values(array_filter( |
| 174 | 174 | $this->calDavBackend->getSubscriptionsForUser($principalUri), |
| 175 | - function ($sub) use ($uri) { |
|
| 175 | + function($sub) use ($uri) { |
|
| 176 | 176 | return $sub['uri'] === $uri; |
| 177 | 177 | } |
| 178 | 178 | )); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | // Create a VCalendar object that will be yielded by the import service |
| 100 | 100 | $vCalendar = VObject\Reader::read($result); |
| 101 | 101 | |
| 102 | - $generator = function () use ($vCalendar) { |
|
| 102 | + $generator = function() use ($vCalendar) { |
|
| 103 | 103 | yield $vCalendar; |
| 104 | 104 | }; |
| 105 | 105 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | // Create a VCalendar object that will be yielded by the import service |
| 169 | 169 | $vCalendar = VObject\Reader::read($result); |
| 170 | 170 | |
| 171 | - $generator = function () use ($vCalendar) { |
|
| 171 | + $generator = function() use ($vCalendar) { |
|
| 172 | 172 | yield $vCalendar; |
| 173 | 173 | }; |
| 174 | 174 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | ]); |
| 284 | 284 | |
| 285 | 285 | $vCalendar = VObject\Reader::read($body); |
| 286 | - $generator = function () use ($vCalendar) { |
|
| 286 | + $generator = function() use ($vCalendar) { |
|
| 287 | 287 | yield $vCalendar; |
| 288 | 288 | }; |
| 289 | 289 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | ->willReturn([]); |
| 340 | 340 | |
| 341 | 341 | $vCalendar = VObject\Reader::read($body); |
| 342 | - $generator = function () use ($vCalendar) { |
|
| 342 | + $generator = function() use ($vCalendar) { |
|
| 343 | 343 | yield $vCalendar; |
| 344 | 344 | }; |
| 345 | 345 | |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | // Create a VCalendar object that will be yielded by the import service |
| 388 | 388 | $vCalendar = VObject\Reader::read($result); |
| 389 | 389 | |
| 390 | - $generator = function () use ($vCalendar) { |
|
| 390 | + $generator = function() use ($vCalendar) { |
|
| 391 | 391 | yield $vCalendar; |
| 392 | 392 | }; |
| 393 | 393 | |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | // Create a VCalendar object that will be yielded by the import service |
| 441 | 441 | $vCalendar = VObject\Reader::read($result); |
| 442 | 442 | |
| 443 | - $generator = function () use ($vCalendar) { |
|
| 443 | + $generator = function() use ($vCalendar) { |
|
| 444 | 444 | yield $vCalendar; |
| 445 | 445 | }; |
| 446 | 446 | |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | public static function identicalDataProvider(): array { |
| 464 | - $icalBody = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject " . VObject\Version::VERSION . "//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000101\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:12345's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; |
|
| 464 | + $icalBody = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject ".VObject\Version::VERSION."//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000101\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:12345's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; |
|
| 465 | 465 | $etag = md5($icalBody); |
| 466 | 466 | |
| 467 | 467 | return [ |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | [ |
| 487 | 487 | "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000101\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:12345's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", |
| 488 | 488 | 'ical', |
| 489 | - "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject " . VObject\Version::VERSION . "//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000101\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:12345's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", |
|
| 489 | + "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject ".VObject\Version::VERSION."//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000101\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:12345's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", |
|
| 490 | 490 | ], |
| 491 | 491 | ]; |
| 492 | 492 | } |