@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => ['timezone', 'string'], |
| 130 | 130 | '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], |
| 131 | 131 | '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], |
| 132 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int'], |
|
| 132 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => ['deleted_at', 'int'], |
|
| 133 | 133 | ]; |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | $result = $query->executeQuery(); |
| 225 | - $column = (int)$result->fetchOne(); |
|
| 225 | + $column = (int) $result->fetchOne(); |
|
| 226 | 226 | $result->closeCursor(); |
| 227 | 227 | return $column; |
| 228 | 228 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | $result = $query->executeQuery(); |
| 246 | - $column = (int)$result->fetchOne(); |
|
| 246 | + $column = (int) $result->fetchOne(); |
|
| 247 | 247 | $result->closeCursor(); |
| 248 | 248 | return $column; |
| 249 | 249 | } |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | $calendars = []; |
| 262 | 262 | while (($row = $result->fetch()) !== false) { |
| 263 | 263 | $calendars[] = [ |
| 264 | - 'id' => (int)$row['id'], |
|
| 265 | - 'deleted_at' => (int)$row['deleted_at'], |
|
| 264 | + 'id' => (int) $row['id'], |
|
| 265 | + 'deleted_at' => (int) $row['deleted_at'], |
|
| 266 | 266 | ]; |
| 267 | 267 | } |
| 268 | 268 | $result->closeCursor(); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * @return array |
| 296 | 296 | */ |
| 297 | 297 | public function getCalendarsForUser($principalUri) { |
| 298 | - return $this->atomic(function () use ($principalUri) { |
|
| 298 | + return $this->atomic(function() use ($principalUri) { |
|
| 299 | 299 | $principalUriOriginal = $principalUri; |
| 300 | 300 | $principalUri = $this->convertPrincipal($principalUri, true); |
| 301 | 301 | $fields = array_column($this->propertyMap, 0); |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | $calendars = []; |
| 324 | 324 | while ($row = $result->fetch()) { |
| 325 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 325 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 326 | 326 | $components = []; |
| 327 | 327 | if ($row['components']) { |
| 328 | 328 | $components = explode(',', $row['components']); |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | 'id' => $row['id'], |
| 333 | 333 | 'uri' => $row['uri'], |
| 334 | 334 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 335 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 335 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 336 | 336 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 337 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 338 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 339 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 337 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 338 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 339 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 340 | 340 | ]; |
| 341 | 341 | |
| 342 | 342 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -355,8 +355,8 @@ discard block |
||
| 355 | 355 | $principals[] = $principalUri; |
| 356 | 356 | |
| 357 | 357 | $fields = array_column($this->propertyMap, 0); |
| 358 | - $fields = array_map(function (string $field) { |
|
| 359 | - return 'a.' . $field; |
|
| 358 | + $fields = array_map(function(string $field) { |
|
| 359 | + return 'a.'.$field; |
|
| 360 | 360 | }, $fields); |
| 361 | 361 | $fields[] = 'a.id'; |
| 362 | 362 | $fields[] = 'a.uri'; |
@@ -383,14 +383,14 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | $results = $select->executeQuery(); |
| 385 | 385 | |
| 386 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 386 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
| 387 | 387 | while ($row = $results->fetch()) { |
| 388 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 388 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 389 | 389 | if ($row['principaluri'] === $principalUri) { |
| 390 | 390 | continue; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - $readOnly = (int)$row['access'] === Backend::ACCESS_READ; |
|
| 393 | + $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
| 394 | 394 | if (isset($calendars[$row['id']])) { |
| 395 | 395 | if ($readOnly) { |
| 396 | 396 | // New share can not have more permissions than the old one. |
@@ -404,8 +404,8 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | [, $name] = Uri\split($row['principaluri']); |
| 407 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 408 | - $row['displayname'] = $row['displayname'] . ' (' . ($this->userManager->getDisplayName($name) ?? ($name ?? '')) . ')'; |
|
| 407 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
| 408 | + $row['displayname'] = $row['displayname'].' ('.($this->userManager->getDisplayName($name) ?? ($name ?? '')).')'; |
|
| 409 | 409 | $components = []; |
| 410 | 410 | if ($row['components']) { |
| 411 | 411 | $components = explode(',', $row['components']); |
@@ -414,11 +414,11 @@ discard block |
||
| 414 | 414 | 'id' => $row['id'], |
| 415 | 415 | 'uri' => $uri, |
| 416 | 416 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
| 417 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 417 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 418 | 418 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 419 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 420 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 421 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 419 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 420 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 421 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 422 | 422 | $readOnlyPropertyName => $readOnly, |
| 423 | 423 | ]; |
| 424 | 424 | |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | $stmt = $query->executeQuery(); |
| 456 | 456 | $calendars = []; |
| 457 | 457 | while ($row = $stmt->fetch()) { |
| 458 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 458 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 459 | 459 | $components = []; |
| 460 | 460 | if ($row['components']) { |
| 461 | 461 | $components = explode(',', $row['components']); |
@@ -464,10 +464,10 @@ discard block |
||
| 464 | 464 | 'id' => $row['id'], |
| 465 | 465 | 'uri' => $row['uri'], |
| 466 | 466 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 467 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 467 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 468 | 468 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 469 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 470 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 469 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 470 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 471 | 471 | ]; |
| 472 | 472 | |
| 473 | 473 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -505,9 +505,9 @@ discard block |
||
| 505 | 505 | ->executeQuery(); |
| 506 | 506 | |
| 507 | 507 | while ($row = $result->fetch()) { |
| 508 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 508 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 509 | 509 | [, $name] = Uri\split($row['principaluri']); |
| 510 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
| 510 | + $row['displayname'] = $row['displayname']."($name)"; |
|
| 511 | 511 | $components = []; |
| 512 | 512 | if ($row['components']) { |
| 513 | 513 | $components = explode(',', $row['components']); |
@@ -516,13 +516,13 @@ discard block |
||
| 516 | 516 | 'id' => $row['id'], |
| 517 | 517 | 'uri' => $row['publicuri'], |
| 518 | 518 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 519 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 519 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 520 | 520 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 521 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 522 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 523 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 524 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 525 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 521 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 522 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 523 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 524 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 525 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 526 | 526 | ]; |
| 527 | 527 | |
| 528 | 528 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -567,12 +567,12 @@ discard block |
||
| 567 | 567 | $result->closeCursor(); |
| 568 | 568 | |
| 569 | 569 | if ($row === false) { |
| 570 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
| 570 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 573 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 574 | 574 | [, $name] = Uri\split($row['principaluri']); |
| 575 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
| 575 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
| 576 | 576 | $components = []; |
| 577 | 577 | if ($row['components']) { |
| 578 | 578 | $components = explode(',', $row['components']); |
@@ -581,13 +581,13 @@ discard block |
||
| 581 | 581 | 'id' => $row['id'], |
| 582 | 582 | 'uri' => $row['publicuri'], |
| 583 | 583 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 584 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 584 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 585 | 585 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 586 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 587 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 588 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 589 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 590 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 586 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 587 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 588 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 589 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 590 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 591 | 591 | ]; |
| 592 | 592 | |
| 593 | 593 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | return null; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 628 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 629 | 629 | $components = []; |
| 630 | 630 | if ($row['components']) { |
| 631 | 631 | $components = explode(',', $row['components']); |
@@ -635,10 +635,10 @@ discard block |
||
| 635 | 635 | 'id' => $row['id'], |
| 636 | 636 | 'uri' => $row['uri'], |
| 637 | 637 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 638 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 638 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 639 | 639 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 640 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 641 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 640 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 641 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 642 | 642 | ]; |
| 643 | 643 | |
| 644 | 644 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | return null; |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 676 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 677 | 677 | $components = []; |
| 678 | 678 | if ($row['components']) { |
| 679 | 679 | $components = explode(',', $row['components']); |
@@ -683,10 +683,10 @@ discard block |
||
| 683 | 683 | 'id' => $row['id'], |
| 684 | 684 | 'uri' => $row['uri'], |
| 685 | 685 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 686 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
| 686 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
| 687 | 687 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?? 0, |
| 688 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 689 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 688 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 689 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 690 | 690 | ]; |
| 691 | 691 | |
| 692 | 692 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -721,14 +721,14 @@ discard block |
||
| 721 | 721 | return null; |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 724 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 725 | 725 | $subscription = [ |
| 726 | 726 | 'id' => $row['id'], |
| 727 | 727 | 'uri' => $row['uri'], |
| 728 | 728 | 'principaluri' => $row['principaluri'], |
| 729 | 729 | 'source' => $row['source'], |
| 730 | 730 | 'lastmodified' => $row['lastmodified'], |
| 731 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 731 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 732 | 732 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 733 | 733 | ]; |
| 734 | 734 | |
@@ -758,14 +758,14 @@ discard block |
||
| 758 | 758 | return null; |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | - $row['principaluri'] = (string)$row['principaluri']; |
|
| 761 | + $row['principaluri'] = (string) $row['principaluri']; |
|
| 762 | 762 | $subscription = [ |
| 763 | 763 | 'id' => $row['id'], |
| 764 | 764 | 'uri' => $row['uri'], |
| 765 | 765 | 'principaluri' => $row['principaluri'], |
| 766 | 766 | 'source' => $row['source'], |
| 767 | 767 | 'lastmodified' => $row['lastmodified'], |
| 768 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 768 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 769 | 769 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 770 | 770 | ]; |
| 771 | 771 | |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
| 804 | 804 | if (isset($properties[$sccs])) { |
| 805 | 805 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
| 806 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 806 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 807 | 807 | } |
| 808 | 808 | $values['components'] = implode(',', $properties[$sccs]->getValue()); |
| 809 | 809 | } elseif (isset($properties['components'])) { |
@@ -812,9 +812,9 @@ discard block |
||
| 812 | 812 | $values['components'] = $properties['components']; |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 815 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 816 | 816 | if (isset($properties[$transp])) { |
| 817 | - $values['transparent'] = (int)($properties[$transp]->getValue() === 'transparent'); |
|
| 817 | + $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
|
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | foreach ($this->propertyMap as $xmlName => [$dbName, $type]) { |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | } |
| 824 | 824 | } |
| 825 | 825 | |
| 826 | - [$calendarId, $calendarData] = $this->atomic(function () use ($values) { |
|
| 826 | + [$calendarId, $calendarData] = $this->atomic(function() use ($values) { |
|
| 827 | 827 | $query = $this->db->getQueryBuilder(); |
| 828 | 828 | $query->insert('calendars'); |
| 829 | 829 | foreach ($values as $column => $value) { |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | return [$calendarId, $calendarData]; |
| 837 | 837 | }, $this->db); |
| 838 | 838 | |
| 839 | - $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); |
|
| 839 | + $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData)); |
|
| 840 | 840 | |
| 841 | 841 | return $calendarId; |
| 842 | 842 | } |
@@ -859,15 +859,15 @@ discard block |
||
| 859 | 859 | */ |
| 860 | 860 | public function updateCalendar($calendarId, PropPatch $propPatch) { |
| 861 | 861 | $supportedProperties = array_keys($this->propertyMap); |
| 862 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 862 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 863 | 863 | |
| 864 | - $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { |
|
| 864 | + $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
|
| 865 | 865 | $newValues = []; |
| 866 | 866 | foreach ($mutations as $propertyName => $propertyValue) { |
| 867 | 867 | switch ($propertyName) { |
| 868 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': |
|
| 868 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp': |
|
| 869 | 869 | $fieldName = 'transparent'; |
| 870 | - $newValues[$fieldName] = (int)($propertyValue->getValue() === 'transparent'); |
|
| 870 | + $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
|
| 871 | 871 | break; |
| 872 | 872 | default: |
| 873 | 873 | $fieldName = $this->propertyMap[$propertyName][0]; |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | break; |
| 876 | 876 | } |
| 877 | 877 | } |
| 878 | - [$calendarData, $shares] = $this->atomic(function () use ($calendarId, $newValues) { |
|
| 878 | + [$calendarData, $shares] = $this->atomic(function() use ($calendarId, $newValues) { |
|
| 879 | 879 | $query = $this->db->getQueryBuilder(); |
| 880 | 880 | $query->update('calendars'); |
| 881 | 881 | foreach ($newValues as $fieldName => $value) { |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | * @return void |
| 905 | 905 | */ |
| 906 | 906 | public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) { |
| 907 | - $this->atomic(function () use ($calendarId, $forceDeletePermanently): void { |
|
| 907 | + $this->atomic(function() use ($calendarId, $forceDeletePermanently): void { |
|
| 908 | 908 | // The calendar is deleted right away if this is either enforced by the caller |
| 909 | 909 | // or the special contacts birthday calendar or when the preference of an empty |
| 910 | 910 | // retention (0 seconds) is set, which signals a disabled trashbin. |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | } |
| 968 | 968 | |
| 969 | 969 | public function restoreCalendar(int $id): void { |
| 970 | - $this->atomic(function () use ($id): void { |
|
| 970 | + $this->atomic(function() use ($id): void { |
|
| 971 | 971 | $qb = $this->db->getQueryBuilder(); |
| 972 | 972 | $update = $qb->update('calendars') |
| 973 | 973 | ->set('deleted_at', $qb->createNamedParameter(null)) |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | */ |
| 1004 | 1004 | public function getLimitedCalendarObjects(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
| 1005 | 1005 | $query = $this->db->getQueryBuilder(); |
| 1006 | - $query->select(['id','uid', 'etag', 'uri', 'calendardata']) |
|
| 1006 | + $query->select(['id', 'uid', 'etag', 'uri', 'calendardata']) |
|
| 1007 | 1007 | ->from('calendarobjects') |
| 1008 | 1008 | ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
| 1009 | 1009 | ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))) |
@@ -1081,11 +1081,11 @@ discard block |
||
| 1081 | 1081 | 'id' => $row['id'], |
| 1082 | 1082 | 'uri' => $row['uri'], |
| 1083 | 1083 | 'lastmodified' => $row['lastmodified'], |
| 1084 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1084 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1085 | 1085 | 'calendarid' => $row['calendarid'], |
| 1086 | - 'size' => (int)$row['size'], |
|
| 1086 | + 'size' => (int) $row['size'], |
|
| 1087 | 1087 | 'component' => strtolower($row['componenttype']), |
| 1088 | - 'classification' => (int)$row['classification'] |
|
| 1088 | + 'classification' => (int) $row['classification'] |
|
| 1089 | 1089 | ]; |
| 1090 | 1090 | } |
| 1091 | 1091 | $stmt->closeCursor(); |
@@ -1108,13 +1108,13 @@ discard block |
||
| 1108 | 1108 | 'id' => $row['id'], |
| 1109 | 1109 | 'uri' => $row['uri'], |
| 1110 | 1110 | 'lastmodified' => $row['lastmodified'], |
| 1111 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1112 | - 'calendarid' => (int)$row['calendarid'], |
|
| 1113 | - 'calendartype' => (int)$row['calendartype'], |
|
| 1114 | - 'size' => (int)$row['size'], |
|
| 1111 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1112 | + 'calendarid' => (int) $row['calendarid'], |
|
| 1113 | + 'calendartype' => (int) $row['calendartype'], |
|
| 1114 | + 'size' => (int) $row['size'], |
|
| 1115 | 1115 | 'component' => strtolower($row['componenttype']), |
| 1116 | - 'classification' => (int)$row['classification'], |
|
| 1117 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
| 1116 | + 'classification' => (int) $row['classification'], |
|
| 1117 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
| 1118 | 1118 | ]; |
| 1119 | 1119 | } |
| 1120 | 1120 | $stmt->closeCursor(); |
@@ -1147,13 +1147,13 @@ discard block |
||
| 1147 | 1147 | 'id' => $row['id'], |
| 1148 | 1148 | 'uri' => $row['uri'], |
| 1149 | 1149 | 'lastmodified' => $row['lastmodified'], |
| 1150 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1150 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1151 | 1151 | 'calendarid' => $row['calendarid'], |
| 1152 | 1152 | 'calendaruri' => $row['calendaruri'], |
| 1153 | - 'size' => (int)$row['size'], |
|
| 1153 | + 'size' => (int) $row['size'], |
|
| 1154 | 1154 | 'component' => strtolower($row['componenttype']), |
| 1155 | - 'classification' => (int)$row['classification'], |
|
| 1156 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
| 1155 | + 'classification' => (int) $row['classification'], |
|
| 1156 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
| 1157 | 1157 | ]; |
| 1158 | 1158 | } |
| 1159 | 1159 | $stmt->closeCursor(); |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | * @return array|null |
| 1180 | 1180 | */ |
| 1181 | 1181 | public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
| 1182 | - $key = $calendarId . '::' . $objectUri . '::' . $calendarType; |
|
| 1182 | + $key = $calendarId.'::'.$objectUri.'::'.$calendarType; |
|
| 1183 | 1183 | if (isset($this->cachedObjects[$key])) { |
| 1184 | 1184 | return $this->cachedObjects[$key]; |
| 1185 | 1185 | } |
@@ -1208,13 +1208,13 @@ discard block |
||
| 1208 | 1208 | 'uri' => $row['uri'], |
| 1209 | 1209 | 'uid' => $row['uid'], |
| 1210 | 1210 | 'lastmodified' => $row['lastmodified'], |
| 1211 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1211 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1212 | 1212 | 'calendarid' => $row['calendarid'], |
| 1213 | - 'size' => (int)$row['size'], |
|
| 1213 | + 'size' => (int) $row['size'], |
|
| 1214 | 1214 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 1215 | 1215 | 'component' => strtolower($row['componenttype']), |
| 1216 | - 'classification' => (int)$row['classification'], |
|
| 1217 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
| 1216 | + 'classification' => (int) $row['classification'], |
|
| 1217 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
| 1218 | 1218 | ]; |
| 1219 | 1219 | } |
| 1220 | 1220 | |
@@ -1256,12 +1256,12 @@ discard block |
||
| 1256 | 1256 | 'id' => $row['id'], |
| 1257 | 1257 | 'uri' => $row['uri'], |
| 1258 | 1258 | 'lastmodified' => $row['lastmodified'], |
| 1259 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1259 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1260 | 1260 | 'calendarid' => $row['calendarid'], |
| 1261 | - 'size' => (int)$row['size'], |
|
| 1261 | + 'size' => (int) $row['size'], |
|
| 1262 | 1262 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 1263 | 1263 | 'component' => strtolower($row['componenttype']), |
| 1264 | - 'classification' => (int)$row['classification'] |
|
| 1264 | + 'classification' => (int) $row['classification'] |
|
| 1265 | 1265 | ]; |
| 1266 | 1266 | } |
| 1267 | 1267 | $result->closeCursor(); |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | $this->cachedObjects = []; |
| 1294 | 1294 | $extraData = $this->getDenormalizedData($calendarData); |
| 1295 | 1295 | |
| 1296 | - return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
| 1296 | + return $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
| 1297 | 1297 | // Try to detect duplicates |
| 1298 | 1298 | $qb = $this->db->getQueryBuilder(); |
| 1299 | 1299 | $qb->select($qb->func()->count('*')) |
@@ -1303,7 +1303,7 @@ discard block |
||
| 1303 | 1303 | ->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))) |
| 1304 | 1304 | ->andWhere($qb->expr()->isNull('deleted_at')); |
| 1305 | 1305 | $result = $qb->executeQuery(); |
| 1306 | - $count = (int)$result->fetchOne(); |
|
| 1306 | + $count = (int) $result->fetchOne(); |
|
| 1307 | 1307 | $result->closeCursor(); |
| 1308 | 1308 | |
| 1309 | 1309 | if ($count !== 0) { |
@@ -1361,7 +1361,7 @@ discard block |
||
| 1361 | 1361 | $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent($calendarId, $subscriptionRow, [], $objectRow)); |
| 1362 | 1362 | } |
| 1363 | 1363 | |
| 1364 | - return '"' . $extraData['etag'] . '"'; |
|
| 1364 | + return '"'.$extraData['etag'].'"'; |
|
| 1365 | 1365 | }, $this->db); |
| 1366 | 1366 | } |
| 1367 | 1367 | |
@@ -1388,7 +1388,7 @@ discard block |
||
| 1388 | 1388 | $this->cachedObjects = []; |
| 1389 | 1389 | $extraData = $this->getDenormalizedData($calendarData); |
| 1390 | 1390 | |
| 1391 | - return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
| 1391 | + return $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
| 1392 | 1392 | $query = $this->db->getQueryBuilder(); |
| 1393 | 1393 | $query->update('calendarobjects') |
| 1394 | 1394 | ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) |
@@ -1422,7 +1422,7 @@ discard block |
||
| 1422 | 1422 | } |
| 1423 | 1423 | } |
| 1424 | 1424 | |
| 1425 | - return '"' . $extraData['etag'] . '"'; |
|
| 1425 | + return '"'.$extraData['etag'].'"'; |
|
| 1426 | 1426 | }, $this->db); |
| 1427 | 1427 | } |
| 1428 | 1428 | |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | */ |
| 1441 | 1441 | public function moveCalendarObject(string $sourcePrincipalUri, int $sourceObjectId, string $targetPrincipalUri, int $targetCalendarId, string $tragetObjectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR): bool { |
| 1442 | 1442 | $this->cachedObjects = []; |
| 1443 | - return $this->atomic(function () use ($sourcePrincipalUri, $sourceObjectId, $targetPrincipalUri, $targetCalendarId, $tragetObjectUri, $calendarType) { |
|
| 1443 | + return $this->atomic(function() use ($sourcePrincipalUri, $sourceObjectId, $targetPrincipalUri, $targetCalendarId, $tragetObjectUri, $calendarType) { |
|
| 1444 | 1444 | $object = $this->getCalendarObjectById($sourcePrincipalUri, $sourceObjectId); |
| 1445 | 1445 | if (empty($object)) { |
| 1446 | 1446 | return false; |
@@ -1516,7 +1516,7 @@ discard block |
||
| 1516 | 1516 | */ |
| 1517 | 1517 | public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) { |
| 1518 | 1518 | $this->cachedObjects = []; |
| 1519 | - $this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void { |
|
| 1519 | + $this->atomic(function() use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void { |
|
| 1520 | 1520 | $data = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
| 1521 | 1521 | |
| 1522 | 1522 | if ($data === null) { |
@@ -1600,8 +1600,8 @@ discard block |
||
| 1600 | 1600 | */ |
| 1601 | 1601 | public function restoreCalendarObject(array $objectData): void { |
| 1602 | 1602 | $this->cachedObjects = []; |
| 1603 | - $this->atomic(function () use ($objectData): void { |
|
| 1604 | - $id = (int)$objectData['id']; |
|
| 1603 | + $this->atomic(function() use ($objectData): void { |
|
| 1604 | + $id = (int) $objectData['id']; |
|
| 1605 | 1605 | $restoreUri = str_replace('-deleted.ics', '.ics', $objectData['uri']); |
| 1606 | 1606 | $targetObject = $this->getCalendarObject( |
| 1607 | 1607 | $objectData['calendarid'], |
@@ -1631,17 +1631,17 @@ discard block |
||
| 1631 | 1631 | // Welp, this should possibly not have happened, but let's ignore |
| 1632 | 1632 | return; |
| 1633 | 1633 | } |
| 1634 | - $this->addChanges($row['calendarid'], [$row['uri']], 1, (int)$row['calendartype']); |
|
| 1634 | + $this->addChanges($row['calendarid'], [$row['uri']], 1, (int) $row['calendartype']); |
|
| 1635 | 1635 | |
| 1636 | - $calendarRow = $this->getCalendarById((int)$row['calendarid']); |
|
| 1636 | + $calendarRow = $this->getCalendarById((int) $row['calendarid']); |
|
| 1637 | 1637 | if ($calendarRow === null) { |
| 1638 | 1638 | throw new RuntimeException('Calendar object data that was just written can\'t be read back. Check your database configuration.'); |
| 1639 | 1639 | } |
| 1640 | 1640 | $this->dispatcher->dispatchTyped( |
| 1641 | 1641 | new CalendarObjectRestoredEvent( |
| 1642 | - (int)$objectData['calendarid'], |
|
| 1642 | + (int) $objectData['calendarid'], |
|
| 1643 | 1643 | $calendarRow, |
| 1644 | - $this->getShares((int)$row['calendarid']), |
|
| 1644 | + $this->getShares((int) $row['calendarid']), |
|
| 1645 | 1645 | $row |
| 1646 | 1646 | ) |
| 1647 | 1647 | ); |
@@ -1760,19 +1760,19 @@ discard block |
||
| 1760 | 1760 | try { |
| 1761 | 1761 | $matches = $this->validateFilterForObject($row, $filters); |
| 1762 | 1762 | } catch (ParseException $ex) { |
| 1763 | - $this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [ |
|
| 1763 | + $this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [ |
|
| 1764 | 1764 | 'app' => 'dav', |
| 1765 | 1765 | 'exception' => $ex, |
| 1766 | 1766 | ]); |
| 1767 | 1767 | continue; |
| 1768 | 1768 | } catch (InvalidDataException $ex) { |
| 1769 | - $this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [ |
|
| 1769 | + $this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [ |
|
| 1770 | 1770 | 'app' => 'dav', |
| 1771 | 1771 | 'exception' => $ex, |
| 1772 | 1772 | ]); |
| 1773 | 1773 | continue; |
| 1774 | 1774 | } catch (MaxInstancesExceededException $ex) { |
| 1775 | - $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'], [ |
|
| 1775 | + $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'], [ |
|
| 1776 | 1776 | 'app' => 'dav', |
| 1777 | 1777 | 'exception' => $ex, |
| 1778 | 1778 | ]); |
@@ -1784,7 +1784,7 @@ discard block |
||
| 1784 | 1784 | } |
| 1785 | 1785 | } |
| 1786 | 1786 | $result[] = $row['uri']; |
| 1787 | - $key = $calendarId . '::' . $row['uri'] . '::' . $calendarType; |
|
| 1787 | + $key = $calendarId.'::'.$row['uri'].'::'.$calendarType; |
|
| 1788 | 1788 | $this->cachedObjects[$key] = $this->rowToCalendarObject($row); |
| 1789 | 1789 | } |
| 1790 | 1790 | |
@@ -1803,7 +1803,7 @@ discard block |
||
| 1803 | 1803 | * @return array |
| 1804 | 1804 | */ |
| 1805 | 1805 | public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
| 1806 | - return $this->atomic(function () use ($principalUri, $filters, $limit, $offset) { |
|
| 1806 | + return $this->atomic(function() use ($principalUri, $filters, $limit, $offset) { |
|
| 1807 | 1807 | $calendars = $this->getCalendarsForUser($principalUri); |
| 1808 | 1808 | $ownCalendars = []; |
| 1809 | 1809 | $sharedCalendars = []; |
@@ -1895,7 +1895,7 @@ discard block |
||
| 1895 | 1895 | ->andWhere($compExpr) |
| 1896 | 1896 | ->andWhere($propParamExpr) |
| 1897 | 1897 | ->andWhere($query->expr()->iLike('i.value', |
| 1898 | - $query->createNamedParameter('%' . $this->db->escapeLikeParameter($filters['search-term']) . '%'))) |
|
| 1898 | + $query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%'))) |
|
| 1899 | 1899 | ->andWhere($query->expr()->isNull('deleted_at')); |
| 1900 | 1900 | |
| 1901 | 1901 | if ($offset) { |
@@ -1909,7 +1909,7 @@ discard block |
||
| 1909 | 1909 | |
| 1910 | 1910 | $result = []; |
| 1911 | 1911 | while ($row = $stmt->fetch()) { |
| 1912 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
| 1912 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
| 1913 | 1913 | if (!in_array($path, $result)) { |
| 1914 | 1914 | $result[] = $path; |
| 1915 | 1915 | } |
@@ -1976,8 +1976,8 @@ discard block |
||
| 1976 | 1976 | |
| 1977 | 1977 | if ($pattern !== '') { |
| 1978 | 1978 | $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
| 1979 | - $outerQuery->createNamedParameter('%' . |
|
| 1980 | - $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1979 | + $outerQuery->createNamedParameter('%'. |
|
| 1980 | + $this->db->escapeLikeParameter($pattern).'%'))); |
|
| 1981 | 1981 | } |
| 1982 | 1982 | |
| 1983 | 1983 | $start = null; |
@@ -2029,7 +2029,7 @@ discard block |
||
| 2029 | 2029 | // For the pagination with hasLimit and hasTimeRange, a stable ordering is helpful. |
| 2030 | 2030 | $outerQuery->addOrderBy('id'); |
| 2031 | 2031 | |
| 2032 | - $offset = (int)$offset; |
|
| 2032 | + $offset = (int) $offset; |
|
| 2033 | 2033 | $outerQuery->setFirstResult($offset); |
| 2034 | 2034 | |
| 2035 | 2035 | $calendarObjects = []; |
@@ -2050,7 +2050,7 @@ discard block |
||
| 2050 | 2050 | * |
| 2051 | 2051 | * 25 rows and 3 retries is entirely arbitrary. |
| 2052 | 2052 | */ |
| 2053 | - $maxResults = (int)max($limit, 25); |
|
| 2053 | + $maxResults = (int) max($limit, 25); |
|
| 2054 | 2054 | $outerQuery->setMaxResults($maxResults); |
| 2055 | 2055 | |
| 2056 | 2056 | for ($attempt = $objectsCount = 0; $attempt < 3 && $objectsCount < $limit; $attempt++) { |
@@ -2064,7 +2064,7 @@ discard block |
||
| 2064 | 2064 | $calendarObjects = $this->searchCalendarObjects($outerQuery, $start, $end); |
| 2065 | 2065 | } |
| 2066 | 2066 | |
| 2067 | - $calendarObjects = array_map(function ($o) use ($options) { |
|
| 2067 | + $calendarObjects = array_map(function($o) use ($options) { |
|
| 2068 | 2068 | $calendarData = Reader::read($o['calendardata']); |
| 2069 | 2069 | |
| 2070 | 2070 | // Expand recurrences if an explicit time range is requested |
@@ -2092,16 +2092,16 @@ discard block |
||
| 2092 | 2092 | 'type' => $o['componenttype'], |
| 2093 | 2093 | 'uid' => $o['uid'], |
| 2094 | 2094 | 'uri' => $o['uri'], |
| 2095 | - 'objects' => array_map(function ($c) { |
|
| 2095 | + 'objects' => array_map(function($c) { |
|
| 2096 | 2096 | return $this->transformSearchData($c); |
| 2097 | 2097 | }, $objects), |
| 2098 | - 'timezones' => array_map(function ($c) { |
|
| 2098 | + 'timezones' => array_map(function($c) { |
|
| 2099 | 2099 | return $this->transformSearchData($c); |
| 2100 | 2100 | }, $timezones), |
| 2101 | 2101 | ]; |
| 2102 | 2102 | }, $calendarObjects); |
| 2103 | 2103 | |
| 2104 | - usort($calendarObjects, function (array $a, array $b) { |
|
| 2104 | + usort($calendarObjects, function(array $a, array $b) { |
|
| 2105 | 2105 | /** @var DateTimeImmutable $startA */ |
| 2106 | 2106 | $startA = $a['objects'][0]['DTSTART'][0] ?? new DateTimeImmutable(self::MAX_DATE); |
| 2107 | 2107 | /** @var DateTimeImmutable $startB */ |
@@ -2146,7 +2146,7 @@ discard block |
||
| 2146 | 2146 | 'time-range' => null, |
| 2147 | 2147 | ]); |
| 2148 | 2148 | } catch (MaxInstancesExceededException $ex) { |
| 2149 | - $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'], [ |
|
| 2149 | + $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'], [ |
|
| 2150 | 2150 | 'app' => 'dav', |
| 2151 | 2151 | 'exception' => $ex, |
| 2152 | 2152 | ]); |
@@ -2177,7 +2177,7 @@ discard block |
||
| 2177 | 2177 | /** @var Component[] $subComponents */ |
| 2178 | 2178 | $subComponents = $comp->getComponents(); |
| 2179 | 2179 | /** @var Property[] $properties */ |
| 2180 | - $properties = array_filter($comp->children(), function ($c) { |
|
| 2180 | + $properties = array_filter($comp->children(), function($c) { |
|
| 2181 | 2181 | return $c instanceof Property; |
| 2182 | 2182 | }); |
| 2183 | 2183 | $validationRules = $comp->getValidationRules(); |
@@ -2245,7 +2245,7 @@ discard block |
||
| 2245 | 2245 | array $searchParameters, |
| 2246 | 2246 | array $options = [], |
| 2247 | 2247 | ): array { |
| 2248 | - return $this->atomic(function () use ($principalUri, $pattern, $componentTypes, $searchProperties, $searchParameters, $options) { |
|
| 2248 | + return $this->atomic(function() use ($principalUri, $pattern, $componentTypes, $searchProperties, $searchParameters, $options) { |
|
| 2249 | 2249 | $escapePattern = !\array_key_exists('escape_like_param', $options) || $options['escape_like_param'] !== false; |
| 2250 | 2250 | |
| 2251 | 2251 | $calendarObjectIdQuery = $this->db->getQueryBuilder(); |
@@ -2257,7 +2257,7 @@ discard block |
||
| 2257 | 2257 | $subscriptions = $this->getSubscriptionsForUser($principalUri); |
| 2258 | 2258 | foreach ($calendars as $calendar) { |
| 2259 | 2259 | $calendarAnd = $calendarObjectIdQuery->expr()->andX( |
| 2260 | - $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])), |
|
| 2260 | + $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id'])), |
|
| 2261 | 2261 | $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)), |
| 2262 | 2262 | ); |
| 2263 | 2263 | |
@@ -2271,7 +2271,7 @@ discard block |
||
| 2271 | 2271 | } |
| 2272 | 2272 | foreach ($subscriptions as $subscription) { |
| 2273 | 2273 | $subscriptionAnd = $calendarObjectIdQuery->expr()->andX( |
| 2274 | - $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])), |
|
| 2274 | + $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id'])), |
|
| 2275 | 2275 | $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)), |
| 2276 | 2276 | ); |
| 2277 | 2277 | |
@@ -2320,7 +2320,7 @@ discard block |
||
| 2320 | 2320 | if (!$escapePattern) { |
| 2321 | 2321 | $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern))); |
| 2322 | 2322 | } else { |
| 2323 | - $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 2323 | + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
| 2324 | 2324 | } |
| 2325 | 2325 | } |
| 2326 | 2326 | |
@@ -2348,7 +2348,7 @@ discard block |
||
| 2348 | 2348 | $result = $calendarObjectIdQuery->executeQuery(); |
| 2349 | 2349 | $matches = []; |
| 2350 | 2350 | while (($row = $result->fetch()) !== false) { |
| 2351 | - $matches[] = (int)$row['objectid']; |
|
| 2351 | + $matches[] = (int) $row['objectid']; |
|
| 2352 | 2352 | } |
| 2353 | 2353 | $result->closeCursor(); |
| 2354 | 2354 | |
@@ -2360,8 +2360,8 @@ discard block |
||
| 2360 | 2360 | $result = $query->executeQuery(); |
| 2361 | 2361 | $calendarObjects = []; |
| 2362 | 2362 | while (($array = $result->fetch()) !== false) { |
| 2363 | - $array['calendarid'] = (int)$array['calendarid']; |
|
| 2364 | - $array['calendartype'] = (int)$array['calendartype']; |
|
| 2363 | + $array['calendarid'] = (int) $array['calendarid']; |
|
| 2364 | + $array['calendartype'] = (int) $array['calendartype']; |
|
| 2365 | 2365 | $array['calendardata'] = $this->readBlob($array['calendardata']); |
| 2366 | 2366 | |
| 2367 | 2367 | $calendarObjects[] = $array; |
@@ -2402,7 +2402,7 @@ discard block |
||
| 2402 | 2402 | $row = $stmt->fetch(); |
| 2403 | 2403 | $stmt->closeCursor(); |
| 2404 | 2404 | if ($row) { |
| 2405 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
| 2405 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
| 2406 | 2406 | } |
| 2407 | 2407 | |
| 2408 | 2408 | return null; |
@@ -2428,14 +2428,14 @@ discard block |
||
| 2428 | 2428 | 'id' => $row['id'], |
| 2429 | 2429 | 'uri' => $row['uri'], |
| 2430 | 2430 | 'lastmodified' => $row['lastmodified'], |
| 2431 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2431 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2432 | 2432 | 'calendarid' => $row['calendarid'], |
| 2433 | 2433 | 'calendaruri' => $row['calendaruri'], |
| 2434 | - 'size' => (int)$row['size'], |
|
| 2434 | + 'size' => (int) $row['size'], |
|
| 2435 | 2435 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 2436 | 2436 | 'component' => strtolower($row['componenttype']), |
| 2437 | - 'classification' => (int)$row['classification'], |
|
| 2438 | - 'deleted_at' => isset($row['deleted_at']) ? ((int)$row['deleted_at']) : null, |
|
| 2437 | + 'classification' => (int) $row['classification'], |
|
| 2438 | + 'deleted_at' => isset($row['deleted_at']) ? ((int) $row['deleted_at']) : null, |
|
| 2439 | 2439 | ]; |
| 2440 | 2440 | } |
| 2441 | 2441 | |
@@ -2497,9 +2497,9 @@ discard block |
||
| 2497 | 2497 | * @return ?array |
| 2498 | 2498 | */ |
| 2499 | 2499 | public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
| 2500 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
| 2500 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
| 2501 | 2501 | |
| 2502 | - return $this->atomic(function () use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType, $table) { |
|
| 2502 | + return $this->atomic(function() use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType, $table) { |
|
| 2503 | 2503 | // Current synctoken |
| 2504 | 2504 | $qb = $this->db->getQueryBuilder(); |
| 2505 | 2505 | $qb->select('synctoken') |
@@ -2550,7 +2550,7 @@ discard block |
||
| 2550 | 2550 | while ($entry = $stmt->fetch(\PDO::FETCH_NUM)) { |
| 2551 | 2551 | // assign uri (column 0) to appropriate mutation based on operation (column 1) |
| 2552 | 2552 | // forced (int) is needed as doctrine with OCI returns the operation field as string not integer |
| 2553 | - match ((int)$entry[1]) { |
|
| 2553 | + match ((int) $entry[1]) { |
|
| 2554 | 2554 | 1 => $result['added'][] = $entry[0], |
| 2555 | 2555 | 2 => $result['modified'][] = $entry[0], |
| 2556 | 2556 | 3 => $result['deleted'][] = $entry[0], |
@@ -2621,7 +2621,7 @@ discard block |
||
| 2621 | 2621 | 'source' => $row['source'], |
| 2622 | 2622 | 'lastmodified' => $row['lastmodified'], |
| 2623 | 2623 | |
| 2624 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 2624 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 2625 | 2625 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 2626 | 2626 | ]; |
| 2627 | 2627 | |
@@ -2665,7 +2665,7 @@ discard block |
||
| 2665 | 2665 | } |
| 2666 | 2666 | } |
| 2667 | 2667 | |
| 2668 | - [$subscriptionId, $subscriptionRow] = $this->atomic(function () use ($values) { |
|
| 2668 | + [$subscriptionId, $subscriptionRow] = $this->atomic(function() use ($values) { |
|
| 2669 | 2669 | $valuesToInsert = []; |
| 2670 | 2670 | $query = $this->db->getQueryBuilder(); |
| 2671 | 2671 | foreach (array_keys($values) as $name) { |
@@ -2706,7 +2706,7 @@ discard block |
||
| 2706 | 2706 | $supportedProperties = array_keys($this->subscriptionPropertyMap); |
| 2707 | 2707 | $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
| 2708 | 2708 | |
| 2709 | - $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { |
|
| 2709 | + $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) { |
|
| 2710 | 2710 | $newValues = []; |
| 2711 | 2711 | |
| 2712 | 2712 | foreach ($mutations as $propertyName => $propertyValue) { |
@@ -2718,7 +2718,7 @@ discard block |
||
| 2718 | 2718 | } |
| 2719 | 2719 | } |
| 2720 | 2720 | |
| 2721 | - $subscriptionRow = $this->atomic(function () use ($subscriptionId, $newValues) { |
|
| 2721 | + $subscriptionRow = $this->atomic(function() use ($subscriptionId, $newValues) { |
|
| 2722 | 2722 | $query = $this->db->getQueryBuilder(); |
| 2723 | 2723 | $query->update('calendarsubscriptions') |
| 2724 | 2724 | ->set('lastmodified', $query->createNamedParameter(time())); |
@@ -2731,7 +2731,7 @@ discard block |
||
| 2731 | 2731 | return $this->getSubscriptionById($subscriptionId); |
| 2732 | 2732 | }, $this->db); |
| 2733 | 2733 | |
| 2734 | - $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); |
|
| 2734 | + $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations)); |
|
| 2735 | 2735 | |
| 2736 | 2736 | return true; |
| 2737 | 2737 | }); |
@@ -2744,7 +2744,7 @@ discard block |
||
| 2744 | 2744 | * @return void |
| 2745 | 2745 | */ |
| 2746 | 2746 | public function deleteSubscription($subscriptionId) { |
| 2747 | - $this->atomic(function () use ($subscriptionId): void { |
|
| 2747 | + $this->atomic(function() use ($subscriptionId): void { |
|
| 2748 | 2748 | $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
| 2749 | 2749 | |
| 2750 | 2750 | $query = $this->db->getQueryBuilder(); |
@@ -2769,7 +2769,7 @@ discard block |
||
| 2769 | 2769 | ->executeStatement(); |
| 2770 | 2770 | |
| 2771 | 2771 | if ($subscriptionRow) { |
| 2772 | - $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); |
|
| 2772 | + $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, [])); |
|
| 2773 | 2773 | } |
| 2774 | 2774 | }, $this->db); |
| 2775 | 2775 | } |
@@ -2808,8 +2808,8 @@ discard block |
||
| 2808 | 2808 | 'uri' => $row['uri'], |
| 2809 | 2809 | 'calendardata' => $row['calendardata'], |
| 2810 | 2810 | 'lastmodified' => $row['lastmodified'], |
| 2811 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2812 | - 'size' => (int)$row['size'], |
|
| 2811 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2812 | + 'size' => (int) $row['size'], |
|
| 2813 | 2813 | ]; |
| 2814 | 2814 | } |
| 2815 | 2815 | |
@@ -2837,8 +2837,8 @@ discard block |
||
| 2837 | 2837 | 'calendardata' => $row['calendardata'], |
| 2838 | 2838 | 'uri' => $row['uri'], |
| 2839 | 2839 | 'lastmodified' => $row['lastmodified'], |
| 2840 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2841 | - 'size' => (int)$row['size'], |
|
| 2840 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2841 | + 'size' => (int) $row['size'], |
|
| 2842 | 2842 | ]; |
| 2843 | 2843 | } |
| 2844 | 2844 | $stmt->closeCursor(); |
@@ -2880,8 +2880,8 @@ discard block |
||
| 2880 | 2880 | if ($count === 0) { |
| 2881 | 2881 | return; |
| 2882 | 2882 | } |
| 2883 | - $ids = array_map(static function (array $id) { |
|
| 2884 | - return (int)$id[0]; |
|
| 2883 | + $ids = array_map(static function(array $id) { |
|
| 2884 | + return (int) $id[0]; |
|
| 2885 | 2885 | }, $result->fetchAll(\PDO::FETCH_NUM)); |
| 2886 | 2886 | $result->closeCursor(); |
| 2887 | 2887 | |
@@ -2934,15 +2934,15 @@ discard block |
||
| 2934 | 2934 | */ |
| 2935 | 2935 | protected function addChanges(int $calendarId, array $objectUris, int $operation, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void { |
| 2936 | 2936 | $this->cachedObjects = []; |
| 2937 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
| 2937 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
| 2938 | 2938 | |
| 2939 | - $this->atomic(function () use ($calendarId, $objectUris, $operation, $calendarType, $table): void { |
|
| 2939 | + $this->atomic(function() use ($calendarId, $objectUris, $operation, $calendarType, $table): void { |
|
| 2940 | 2940 | $query = $this->db->getQueryBuilder(); |
| 2941 | 2941 | $query->select('synctoken') |
| 2942 | 2942 | ->from($table) |
| 2943 | 2943 | ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
| 2944 | 2944 | $result = $query->executeQuery(); |
| 2945 | - $syncToken = (int)$result->fetchOne(); |
|
| 2945 | + $syncToken = (int) $result->fetchOne(); |
|
| 2946 | 2946 | $result->closeCursor(); |
| 2947 | 2947 | |
| 2948 | 2948 | $query = $this->db->getQueryBuilder(); |
@@ -2971,7 +2971,7 @@ discard block |
||
| 2971 | 2971 | public function restoreChanges(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void { |
| 2972 | 2972 | $this->cachedObjects = []; |
| 2973 | 2973 | |
| 2974 | - $this->atomic(function () use ($calendarId, $calendarType): void { |
|
| 2974 | + $this->atomic(function() use ($calendarId, $calendarType): void { |
|
| 2975 | 2975 | $qbAdded = $this->db->getQueryBuilder(); |
| 2976 | 2976 | $qbAdded->select('uri') |
| 2977 | 2977 | ->from('calendarobjects') |
@@ -3001,7 +3001,7 @@ discard block |
||
| 3001 | 3001 | ) |
| 3002 | 3002 | ); |
| 3003 | 3003 | $resultDeleted = $qbDeleted->executeQuery(); |
| 3004 | - $deletedUris = array_map(function (string $uri) { |
|
| 3004 | + $deletedUris = array_map(function(string $uri) { |
|
| 3005 | 3005 | return str_replace('-deleted.ics', '.ics', $uri); |
| 3006 | 3006 | }, $resultDeleted->fetchAll(\PDO::FETCH_COLUMN)); |
| 3007 | 3007 | $resultDeleted->closeCursor(); |
@@ -3046,7 +3046,7 @@ discard block |
||
| 3046 | 3046 | // Track first component type and uid |
| 3047 | 3047 | if ($uid === null) { |
| 3048 | 3048 | $componentType = $component->name; |
| 3049 | - $uid = (string)$component->UID; |
|
| 3049 | + $uid = (string) $component->UID; |
|
| 3050 | 3050 | } |
| 3051 | 3051 | } |
| 3052 | 3052 | } |
@@ -3137,11 +3137,11 @@ discard block |
||
| 3137 | 3137 | * @param list<string> $remove |
| 3138 | 3138 | */ |
| 3139 | 3139 | public function updateShares(IShareable $shareable, array $add, array $remove): void { |
| 3140 | - $this->atomic(function () use ($shareable, $add, $remove): void { |
|
| 3140 | + $this->atomic(function() use ($shareable, $add, $remove): void { |
|
| 3141 | 3141 | $calendarId = $shareable->getResourceId(); |
| 3142 | 3142 | $calendarRow = $this->getCalendarById($calendarId); |
| 3143 | 3143 | if ($calendarRow === null) { |
| 3144 | - throw new \RuntimeException('Trying to update shares for non-existing calendar: ' . $calendarId); |
|
| 3144 | + throw new \RuntimeException('Trying to update shares for non-existing calendar: '.$calendarId); |
|
| 3145 | 3145 | } |
| 3146 | 3146 | $oldShares = $this->getShares($calendarId); |
| 3147 | 3147 | |
@@ -3168,7 +3168,7 @@ discard block |
||
| 3168 | 3168 | * @return string|null |
| 3169 | 3169 | */ |
| 3170 | 3170 | public function setPublishStatus($value, $calendar) { |
| 3171 | - return $this->atomic(function () use ($value, $calendar) { |
|
| 3171 | + return $this->atomic(function() use ($value, $calendar) { |
|
| 3172 | 3172 | $calendarId = $calendar->getResourceId(); |
| 3173 | 3173 | $calendarData = $this->getCalendarById($calendarId); |
| 3174 | 3174 | |
@@ -3235,7 +3235,7 @@ discard block |
||
| 3235 | 3235 | */ |
| 3236 | 3236 | public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
| 3237 | 3237 | $this->cachedObjects = []; |
| 3238 | - $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $calendarType): void { |
|
| 3238 | + $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $calendarType): void { |
|
| 3239 | 3239 | $objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType); |
| 3240 | 3240 | |
| 3241 | 3241 | try { |
@@ -3307,7 +3307,7 @@ discard block |
||
| 3307 | 3307 | * deletes all birthday calendars |
| 3308 | 3308 | */ |
| 3309 | 3309 | public function deleteAllBirthdayCalendars() { |
| 3310 | - $this->atomic(function (): void { |
|
| 3310 | + $this->atomic(function(): void { |
|
| 3311 | 3311 | $query = $this->db->getQueryBuilder(); |
| 3312 | 3312 | $result = $query->select(['id'])->from('calendars') |
| 3313 | 3313 | ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) |
@@ -3327,7 +3327,7 @@ discard block |
||
| 3327 | 3327 | * @param $subscriptionId |
| 3328 | 3328 | */ |
| 3329 | 3329 | public function purgeAllCachedEventsForSubscription($subscriptionId) { |
| 3330 | - $this->atomic(function () use ($subscriptionId): void { |
|
| 3330 | + $this->atomic(function() use ($subscriptionId): void { |
|
| 3331 | 3331 | $query = $this->db->getQueryBuilder(); |
| 3332 | 3332 | $query->select('uri') |
| 3333 | 3333 | ->from('calendarobjects') |
@@ -3373,7 +3373,7 @@ discard block |
||
| 3373 | 3373 | return; |
| 3374 | 3374 | } |
| 3375 | 3375 | |
| 3376 | - $this->atomic(function () use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void { |
|
| 3376 | + $this->atomic(function() use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void { |
|
| 3377 | 3377 | foreach (array_chunk($calendarObjectIds, 1000) as $chunk) { |
| 3378 | 3378 | $query = $this->db->getQueryBuilder(); |
| 3379 | 3379 | $query->delete($this->dbObjectPropertiesTable) |
@@ -3466,10 +3466,10 @@ discard block |
||
| 3466 | 3466 | $result->closeCursor(); |
| 3467 | 3467 | |
| 3468 | 3468 | if (!isset($objectIds['id'])) { |
| 3469 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
| 3469 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
| 3470 | 3470 | } |
| 3471 | 3471 | |
| 3472 | - return (int)$objectIds['id']; |
|
| 3472 | + return (int) $objectIds['id']; |
|
| 3473 | 3473 | } |
| 3474 | 3474 | |
| 3475 | 3475 | /** |
@@ -3485,7 +3485,7 @@ discard block |
||
| 3485 | 3485 | ->from('calendarchanges'); |
| 3486 | 3486 | |
| 3487 | 3487 | $result = $query->executeQuery(); |
| 3488 | - $maxId = (int)$result->fetchOne(); |
|
| 3488 | + $maxId = (int) $result->fetchOne(); |
|
| 3489 | 3489 | $result->closeCursor(); |
| 3490 | 3490 | if (!$maxId || $maxId < $keep) { |
| 3491 | 3491 | return 0; |
@@ -3523,8 +3523,8 @@ discard block |
||
| 3523 | 3523 | * |
| 3524 | 3524 | */ |
| 3525 | 3525 | private function addOwnerPrincipalToCalendar(array $calendarInfo): array { |
| 3526 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 3527 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 3526 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
| 3527 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
| 3528 | 3528 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
| 3529 | 3529 | $uri = $calendarInfo[$ownerPrincipalKey]; |
| 3530 | 3530 | } else { |
@@ -115,12 +115,12 @@ discard block |
||
| 115 | 115 | ], |
| 116 | 116 | [ |
| 117 | 117 | 'privilege' => '{DAV:}read', |
| 118 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
| 118 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
| 119 | 119 | 'protected' => true, |
| 120 | 120 | ], |
| 121 | 121 | [ |
| 122 | 122 | 'privilege' => '{DAV:}read', |
| 123 | - 'principal' => $this->getOwner() . '/calendar-proxy-read', |
|
| 123 | + 'principal' => $this->getOwner().'/calendar-proxy-read', |
|
| 124 | 124 | 'protected' => true, |
| 125 | 125 | ], |
| 126 | 126 | ]; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | ]; |
| 134 | 134 | $acl[] = [ |
| 135 | 135 | 'privilege' => '{DAV:}write', |
| 136 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
| 136 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
| 137 | 137 | 'protected' => true, |
| 138 | 138 | ]; |
| 139 | 139 | } else { |
@@ -144,14 +144,14 @@ discard block |
||
| 144 | 144 | ]; |
| 145 | 145 | $acl[] = [ |
| 146 | 146 | 'privilege' => '{DAV:}write-properties', |
| 147 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
| 147 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
| 148 | 148 | 'protected' => true, |
| 149 | 149 | ]; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | $acl[] = [ |
| 153 | 153 | 'privilege' => '{DAV:}write-properties', |
| 154 | - 'principal' => $this->getOwner() . '/calendar-proxy-read', |
|
| 154 | + 'principal' => $this->getOwner().'/calendar-proxy-read', |
|
| 155 | 155 | 'protected' => true, |
| 156 | 156 | ]; |
| 157 | 157 | |
@@ -190,13 +190,13 @@ discard block |
||
| 190 | 190 | $acl = $this->caldavBackend->applyShareAcl($this->getResourceId(), $acl); |
| 191 | 191 | $allowedPrincipals = [ |
| 192 | 192 | $this->getOwner(), |
| 193 | - $this->getOwner() . '/calendar-proxy-read', |
|
| 194 | - $this->getOwner() . '/calendar-proxy-write', |
|
| 193 | + $this->getOwner().'/calendar-proxy-read', |
|
| 194 | + $this->getOwner().'/calendar-proxy-write', |
|
| 195 | 195 | parent::getOwner(), |
| 196 | 196 | 'principals/system/public' |
| 197 | 197 | ]; |
| 198 | 198 | /** @var list<array{privilege: string, principal: string, protected: bool}> $acl */ |
| 199 | - $acl = array_filter($acl, function (array $rule) use ($allowedPrincipals): bool { |
|
| 199 | + $acl = array_filter($acl, function(array $rule) use ($allowedPrincipals): bool { |
|
| 200 | 200 | return \in_array($rule['principal'], $allowedPrincipals, true); |
| 201 | 201 | }); |
| 202 | 202 | return $acl; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | public function delete() { |
| 217 | 217 | if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal']) && |
| 218 | 218 | $this->calendarInfo['{http://owncloud.org/ns}owner-principal'] !== $this->calendarInfo['principaluri']) { |
| 219 | - $principal = 'principal:' . parent::getOwner(); |
|
| 219 | + $principal = 'principal:'.parent::getOwner(); |
|
| 220 | 220 | $this->caldavBackend->updateShares($this, [], [ |
| 221 | 221 | $principal |
| 222 | 222 | ]); |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | public function calendarQuery(array $filters) { |
| 304 | 304 | $uris = $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters); |
| 305 | 305 | if ($this->isShared()) { |
| 306 | - return array_filter($uris, function ($uri) { |
|
| 306 | + return array_filter($uris, function($uri) { |
|
| 307 | 307 | return $this->childExists($uri); |
| 308 | 308 | }); |
| 309 | 309 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | * @inheritDoc |
| 378 | 378 | */ |
| 379 | 379 | public function restore(): void { |
| 380 | - $this->caldavBackend->restoreCalendar((int)$this->calendarInfo['id']); |
|
| 380 | + $this->caldavBackend->restoreCalendar((int) $this->calendarInfo['id']); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | public function disableTrashbin(): void { |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | $targetName, |
| 401 | 401 | ); |
| 402 | 402 | } catch (Exception $e) { |
| 403 | - $this->logger->error('Could not move calendar object: ' . $e->getMessage(), ['exception' => $e]); |
|
| 403 | + $this->logger->error('Could not move calendar object: '.$e->getMessage(), ['exception' => $e]); |
|
| 404 | 404 | return false; |
| 405 | 405 | } |
| 406 | 406 | } |