@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | $result = $query->executeQuery(); |
259 | - $column = (int)$result->fetchOne(); |
|
259 | + $column = (int) $result->fetchOne(); |
|
260 | 260 | $result->closeCursor(); |
261 | 261 | return $column; |
262 | 262 | } |
@@ -316,18 +316,18 @@ discard block |
||
316 | 316 | $row['principaluri'] = (string) $row['principaluri']; |
317 | 317 | $components = []; |
318 | 318 | if ($row['components']) { |
319 | - $components = explode(',',$row['components']); |
|
319 | + $components = explode(',', $row['components']); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | $calendar = [ |
323 | 323 | 'id' => $row['id'], |
324 | 324 | 'uri' => $row['uri'], |
325 | 325 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
326 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
327 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
328 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
329 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
330 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
326 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
327 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
328 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
329 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
330 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
331 | 331 | ]; |
332 | 332 | |
333 | 333 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | |
368 | 368 | $result = $query->executeQuery(); |
369 | 369 | |
370 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
370 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
371 | 371 | while ($row = $result->fetch()) { |
372 | 372 | $row['principaluri'] = (string) $row['principaluri']; |
373 | 373 | if ($row['principaluri'] === $principalUri) { |
@@ -388,21 +388,21 @@ discard block |
||
388 | 388 | } |
389 | 389 | |
390 | 390 | [, $name] = Uri\split($row['principaluri']); |
391 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
392 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
391 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
392 | + $row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
393 | 393 | $components = []; |
394 | 394 | if ($row['components']) { |
395 | - $components = explode(',',$row['components']); |
|
395 | + $components = explode(',', $row['components']); |
|
396 | 396 | } |
397 | 397 | $calendar = [ |
398 | 398 | 'id' => $row['id'], |
399 | 399 | 'uri' => $uri, |
400 | 400 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
401 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
402 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
403 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
404 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
405 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
401 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
402 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
403 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
404 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
405 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
406 | 406 | $readOnlyPropertyName => $readOnly, |
407 | 407 | ]; |
408 | 408 | |
@@ -443,16 +443,16 @@ discard block |
||
443 | 443 | $row['principaluri'] = (string) $row['principaluri']; |
444 | 444 | $components = []; |
445 | 445 | if ($row['components']) { |
446 | - $components = explode(',',$row['components']); |
|
446 | + $components = explode(',', $row['components']); |
|
447 | 447 | } |
448 | 448 | $calendar = [ |
449 | 449 | 'id' => $row['id'], |
450 | 450 | 'uri' => $row['uri'], |
451 | 451 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
452 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
453 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
454 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
455 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
452 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
453 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
454 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
455 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
456 | 456 | ]; |
457 | 457 | foreach ($this->propertyMap as $xmlName => $dbName) { |
458 | 458 | $calendar[$xmlName] = $row[$dbName]; |
@@ -512,22 +512,22 @@ discard block |
||
512 | 512 | while ($row = $result->fetch()) { |
513 | 513 | $row['principaluri'] = (string) $row['principaluri']; |
514 | 514 | [, $name] = Uri\split($row['principaluri']); |
515 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
515 | + $row['displayname'] = $row['displayname']."($name)"; |
|
516 | 516 | $components = []; |
517 | 517 | if ($row['components']) { |
518 | - $components = explode(',',$row['components']); |
|
518 | + $components = explode(',', $row['components']); |
|
519 | 519 | } |
520 | 520 | $calendar = [ |
521 | 521 | 'id' => $row['id'], |
522 | 522 | 'uri' => $row['publicuri'], |
523 | 523 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
524 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
525 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
526 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
527 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
528 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
529 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
530 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
524 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
525 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
526 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
527 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
528 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
529 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
530 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
531 | 531 | ]; |
532 | 532 | |
533 | 533 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -574,27 +574,27 @@ discard block |
||
574 | 574 | $result->closeCursor(); |
575 | 575 | |
576 | 576 | if ($row === false) { |
577 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
577 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | $row['principaluri'] = (string) $row['principaluri']; |
581 | 581 | [, $name] = Uri\split($row['principaluri']); |
582 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
582 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
583 | 583 | $components = []; |
584 | 584 | if ($row['components']) { |
585 | - $components = explode(',',$row['components']); |
|
585 | + $components = explode(',', $row['components']); |
|
586 | 586 | } |
587 | 587 | $calendar = [ |
588 | 588 | 'id' => $row['id'], |
589 | 589 | 'uri' => $row['publicuri'], |
590 | 590 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
591 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
592 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
593 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
594 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
595 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
596 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
597 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
591 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
592 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
593 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
594 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
595 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
596 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
597 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
598 | 598 | ]; |
599 | 599 | |
600 | 600 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -637,17 +637,17 @@ discard block |
||
637 | 637 | $row['principaluri'] = (string) $row['principaluri']; |
638 | 638 | $components = []; |
639 | 639 | if ($row['components']) { |
640 | - $components = explode(',',$row['components']); |
|
640 | + $components = explode(',', $row['components']); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | $calendar = [ |
644 | 644 | 'id' => $row['id'], |
645 | 645 | 'uri' => $row['uri'], |
646 | 646 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
647 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
648 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
649 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
650 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
647 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
648 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
649 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
650 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
651 | 651 | ]; |
652 | 652 | |
653 | 653 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -688,17 +688,17 @@ discard block |
||
688 | 688 | $row['principaluri'] = (string) $row['principaluri']; |
689 | 689 | $components = []; |
690 | 690 | if ($row['components']) { |
691 | - $components = explode(',',$row['components']); |
|
691 | + $components = explode(',', $row['components']); |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | $calendar = [ |
695 | 695 | 'id' => $row['id'], |
696 | 696 | 'uri' => $row['uri'], |
697 | 697 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
698 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
699 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
700 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
701 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
698 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
699 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
700 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
701 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
702 | 702 | ]; |
703 | 703 | |
704 | 704 | foreach ($this->propertyMap as $xmlName => $dbName) { |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | 'principaluri' => $row['principaluri'], |
743 | 743 | 'source' => $row['source'], |
744 | 744 | 'lastmodified' => $row['lastmodified'], |
745 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
746 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
745 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
746 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
747 | 747 | ]; |
748 | 748 | |
749 | 749 | foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
@@ -780,16 +780,16 @@ discard block |
||
780 | 780 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
781 | 781 | if (isset($properties[$sccs])) { |
782 | 782 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
783 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
783 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
784 | 784 | } |
785 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
785 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
786 | 786 | } elseif (isset($properties['components'])) { |
787 | 787 | // Allow to provide components internally without having |
788 | 788 | // to create a SupportedCalendarComponentSet object |
789 | 789 | $values['components'] = $properties['components']; |
790 | 790 | } |
791 | 791 | |
792 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
792 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
793 | 793 | if (isset($properties[$transp])) { |
794 | 794 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
795 | 795 | } |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | $calendarId = $query->getLastInsertId(); |
810 | 810 | |
811 | 811 | $calendarData = $this->getCalendarById($calendarId); |
812 | - $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); |
|
812 | + $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData)); |
|
813 | 813 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent( |
814 | 814 | '\OCA\DAV\CalDAV\CalDavBackend::createCalendar', |
815 | 815 | [ |
@@ -838,13 +838,13 @@ discard block |
||
838 | 838 | */ |
839 | 839 | public function updateCalendar($calendarId, PropPatch $propPatch) { |
840 | 840 | $supportedProperties = array_keys($this->propertyMap); |
841 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
841 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
842 | 842 | |
843 | - $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { |
|
843 | + $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
|
844 | 844 | $newValues = []; |
845 | 845 | foreach ($mutations as $propertyName => $propertyValue) { |
846 | 846 | switch ($propertyName) { |
847 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': |
|
847 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp': |
|
848 | 848 | $fieldName = 'transparent'; |
849 | 849 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
850 | 850 | break; |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | |
867 | 867 | $calendarData = $this->getCalendarById($calendarId); |
868 | 868 | $shares = $this->getShares($calendarId); |
869 | - $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations)); |
|
869 | + $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int) $calendarId, $calendarData, $shares, $mutations)); |
|
870 | 870 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent( |
871 | 871 | '\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', |
872 | 872 | [ |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | |
910 | 910 | // Only dispatch if we actually deleted anything |
911 | 911 | if ($calendarData) { |
912 | - $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares)); |
|
912 | + $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int) $calendarId, $calendarData, $shares)); |
|
913 | 913 | } |
914 | 914 | } |
915 | 915 | |
@@ -969,11 +969,11 @@ discard block |
||
969 | 969 | 'id' => $row['id'], |
970 | 970 | 'uri' => $row['uri'], |
971 | 971 | 'lastmodified' => $row['lastmodified'], |
972 | - 'etag' => '"' . $row['etag'] . '"', |
|
972 | + 'etag' => '"'.$row['etag'].'"', |
|
973 | 973 | 'calendarid' => $row['calendarid'], |
974 | - 'size' => (int)$row['size'], |
|
974 | + 'size' => (int) $row['size'], |
|
975 | 975 | 'component' => strtolower($row['componenttype']), |
976 | - 'classification' => (int)$row['classification'] |
|
976 | + 'classification' => (int) $row['classification'] |
|
977 | 977 | ]; |
978 | 978 | } |
979 | 979 | $stmt->closeCursor(); |
@@ -1017,12 +1017,12 @@ discard block |
||
1017 | 1017 | 'id' => $row['id'], |
1018 | 1018 | 'uri' => $row['uri'], |
1019 | 1019 | 'lastmodified' => $row['lastmodified'], |
1020 | - 'etag' => '"' . $row['etag'] . '"', |
|
1020 | + 'etag' => '"'.$row['etag'].'"', |
|
1021 | 1021 | 'calendarid' => $row['calendarid'], |
1022 | - 'size' => (int)$row['size'], |
|
1022 | + 'size' => (int) $row['size'], |
|
1023 | 1023 | 'calendardata' => $this->readBlob($row['calendardata']), |
1024 | 1024 | 'component' => strtolower($row['componenttype']), |
1025 | - 'classification' => (int)$row['classification'] |
|
1025 | + 'classification' => (int) $row['classification'] |
|
1026 | 1026 | ]; |
1027 | 1027 | } |
1028 | 1028 | |
@@ -1063,12 +1063,12 @@ discard block |
||
1063 | 1063 | 'id' => $row['id'], |
1064 | 1064 | 'uri' => $row['uri'], |
1065 | 1065 | 'lastmodified' => $row['lastmodified'], |
1066 | - 'etag' => '"' . $row['etag'] . '"', |
|
1066 | + 'etag' => '"'.$row['etag'].'"', |
|
1067 | 1067 | 'calendarid' => $row['calendarid'], |
1068 | - 'size' => (int)$row['size'], |
|
1068 | + 'size' => (int) $row['size'], |
|
1069 | 1069 | 'calendardata' => $this->readBlob($row['calendardata']), |
1070 | 1070 | 'component' => strtolower($row['componenttype']), |
1071 | - 'classification' => (int)$row['classification'] |
|
1071 | + 'classification' => (int) $row['classification'] |
|
1072 | 1072 | ]; |
1073 | 1073 | } |
1074 | 1074 | $result->closeCursor(); |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | $calendarRow = $this->getCalendarById($calendarId); |
1141 | 1141 | $shares = $this->getShares($calendarId); |
1142 | 1142 | |
1143 | - $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
1143 | + $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow)); |
|
1144 | 1144 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent( |
1145 | 1145 | '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', |
1146 | 1146 | [ |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | } else { |
1154 | 1154 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
1155 | 1155 | |
1156 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
1156 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow)); |
|
1157 | 1157 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent( |
1158 | 1158 | '\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', |
1159 | 1159 | [ |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | )); |
1166 | 1166 | } |
1167 | 1167 | |
1168 | - return '"' . $extraData['etag'] . '"'; |
|
1168 | + return '"'.$extraData['etag'].'"'; |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | /** |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | $calendarRow = $this->getCalendarById($calendarId); |
1215 | 1215 | $shares = $this->getShares($calendarId); |
1216 | 1216 | |
1217 | - $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
1217 | + $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow)); |
|
1218 | 1218 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent( |
1219 | 1219 | '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', |
1220 | 1220 | [ |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | } else { |
1228 | 1228 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
1229 | 1229 | |
1230 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
1230 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow)); |
|
1231 | 1231 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent( |
1232 | 1232 | '\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', |
1233 | 1233 | [ |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | } |
1241 | 1241 | } |
1242 | 1242 | |
1243 | - return '"' . $extraData['etag'] . '"'; |
|
1243 | + return '"'.$extraData['etag'].'"'; |
|
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | /** |
@@ -1277,7 +1277,7 @@ discard block |
||
1277 | 1277 | $calendarRow = $this->getCalendarById($calendarId); |
1278 | 1278 | $shares = $this->getShares($calendarId); |
1279 | 1279 | |
1280 | - $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data)); |
|
1280 | + $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int) $calendarId, $calendarRow, $shares, $data)); |
|
1281 | 1281 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent( |
1282 | 1282 | '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', |
1283 | 1283 | [ |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | } else { |
1291 | 1291 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
1292 | 1292 | |
1293 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data)); |
|
1293 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int) $calendarId, $subscriptionRow, [], $data)); |
|
1294 | 1294 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent( |
1295 | 1295 | '\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', |
1296 | 1296 | [ |
@@ -1562,7 +1562,7 @@ discard block |
||
1562 | 1562 | |
1563 | 1563 | $result = []; |
1564 | 1564 | while ($row = $stmt->fetch()) { |
1565 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
1565 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
1566 | 1566 | if (!in_array($path, $result)) { |
1567 | 1567 | $result[] = $path; |
1568 | 1568 | } |
@@ -1610,8 +1610,8 @@ discard block |
||
1610 | 1610 | |
1611 | 1611 | if ($pattern !== '') { |
1612 | 1612 | $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
1613 | - $outerQuery->createNamedParameter('%' . |
|
1614 | - $this->db->escapeLikeParameter($pattern) . '%'))); |
|
1613 | + $outerQuery->createNamedParameter('%'. |
|
1614 | + $this->db->escapeLikeParameter($pattern).'%'))); |
|
1615 | 1615 | } |
1616 | 1616 | |
1617 | 1617 | $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri') |
@@ -1650,7 +1650,7 @@ discard block |
||
1650 | 1650 | $result = $outerQuery->executeQuery(); |
1651 | 1651 | $calendarObjects = $result->fetchAll(); |
1652 | 1652 | |
1653 | - return array_map(function ($o) { |
|
1653 | + return array_map(function($o) { |
|
1654 | 1654 | $calendarData = Reader::read($o['calendardata']); |
1655 | 1655 | $comps = $calendarData->getComponents(); |
1656 | 1656 | $objects = []; |
@@ -1668,10 +1668,10 @@ discard block |
||
1668 | 1668 | 'type' => $o['componenttype'], |
1669 | 1669 | 'uid' => $o['uid'], |
1670 | 1670 | 'uri' => $o['uri'], |
1671 | - 'objects' => array_map(function ($c) { |
|
1671 | + 'objects' => array_map(function($c) { |
|
1672 | 1672 | return $this->transformSearchData($c); |
1673 | 1673 | }, $objects), |
1674 | - 'timezones' => array_map(function ($c) { |
|
1674 | + 'timezones' => array_map(function($c) { |
|
1675 | 1675 | return $this->transformSearchData($c); |
1676 | 1676 | }, $timezones), |
1677 | 1677 | ]; |
@@ -1687,7 +1687,7 @@ discard block |
||
1687 | 1687 | /** @var Component[] $subComponents */ |
1688 | 1688 | $subComponents = $comp->getComponents(); |
1689 | 1689 | /** @var Property[] $properties */ |
1690 | - $properties = array_filter($comp->children(), function ($c) { |
|
1690 | + $properties = array_filter($comp->children(), function($c) { |
|
1691 | 1691 | return $c instanceof Property; |
1692 | 1692 | }); |
1693 | 1693 | $validationRules = $comp->getValidationRules(); |
@@ -1765,7 +1765,7 @@ discard block |
||
1765 | 1765 | $subscriptions = $this->getSubscriptionsForUser($principalUri); |
1766 | 1766 | foreach ($calendars as $calendar) { |
1767 | 1767 | $calendarAnd = $calendarObjectIdQuery->expr()->andX(); |
1768 | - $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id']))); |
|
1768 | + $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id']))); |
|
1769 | 1769 | $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
1770 | 1770 | |
1771 | 1771 | // If it's shared, limit search to public events |
@@ -1778,7 +1778,7 @@ discard block |
||
1778 | 1778 | } |
1779 | 1779 | foreach ($subscriptions as $subscription) { |
1780 | 1780 | $subscriptionAnd = $calendarObjectIdQuery->expr()->andX(); |
1781 | - $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id']))); |
|
1781 | + $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id']))); |
|
1782 | 1782 | $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))); |
1783 | 1783 | |
1784 | 1784 | // If it's shared, limit search to public events |
@@ -1823,7 +1823,7 @@ discard block |
||
1823 | 1823 | if (!$escapePattern) { |
1824 | 1824 | $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern))); |
1825 | 1825 | } else { |
1826 | - $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
1826 | + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
1827 | 1827 | } |
1828 | 1828 | } |
1829 | 1829 | |
@@ -1837,7 +1837,7 @@ discard block |
||
1837 | 1837 | $result = $calendarObjectIdQuery->executeQuery(); |
1838 | 1838 | $matches = $result->fetchAll(); |
1839 | 1839 | $result->closeCursor(); |
1840 | - $matches = array_map(static function (array $match):int { |
|
1840 | + $matches = array_map(static function(array $match):int { |
|
1841 | 1841 | return (int) $match['objectid']; |
1842 | 1842 | }, $matches); |
1843 | 1843 | |
@@ -1850,9 +1850,9 @@ discard block |
||
1850 | 1850 | $calendarObjects = $result->fetchAll(); |
1851 | 1851 | $result->closeCursor(); |
1852 | 1852 | |
1853 | - return array_map(function (array $array): array { |
|
1854 | - $array['calendarid'] = (int)$array['calendarid']; |
|
1855 | - $array['calendartype'] = (int)$array['calendartype']; |
|
1853 | + return array_map(function(array $array): array { |
|
1854 | + $array['calendarid'] = (int) $array['calendarid']; |
|
1855 | + $array['calendartype'] = (int) $array['calendartype']; |
|
1856 | 1856 | $array['calendardata'] = $this->readBlob($array['calendardata']); |
1857 | 1857 | |
1858 | 1858 | return $array; |
@@ -1890,7 +1890,7 @@ discard block |
||
1890 | 1890 | $row = $stmt->fetch(); |
1891 | 1891 | $stmt->closeCursor(); |
1892 | 1892 | if ($row) { |
1893 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
1893 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
1894 | 1894 | } |
1895 | 1895 | |
1896 | 1896 | return null; |
@@ -2091,8 +2091,8 @@ discard block |
||
2091 | 2091 | 'source' => $row['source'], |
2092 | 2092 | 'lastmodified' => $row['lastmodified'], |
2093 | 2093 | |
2094 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
2095 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
2094 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
2095 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
2096 | 2096 | ]; |
2097 | 2097 | |
2098 | 2098 | foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) { |
@@ -2187,7 +2187,7 @@ discard block |
||
2187 | 2187 | $supportedProperties = array_keys($this->subscriptionPropertyMap); |
2188 | 2188 | $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
2189 | 2189 | |
2190 | - $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { |
|
2190 | + $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) { |
|
2191 | 2191 | $newValues = []; |
2192 | 2192 | |
2193 | 2193 | foreach ($mutations as $propertyName => $propertyValue) { |
@@ -2209,7 +2209,7 @@ discard block |
||
2209 | 2209 | ->executeStatement(); |
2210 | 2210 | |
2211 | 2211 | $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
2212 | - $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); |
|
2212 | + $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations)); |
|
2213 | 2213 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent( |
2214 | 2214 | '\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', |
2215 | 2215 | [ |
@@ -2260,7 +2260,7 @@ discard block |
||
2260 | 2260 | ->executeStatement(); |
2261 | 2261 | |
2262 | 2262 | if ($subscriptionRow) { |
2263 | - $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); |
|
2263 | + $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, [])); |
|
2264 | 2264 | } |
2265 | 2265 | } |
2266 | 2266 | |
@@ -2298,8 +2298,8 @@ discard block |
||
2298 | 2298 | 'uri' => $row['uri'], |
2299 | 2299 | 'calendardata' => $row['calendardata'], |
2300 | 2300 | 'lastmodified' => $row['lastmodified'], |
2301 | - 'etag' => '"' . $row['etag'] . '"', |
|
2302 | - 'size' => (int)$row['size'], |
|
2301 | + 'etag' => '"'.$row['etag'].'"', |
|
2302 | + 'size' => (int) $row['size'], |
|
2303 | 2303 | ]; |
2304 | 2304 | } |
2305 | 2305 | |
@@ -2327,8 +2327,8 @@ discard block |
||
2327 | 2327 | 'calendardata' => $row['calendardata'], |
2328 | 2328 | 'uri' => $row['uri'], |
2329 | 2329 | 'lastmodified' => $row['lastmodified'], |
2330 | - 'etag' => '"' . $row['etag'] . '"', |
|
2331 | - 'size' => (int)$row['size'], |
|
2330 | + 'etag' => '"'.$row['etag'].'"', |
|
2331 | + 'size' => (int) $row['size'], |
|
2332 | 2332 | ]; |
2333 | 2333 | } |
2334 | 2334 | |
@@ -2382,14 +2382,14 @@ discard block |
||
2382 | 2382 | * @return void |
2383 | 2383 | */ |
2384 | 2384 | protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
2385 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
2385 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
2386 | 2386 | |
2387 | 2387 | $query = $this->db->getQueryBuilder(); |
2388 | 2388 | $query->select('synctoken') |
2389 | 2389 | ->from($table) |
2390 | 2390 | ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
2391 | 2391 | $result = $query->executeQuery(); |
2392 | - $syncToken = (int)$result->fetchOne(); |
|
2392 | + $syncToken = (int) $result->fetchOne(); |
|
2393 | 2393 | $result->closeCursor(); |
2394 | 2394 | |
2395 | 2395 | $query = $this->db->getQueryBuilder(); |
@@ -2446,7 +2446,7 @@ discard block |
||
2446 | 2446 | // Track first component type and uid |
2447 | 2447 | if ($uid === null) { |
2448 | 2448 | $componentType = $component->name; |
2449 | - $uid = (string)$component->UID; |
|
2449 | + $uid = (string) $component->UID; |
|
2450 | 2450 | } |
2451 | 2451 | } |
2452 | 2452 | } |
@@ -2545,7 +2545,7 @@ discard block |
||
2545 | 2545 | ])); |
2546 | 2546 | $this->calendarSharingBackend->updateShares($shareable, $add, $remove); |
2547 | 2547 | |
2548 | - $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove)); |
|
2548 | + $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int) $calendarId, $calendarRow, $oldShares, $add, $remove)); |
|
2549 | 2549 | } |
2550 | 2550 | |
2551 | 2551 | /** |
@@ -2586,7 +2586,7 @@ discard block |
||
2586 | 2586 | ]); |
2587 | 2587 | $query->executeStatement(); |
2588 | 2588 | |
2589 | - $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri)); |
|
2589 | + $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int) $calendarId, $calendarData, $publicUri)); |
|
2590 | 2590 | return $publicUri; |
2591 | 2591 | } |
2592 | 2592 | $query->delete('dav_shares') |
@@ -2594,7 +2594,7 @@ discard block |
||
2594 | 2594 | ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))); |
2595 | 2595 | $query->executeStatement(); |
2596 | 2596 | |
2597 | - $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData)); |
|
2597 | + $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int) $calendarId, $calendarData)); |
|
2598 | 2598 | return null; |
2599 | 2599 | } |
2600 | 2600 | |
@@ -2817,10 +2817,10 @@ discard block |
||
2817 | 2817 | $result->closeCursor(); |
2818 | 2818 | |
2819 | 2819 | if (!isset($objectIds['id'])) { |
2820 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
2820 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
2821 | 2821 | } |
2822 | 2822 | |
2823 | - return (int)$objectIds['id']; |
|
2823 | + return (int) $objectIds['id']; |
|
2824 | 2824 | } |
2825 | 2825 | |
2826 | 2826 | /** |
@@ -2847,8 +2847,8 @@ discard block |
||
2847 | 2847 | * @param $calendarInfo |
2848 | 2848 | */ |
2849 | 2849 | private function addOwnerPrincipal(&$calendarInfo) { |
2850 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
2851 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
2850 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
2851 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
2852 | 2852 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
2853 | 2853 | $uri = $calendarInfo[$ownerPrincipalKey]; |
2854 | 2854 | } else { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | Filesystem::initMountPoints($uid); |
113 | 113 | if ($uid !== User::getUser()) { |
114 | 114 | $info = Filesystem::getFileInfo($filename); |
115 | - $ownerView = new View('/' . $uid . '/files'); |
|
115 | + $ownerView = new View('/'.$uid.'/files'); |
|
116 | 116 | try { |
117 | 117 | $filename = $ownerView->getPath($info['fileid']); |
118 | 118 | } catch (NotFoundException $e) { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | private static function setUpTrash($user) { |
177 | - $view = new View('/' . $user); |
|
177 | + $view = new View('/'.$user); |
|
178 | 178 | if (!$view->is_dir('files_trashbin')) { |
179 | 179 | $view->mkdir('files_trashbin'); |
180 | 180 | } |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | |
210 | 210 | $view = new View('/'); |
211 | 211 | |
212 | - $target = $user . '/files_trashbin/files/' . $targetFilename . '.d' . $timestamp; |
|
213 | - $source = $owner . '/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp; |
|
212 | + $target = $user.'/files_trashbin/files/'.$targetFilename.'.d'.$timestamp; |
|
213 | + $source = $owner.'/files_trashbin/files/'.$sourceFilename.'.d'.$timestamp; |
|
214 | 214 | $free = $view->free_space($target); |
215 | 215 | $isUnknownOrUnlimitedFreeSpace = $free < 0; |
216 | 216 | $isEnoughFreeSpaceLeft = $view->filesize($source) < $free; |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | $ownerPath = $file_path; |
255 | 255 | } |
256 | 256 | |
257 | - $ownerView = new View('/' . $owner); |
|
257 | + $ownerView = new View('/'.$owner); |
|
258 | 258 | // file has been deleted in between |
259 | - if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/' . $ownerPath)) { |
|
259 | + if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/'.$ownerPath)) { |
|
260 | 260 | return true; |
261 | 261 | } |
262 | 262 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $lockingProvider = \OC::$server->getLockingProvider(); |
278 | 278 | |
279 | 279 | // disable proxy to prevent recursive calls |
280 | - $trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp; |
|
280 | + $trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp; |
|
281 | 281 | $gotLock = false; |
282 | 282 | |
283 | 283 | while (!$gotLock) { |
@@ -293,12 +293,12 @@ discard block |
||
293 | 293 | |
294 | 294 | $timestamp = $timestamp + 1; |
295 | 295 | |
296 | - $trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp; |
|
296 | + $trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp; |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | 300 | /** @var \OC\Files\Storage\Storage $sourceStorage */ |
301 | - [$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/' . $ownerPath); |
|
301 | + [$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/'.$ownerPath); |
|
302 | 302 | |
303 | 303 | |
304 | 304 | if ($trashStorage->file_exists($trashInternalPath)) { |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | } |
307 | 307 | |
308 | 308 | $config = \OC::$server->getConfig(); |
309 | - $systemTrashbinSize = (int)$config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
310 | - $userTrashbinSize = (int)$config->getUserValue($owner, 'files_trashbin', 'trashbin_size', '-1'); |
|
309 | + $systemTrashbinSize = (int) $config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
310 | + $userTrashbinSize = (int) $config->getUserValue($owner, 'files_trashbin', 'trashbin_size', '-1'); |
|
311 | 311 | $configuredTrashbinSize = ($userTrashbinSize < 0) ? $systemTrashbinSize : $userTrashbinSize; |
312 | 312 | if ($configuredTrashbinSize >= 0 && $sourceStorage->filesize($sourceInternalPath) >= $configuredTrashbinSize) { |
313 | 313 | return false; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | if ($trashStorage->file_exists($trashInternalPath)) { |
328 | 328 | $trashStorage->unlink($trashInternalPath); |
329 | 329 | } |
330 | - \OC::$server->getLogger()->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']); |
|
330 | + \OC::$server->getLogger()->error('Couldn\'t move '.$file_path.' to the trash bin', ['app' => 'files_trashbin']); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | \OC::$server->getLogger()->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']); |
359 | 359 | } |
360 | 360 | \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path), |
361 | - 'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)]); |
|
361 | + 'trashPath' => Filesystem::normalizePath($filename.'.d'.$timestamp)]); |
|
362 | 362 | |
363 | 363 | self::retainVersions($filename, $owner, $ownerPath, $timestamp); |
364 | 364 | |
@@ -393,17 +393,17 @@ discard block |
||
393 | 393 | $user = User::getUser(); |
394 | 394 | $rootView = new View('/'); |
395 | 395 | |
396 | - if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) { |
|
396 | + if ($rootView->is_dir($owner.'/files_versions/'.$ownerPath)) { |
|
397 | 397 | if ($owner !== $user) { |
398 | - self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp, $rootView); |
|
398 | + self::copy_recursive($owner.'/files_versions/'.$ownerPath, $owner.'/files_trashbin/versions/'.basename($ownerPath).'.d'.$timestamp, $rootView); |
|
399 | 399 | } |
400 | - self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp); |
|
400 | + self::move($rootView, $owner.'/files_versions/'.$ownerPath, $user.'/files_trashbin/versions/'.$filename.'.d'.$timestamp); |
|
401 | 401 | } elseif ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) { |
402 | 402 | foreach ($versions as $v) { |
403 | 403 | if ($owner !== $user) { |
404 | - self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . $v['name'] . '.v' . $v['version'] . '.d' . $timestamp); |
|
404 | + self::copy($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $owner.'/files_trashbin/versions/'.$v['name'].'.v'.$v['version'].'.d'.$timestamp); |
|
405 | 405 | } |
406 | - self::move($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $user . '/files_trashbin/versions/' . $filename . '.v' . $v['version'] . '.d' . $timestamp); |
|
406 | + self::move($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $user.'/files_trashbin/versions/'.$filename.'.v'.$v['version'].'.d'.$timestamp); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | } |
@@ -465,18 +465,18 @@ discard block |
||
465 | 465 | */ |
466 | 466 | public static function restore($file, $filename, $timestamp) { |
467 | 467 | $user = User::getUser(); |
468 | - $view = new View('/' . $user); |
|
468 | + $view = new View('/'.$user); |
|
469 | 469 | |
470 | 470 | $location = ''; |
471 | 471 | if ($timestamp) { |
472 | 472 | $location = self::getLocation($user, $filename, $timestamp); |
473 | 473 | if ($location === false) { |
474 | - \OC::$server->getLogger()->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']); |
|
474 | + \OC::$server->getLogger()->error('trash bin database inconsistent! ($user: '.$user.' $filename: '.$filename.', $timestamp: '.$timestamp.')', ['app' => 'files_trashbin']); |
|
475 | 475 | } else { |
476 | 476 | // if location no longer exists, restore file in the root directory |
477 | 477 | if ($location !== '/' && |
478 | - (!$view->is_dir('files/' . $location) || |
|
479 | - !$view->isCreatable('files/' . $location)) |
|
478 | + (!$view->is_dir('files/'.$location) || |
|
479 | + !$view->isCreatable('files/'.$location)) |
|
480 | 480 | ) { |
481 | 481 | $location = ''; |
482 | 482 | } |
@@ -486,8 +486,8 @@ discard block |
||
486 | 486 | // we need a extension in case a file/dir with the same name already exists |
487 | 487 | $uniqueFilename = self::getUniqueFilename($location, $filename, $view); |
488 | 488 | |
489 | - $source = Filesystem::normalizePath('files_trashbin/files/' . $file); |
|
490 | - $target = Filesystem::normalizePath('files/' . $location . '/' . $uniqueFilename); |
|
489 | + $source = Filesystem::normalizePath('files_trashbin/files/'.$file); |
|
490 | + $target = Filesystem::normalizePath('files/'.$location.'/'.$uniqueFilename); |
|
491 | 491 | if (!$view->file_exists($source)) { |
492 | 492 | return false; |
493 | 493 | } |
@@ -502,10 +502,10 @@ discard block |
||
502 | 502 | // handle the restore result |
503 | 503 | if ($restoreResult) { |
504 | 504 | $fakeRoot = $view->getRoot(); |
505 | - $view->chroot('/' . $user . '/files'); |
|
506 | - $view->touch('/' . $location . '/' . $uniqueFilename, $mtime); |
|
505 | + $view->chroot('/'.$user.'/files'); |
|
506 | + $view->touch('/'.$location.'/'.$uniqueFilename, $mtime); |
|
507 | 507 | $view->chroot($fakeRoot); |
508 | - \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename), |
|
508 | + \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename), |
|
509 | 509 | 'trashPath' => Filesystem::normalizePath($file)]); |
510 | 510 | |
511 | 511 | self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp); |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | $user = User::getUser(); |
542 | 542 | $rootView = new View('/'); |
543 | 543 | |
544 | - $target = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename); |
|
544 | + $target = Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename); |
|
545 | 545 | |
546 | 546 | [$owner, $ownerPath] = self::getUidAndFilename($target); |
547 | 547 | |
@@ -556,14 +556,14 @@ discard block |
||
556 | 556 | $versionedFile = $file; |
557 | 557 | } |
558 | 558 | |
559 | - if ($view->is_dir('/files_trashbin/versions/' . $file)) { |
|
560 | - $rootView->rename(Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath)); |
|
559 | + if ($view->is_dir('/files_trashbin/versions/'.$file)) { |
|
560 | + $rootView->rename(Filesystem::normalizePath($user.'/files_trashbin/versions/'.$file), Filesystem::normalizePath($owner.'/files_versions/'.$ownerPath)); |
|
561 | 561 | } elseif ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) { |
562 | 562 | foreach ($versions as $v) { |
563 | 563 | if ($timestamp) { |
564 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
564 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
565 | 565 | } else { |
566 | - $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v, $owner . '/files_versions/' . $ownerPath . '.v' . $v); |
|
566 | + $rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v, $owner.'/files_versions/'.$ownerPath.'.v'.$v); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | public static function deleteAll() { |
577 | 577 | $user = User::getUser(); |
578 | 578 | $userRoot = \OC::$server->getUserFolder($user)->getParent(); |
579 | - $view = new View('/' . $user); |
|
579 | + $view = new View('/'.$user); |
|
580 | 580 | $fileInfos = $view->getDirectoryContent('files_trashbin/files'); |
581 | 581 | |
582 | 582 | try { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | */ |
652 | 652 | public static function delete($filename, $user, $timestamp = null) { |
653 | 653 | $userRoot = \OC::$server->getUserFolder($user)->getParent(); |
654 | - $view = new View('/' . $user); |
|
654 | + $view = new View('/'.$user); |
|
655 | 655 | $size = 0; |
656 | 656 | |
657 | 657 | if ($timestamp) { |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | ->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp))); |
663 | 663 | $query->executeStatement(); |
664 | 664 | |
665 | - $file = $filename . '.d' . $timestamp; |
|
665 | + $file = $filename.'.d'.$timestamp; |
|
666 | 666 | } else { |
667 | 667 | $file = $filename; |
668 | 668 | } |
@@ -670,20 +670,20 @@ discard block |
||
670 | 670 | $size += self::deleteVersions($view, $file, $filename, $timestamp, $user); |
671 | 671 | |
672 | 672 | try { |
673 | - $node = $userRoot->get('/files_trashbin/files/' . $file); |
|
673 | + $node = $userRoot->get('/files_trashbin/files/'.$file); |
|
674 | 674 | } catch (NotFoundException $e) { |
675 | 675 | return $size; |
676 | 676 | } |
677 | 677 | |
678 | 678 | if ($node instanceof Folder) { |
679 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file)); |
|
679 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/files/'.$file)); |
|
680 | 680 | } elseif ($node instanceof File) { |
681 | - $size += $view->filesize('/files_trashbin/files/' . $file); |
|
681 | + $size += $view->filesize('/files_trashbin/files/'.$file); |
|
682 | 682 | } |
683 | 683 | |
684 | - self::emitTrashbinPreDelete('/files_trashbin/files/' . $file); |
|
684 | + self::emitTrashbinPreDelete('/files_trashbin/files/'.$file); |
|
685 | 685 | $node->delete(); |
686 | - self::emitTrashbinPostDelete('/files_trashbin/files/' . $file); |
|
686 | + self::emitTrashbinPostDelete('/files_trashbin/files/'.$file); |
|
687 | 687 | |
688 | 688 | return $size; |
689 | 689 | } |
@@ -699,17 +699,17 @@ discard block |
||
699 | 699 | private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) { |
700 | 700 | $size = 0; |
701 | 701 | if (\OCP\App::isEnabled('files_versions')) { |
702 | - if ($view->is_dir('files_trashbin/versions/' . $file)) { |
|
703 | - $size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file)); |
|
704 | - $view->unlink('files_trashbin/versions/' . $file); |
|
702 | + if ($view->is_dir('files_trashbin/versions/'.$file)) { |
|
703 | + $size += self::calculateSize(new View('/'.$user.'/files_trashbin/versions/'.$file)); |
|
704 | + $view->unlink('files_trashbin/versions/'.$file); |
|
705 | 705 | } elseif ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) { |
706 | 706 | foreach ($versions as $v) { |
707 | 707 | if ($timestamp) { |
708 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
709 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); |
|
708 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
709 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); |
|
710 | 710 | } else { |
711 | - $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
712 | - $view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v); |
|
711 | + $size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
712 | + $view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v); |
|
713 | 713 | } |
714 | 714 | } |
715 | 715 | } |
@@ -726,13 +726,13 @@ discard block |
||
726 | 726 | */ |
727 | 727 | public static function file_exists($filename, $timestamp = null) { |
728 | 728 | $user = User::getUser(); |
729 | - $view = new View('/' . $user); |
|
729 | + $view = new View('/'.$user); |
|
730 | 730 | |
731 | 731 | if ($timestamp) { |
732 | - $filename = $filename . '.d' . $timestamp; |
|
732 | + $filename = $filename.'.d'.$timestamp; |
|
733 | 733 | } |
734 | 734 | |
735 | - $target = Filesystem::normalizePath('files_trashbin/files/' . $filename); |
|
735 | + $target = Filesystem::normalizePath('files_trashbin/files/'.$filename); |
|
736 | 736 | return $view->file_exists($target); |
737 | 737 | } |
738 | 738 | |
@@ -758,11 +758,11 @@ discard block |
||
758 | 758 | */ |
759 | 759 | private static function calculateFreeSpace($trashbinSize, $user) { |
760 | 760 | $config = \OC::$server->getConfig(); |
761 | - $userTrashbinSize = (int)$config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1'); |
|
761 | + $userTrashbinSize = (int) $config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1'); |
|
762 | 762 | if ($userTrashbinSize > -1) { |
763 | 763 | return $userTrashbinSize - $trashbinSize; |
764 | 764 | } |
765 | - $systemTrashbinSize = (int)$config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
765 | + $systemTrashbinSize = (int) $config->getAppValue('files_trashbin', 'trashbin_size', '-1'); |
|
766 | 766 | if ($systemTrashbinSize > -1) { |
767 | 767 | return $systemTrashbinSize - $trashbinSize; |
768 | 768 | } |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | foreach ($files as $file) { |
872 | 872 | if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) { |
873 | 873 | $tmp = self::delete($file['name'], $user, $file['mtime']); |
874 | - \OC::$server->getLogger()->info('remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']); |
|
874 | + \OC::$server->getLogger()->info('remove "'.$file['name'].'" ('.$tmp.'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']); |
|
875 | 875 | $availableSpace += $tmp; |
876 | 876 | $size += $tmp; |
877 | 877 | } else { |
@@ -902,10 +902,10 @@ discard block |
||
902 | 902 | $size += self::delete($filename, $user, $timestamp); |
903 | 903 | $count++; |
904 | 904 | } catch (\OCP\Files\NotPermittedException $e) { |
905 | - \OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "' . $filename . '" from trashbin failed.']); |
|
905 | + \OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "'.$filename.'" from trashbin failed.']); |
|
906 | 906 | } |
907 | 907 | \OC::$server->getLogger()->info( |
908 | - 'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.', |
|
908 | + 'Remove "'.$filename.'" from trashbin because it exceeds max retention obligation term.', |
|
909 | 909 | ['app' => 'files_trashbin'] |
910 | 910 | ); |
911 | 911 | } else { |
@@ -931,16 +931,16 @@ discard block |
||
931 | 931 | $view->mkdir($destination); |
932 | 932 | $view->touch($destination, $view->filemtime($source)); |
933 | 933 | foreach ($view->getDirectoryContent($source) as $i) { |
934 | - $pathDir = $source . '/' . $i['name']; |
|
934 | + $pathDir = $source.'/'.$i['name']; |
|
935 | 935 | if ($view->is_dir($pathDir)) { |
936 | - $size += self::copy_recursive($pathDir, $destination . '/' . $i['name'], $view); |
|
936 | + $size += self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view); |
|
937 | 937 | } else { |
938 | 938 | $size += $view->filesize($pathDir); |
939 | - $result = $view->copy($pathDir, $destination . '/' . $i['name']); |
|
939 | + $result = $view->copy($pathDir, $destination.'/'.$i['name']); |
|
940 | 940 | if (!$result) { |
941 | 941 | throw new \OCA\Files_Trashbin\Exceptions\CopyRecursiveException(); |
942 | 942 | } |
943 | - $view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir)); |
|
943 | + $view->touch($destination.'/'.$i['name'], $view->filemtime($pathDir)); |
|
944 | 944 | } |
945 | 945 | } |
946 | 946 | } else { |
@@ -962,11 +962,11 @@ discard block |
||
962 | 962 | * @return array |
963 | 963 | */ |
964 | 964 | private static function getVersionsFromTrash($filename, $timestamp, $user) { |
965 | - $view = new View('/' . $user . '/files_trashbin/versions'); |
|
965 | + $view = new View('/'.$user.'/files_trashbin/versions'); |
|
966 | 966 | $versions = []; |
967 | 967 | |
968 | 968 | /** @var \OC\Files\Storage\Storage $storage */ |
969 | - [$storage,] = $view->resolvePath('/'); |
|
969 | + [$storage, ] = $view->resolvePath('/'); |
|
970 | 970 | |
971 | 971 | //force rescan of versions, local storage may not have updated the cache |
972 | 972 | if (!self::$scannedVersions) { |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | if ($timestamp) { |
979 | 979 | // fetch for old versions |
980 | 980 | $escapedTimestamp = \OC::$server->getDatabaseConnection()->escapeLikeParameter($timestamp); |
981 | - $pattern .= '.v%.d' . $escapedTimestamp; |
|
981 | + $pattern .= '.v%.d'.$escapedTimestamp; |
|
982 | 982 | $offset = -strlen($escapedTimestamp) - 2; |
983 | 983 | } else { |
984 | 984 | $pattern .= '.v%'; |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | \OC::$server->getLogger(), |
993 | 993 | $cache |
994 | 994 | ); |
995 | - $normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'. $filename)), '/'); |
|
995 | + $normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'.$filename)), '/'); |
|
996 | 996 | $parentId = $cache->getId($normalizedParentPath); |
997 | 997 | if ($parentId === -1) { |
998 | 998 | return []; |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | $result->closeCursor(); |
1009 | 1009 | |
1010 | 1010 | /** @var CacheEntry[] $matches */ |
1011 | - $matches = array_map(function (array $data) { |
|
1011 | + $matches = array_map(function(array $data) { |
|
1012 | 1012 | return Cache::cacheEntryFromData($data, \OC::$server->getMimeTypeLoader()); |
1013 | 1013 | }, $entries); |
1014 | 1014 | |
@@ -1038,18 +1038,18 @@ discard block |
||
1038 | 1038 | $name = pathinfo($filename, PATHINFO_FILENAME); |
1039 | 1039 | $l = \OC::$server->getL10N('files_trashbin'); |
1040 | 1040 | |
1041 | - $location = '/' . trim($location, '/'); |
|
1041 | + $location = '/'.trim($location, '/'); |
|
1042 | 1042 | |
1043 | 1043 | // if extension is not empty we set a dot in front of it |
1044 | 1044 | if ($ext !== '') { |
1045 | - $ext = '.' . $ext; |
|
1045 | + $ext = '.'.$ext; |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | - if ($view->file_exists('files' . $location . '/' . $filename)) { |
|
1048 | + if ($view->file_exists('files'.$location.'/'.$filename)) { |
|
1049 | 1049 | $i = 2; |
1050 | - $uniqueName = $name . " (" . $l->t("restored") . ")" . $ext; |
|
1051 | - while ($view->file_exists('files' . $location . '/' . $uniqueName)) { |
|
1052 | - $uniqueName = $name . " (" . $l->t("restored") . " " . $i . ")" . $ext; |
|
1050 | + $uniqueName = $name." (".$l->t("restored").")".$ext; |
|
1051 | + while ($view->file_exists('files'.$location.'/'.$uniqueName)) { |
|
1052 | + $uniqueName = $name." (".$l->t("restored")." ".$i.")".$ext; |
|
1053 | 1053 | $i++; |
1054 | 1054 | } |
1055 | 1055 | |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | * @return integer size of the folder |
1067 | 1067 | */ |
1068 | 1068 | private static function calculateSize($view) { |
1069 | - $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . $view->getAbsolutePath(''); |
|
1069 | + $root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').$view->getAbsolutePath(''); |
|
1070 | 1070 | if (!file_exists($root)) { |
1071 | 1071 | return 0; |
1072 | 1072 | } |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | * @return integer trash bin size |
1098 | 1098 | */ |
1099 | 1099 | private static function getTrashbinSize($user) { |
1100 | - $view = new View('/' . $user); |
|
1100 | + $view = new View('/'.$user); |
|
1101 | 1101 | $fileInfo = $view->getFileInfo('/files_trashbin'); |
1102 | 1102 | return isset($fileInfo['size']) ? $fileInfo['size'] : 0; |
1103 | 1103 | } |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | * @return bool |
1110 | 1110 | */ |
1111 | 1111 | public static function isEmpty($user) { |
1112 | - $view = new View('/' . $user . '/files_trashbin'); |
|
1112 | + $view = new View('/'.$user.'/files_trashbin'); |
|
1113 | 1113 | if ($view->is_dir('/files') && $dh = $view->opendir('/files')) { |
1114 | 1114 | while ($file = readdir($dh)) { |
1115 | 1115 | if (!Filesystem::isIgnoredDir($file)) { |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | $password = $passwordEvent->getPassword(); |
223 | 223 | if ($password === null) { |
224 | - $password = $this->secureRandom->generate(8, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS); |
|
224 | + $password = $this->secureRandom->generate(8, ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | return $password; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $text = $this->l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]); |
394 | 394 | |
395 | 395 | $emailTemplate->addBodyText( |
396 | - htmlspecialchars($text . ' ' . $this->l->t('Click the button below to open it.')), |
|
396 | + htmlspecialchars($text.' '.$this->l->t('Click the button below to open it.')), |
|
397 | 397 | $text |
398 | 398 | ); |
399 | 399 | $emailTemplate->addBodyButton( |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $initiatorEmail = $initiatorUser->getEMailAddress(); |
423 | 423 | if ($this->settingsManager->replyToInitiator() && $initiatorEmail !== null) { |
424 | 424 | $message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); |
425 | - $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')); |
|
425 | + $emailTemplate->addFooter($instanceName.($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : '')); |
|
426 | 426 | } else { |
427 | 427 | $emailTemplate->addFooter(); |
428 | 428 | } |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]); |
487 | 487 | if ($this->settingsManager->replyToInitiator() && $initiatorEmailAddress !== null) { |
488 | 488 | $message->setReplyTo([$initiatorEmailAddress => $initiatorDisplayName]); |
489 | - $emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan()); |
|
489 | + $emailTemplate->addFooter($instanceName.' - '.$this->defaults->getSlogan()); |
|
490 | 490 | } else { |
491 | 491 | $emailTemplate->addFooter(); |
492 | 492 | } |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]); |
547 | 547 | if ($this->settingsManager->replyToInitiator() && $initiatorEmailAddress !== null) { |
548 | 548 | $message->setReplyTo([$initiatorEmailAddress => $initiatorDisplayName]); |
549 | - $emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan()); |
|
549 | + $emailTemplate->addFooter($instanceName.' - '.$this->defaults->getSlogan()); |
|
550 | 550 | } else { |
551 | 551 | $emailTemplate->addFooter(); |
552 | 552 | } |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | ->setValue('password', $qb->createNamedParameter($password)) |
684 | 684 | ->setValue('password_by_talk', $qb->createNamedParameter($sendPasswordByTalk, IQueryBuilder::PARAM_BOOL)) |
685 | 685 | ->setValue('stime', $qb->createNamedParameter(time())) |
686 | - ->setValue('hide_download', $qb->createNamedParameter((int)$hideDownload, IQueryBuilder::PARAM_INT)) |
|
686 | + ->setValue('hide_download', $qb->createNamedParameter((int) $hideDownload, IQueryBuilder::PARAM_INT)) |
|
687 | 687 | ->setValue('label', $qb->createNamedParameter($label)); |
688 | 688 | |
689 | 689 | if ($expirationTime !== null) { |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | ->set('password_by_talk', $qb->createNamedParameter($share->getSendPasswordByTalk(), IQueryBuilder::PARAM_BOOL)) |
732 | 732 | ->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE)) |
733 | 733 | ->set('note', $qb->createNamedParameter($share->getNote())) |
734 | - ->set('hide_download', $qb->createNamedParameter((int)$share->getHideDownload(), IQueryBuilder::PARAM_INT)) |
|
734 | + ->set('hide_download', $qb->createNamedParameter((int) $share->getHideDownload(), IQueryBuilder::PARAM_INT)) |
|
735 | 735 | ->executeStatement(); |
736 | 736 | |
737 | 737 | if ($originalShare->getNote() !== $share->getNote() && $share->getNote() !== '') { |
@@ -977,22 +977,22 @@ discard block |
||
977 | 977 | */ |
978 | 978 | protected function createShareObject($data) { |
979 | 979 | $share = new Share($this->rootFolder, $this->userManager); |
980 | - $share->setId((int)$data['id']) |
|
981 | - ->setShareType((int)$data['share_type']) |
|
982 | - ->setPermissions((int)$data['permissions']) |
|
980 | + $share->setId((int) $data['id']) |
|
981 | + ->setShareType((int) $data['share_type']) |
|
982 | + ->setPermissions((int) $data['permissions']) |
|
983 | 983 | ->setTarget($data['file_target']) |
984 | - ->setMailSend((bool)$data['mail_send']) |
|
984 | + ->setMailSend((bool) $data['mail_send']) |
|
985 | 985 | ->setNote($data['note']) |
986 | 986 | ->setToken($data['token']); |
987 | 987 | |
988 | 988 | $shareTime = new \DateTime(); |
989 | - $shareTime->setTimestamp((int)$data['stime']); |
|
989 | + $shareTime->setTimestamp((int) $data['stime']); |
|
990 | 990 | $share->setShareTime($shareTime); |
991 | 991 | $share->setSharedWith($data['share_with']); |
992 | 992 | $share->setPassword($data['password']); |
993 | 993 | $share->setLabel($data['label']); |
994 | - $share->setSendPasswordByTalk((bool)$data['password_by_talk']); |
|
995 | - $share->setHideDownload((bool)$data['hide_download']); |
|
994 | + $share->setSendPasswordByTalk((bool) $data['password_by_talk']); |
|
995 | + $share->setHideDownload((bool) $data['hide_download']); |
|
996 | 996 | |
997 | 997 | if ($data['uid_initiator'] !== null) { |
998 | 998 | $share->setShareOwner($data['uid_owner']); |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | } else { |
1001 | 1001 | //OLD SHARE |
1002 | 1002 | $share->setSharedBy($data['uid_owner']); |
1003 | - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); |
|
1003 | + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); |
|
1004 | 1004 | |
1005 | 1005 | $owner = $path->getOwner(); |
1006 | 1006 | $share->setShareOwner($owner->getUID()); |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | } |
1014 | 1014 | } |
1015 | 1015 | |
1016 | - $share->setNodeId((int)$data['file_source']); |
|
1016 | + $share->setNodeId((int) $data['file_source']); |
|
1017 | 1017 | $share->setNodeType($data['item_type']); |
1018 | 1018 | |
1019 | 1019 | $share->setProviderId($this->identifier()); |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | ); |
1131 | 1131 | } |
1132 | 1132 | |
1133 | - $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
1133 | + $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
1134 | 1134 | $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); |
1135 | 1135 | |
1136 | 1136 | $qb->orderBy('id'); |