Completed
Push — master ( abd971...9e9f3b )
by
unknown
64:29 queued 25:08
created
apps/dav/tests/unit/CalDAV/Import/ImportServiceTest.php 2 patches
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -16,135 +16,135 @@
 block discarded – undo
16 16
 
17 17
 class ImportServiceTest extends \Test\TestCase {
18 18
 
19
-	private ImportService $service;
20
-	private CalendarImpl|MockObject $calendar;
21
-	private CalDavBackend|MockObject $backend;
22
-	private array $importResults = [];
23
-
24
-	protected function setUp(): void {
25
-		parent::setUp();
26
-
27
-		$this->backend = $this->createMock(CalDavBackend::class);
28
-		$this->service = new ImportService($this->backend);
29
-		$this->calendar = $this->createMock(CalendarImpl::class);
30
-
31
-	}
32
-
33
-	public function testImport(): void {
34
-		// Arrange
35
-		// construct calendar with a 1 hour event and same start/end time zones
36
-		$vCalendar = new VCalendar();
37
-		/** @var VEvent $vEvent */
38
-		$vEvent = $vCalendar->add('VEVENT', []);
39
-		$vEvent->UID->setValue('96a0e6b1-d886-4a55-a60d-152b31401dcc');
40
-		$vEvent->add('DTSTART', '20240701T080000', ['TZID' => 'America/Toronto']);
41
-		$vEvent->add('DTEND', '20240701T090000', ['TZID' => 'America/Toronto']);
42
-		$vEvent->add('SUMMARY', 'Test Recurrence Event');
43
-		$vEvent->add('ORGANIZER', 'mailto:[email protected]', ['CN' => 'Organizer']);
44
-		$vEvent->add('ATTENDEE', 'mailto:[email protected]', [
45
-			'CN' => 'Attendee One',
46
-			'CUTYPE' => 'INDIVIDUAL',
47
-			'PARTSTAT' => 'NEEDS-ACTION',
48
-			'ROLE' => 'REQ-PARTICIPANT',
49
-			'RSVP' => 'TRUE'
50
-		]);
51
-		// construct stream from mock calendar
52
-		$stream = fopen('php://memory', 'r+');
53
-		fwrite($stream, $vCalendar->serialize());
54
-		rewind($stream);
55
-		// construct import options
56
-		$options = new CalendarImportOptions();
57
-		$options->setFormat('ical');
58
-
59
-		// Mock calendar methods
60
-		$this->calendar->expects($this->once())
61
-			->method('getKey')
62
-			->willReturn('calendar-id-123');
63
-		$this->calendar->expects($this->once())
64
-			->method('getPrincipalUri')
65
-			->willReturn('principals/users/test-user');
66
-
67
-		// Mock backend methods
68
-		$this->backend->expects($this->once())
69
-			->method('getCalendarObjectByUID')
70
-			->with('principals/users/test-user', '96a0e6b1-d886-4a55-a60d-152b31401dcc')
71
-			->willReturn(null); // Object doesn't exist, so it will be created
72
-
73
-		$this->backend->expects($this->once())
74
-			->method('createCalendarObject')
75
-			->with(
76
-				'calendar-id-123',
77
-				$this->isType('string'), // Object ID (UUID)
78
-				$this->isType('string')  // Object data
79
-			);
80
-
81
-		// Act
82
-		$result = $this->service->import($stream, $this->calendar, $options);
83
-
84
-		// Assert
85
-		$this->assertIsArray($result);
86
-		$this->assertCount(1, $result, 'Import result should contain one item');
87
-		$this->assertArrayHasKey('96a0e6b1-d886-4a55-a60d-152b31401dcc', $result);
88
-		$this->assertEquals('created', $result['96a0e6b1-d886-4a55-a60d-152b31401dcc']['outcome']);
89
-	}
90
-
91
-	public function testImportWithMultiLineUID(): void {
92
-		// Arrange
93
-		// construct calendar with a 1 hour event and same start/end time zones
94
-		$vCalendar = new VCalendar();
95
-		/** @var VEvent $vEvent */
96
-		$vEvent = $vCalendar->add('VEVENT', []);
97
-		$vEvent->UID->setValue('040000008200E00074C5B7101A82E00800000000000000000000000000000000000000004D0000004D14C68E6D285940B19A7D3D1DC1F8D23230323130363137743133333234387A2D383733323234373636303740666538303A303A303A303A33643A623066663A666533643A65383830656E7335');
98
-		$vEvent->add('DTSTART', '20240701T080000', ['TZID' => 'America/Toronto']);
99
-		$vEvent->add('DTEND', '20240701T090000', ['TZID' => 'America/Toronto']);
100
-		$vEvent->add('SUMMARY', 'Test Recurrence Event');
101
-		$vEvent->add('ORGANIZER', 'mailto:[email protected]', ['CN' => 'Organizer']);
102
-		$vEvent->add('ATTENDEE', 'mailto:[email protected]', [
103
-			'CN' => 'Attendee One',
104
-			'CUTYPE' => 'INDIVIDUAL',
105
-			'PARTSTAT' => 'NEEDS-ACTION',
106
-			'ROLE' => 'REQ-PARTICIPANT',
107
-			'RSVP' => 'TRUE'
108
-		]);
109
-		// construct stream from mock calendar
110
-		$stream = fopen('php://memory', 'r+');
111
-		fwrite($stream, $vCalendar->serialize());
112
-		rewind($stream);
113
-		// construct import options
114
-		$options = new CalendarImportOptions();
115
-		$options->setFormat('ical');
116
-
117
-		$longUID = '040000008200E00074C5B7101A82E00800000000000000000000000000000000000000004D0000004D14C68E6D285940B19A7D3D1DC1F8D23230323130363137743133333234387A2D383733323234373636303740666538303A303A303A303A33643A623066663A666533643A65383830656E7335';
118
-
119
-		// Mock calendar methods
120
-		$this->calendar->expects($this->once())
121
-			->method('getKey')
122
-			->willReturn('calendar-id-123');
123
-		$this->calendar->expects($this->once())
124
-			->method('getPrincipalUri')
125
-			->willReturn('principals/users/test-user');
126
-
127
-		// Mock backend methods
128
-		$this->backend->expects($this->once())
129
-			->method('getCalendarObjectByUID')
130
-			->with('principals/users/test-user', $longUID)
131
-			->willReturn(null); // Object doesn't exist, so it will be created
132
-
133
-		$this->backend->expects($this->once())
134
-			->method('createCalendarObject')
135
-			->with(
136
-				'calendar-id-123',
137
-				$this->isType('string'), // Object ID (UUID)
138
-				$this->isType('string')  // Object data
139
-			);
140
-
141
-		// Act
142
-		$result = $this->service->import($stream, $this->calendar, $options);
143
-
144
-		// Assert
145
-		$this->assertIsArray($result);
146
-		$this->assertCount(1, $result, 'Import result should contain one item');
147
-		$this->assertArrayHasKey($longUID, $result);
148
-		$this->assertEquals('created', $result[$longUID]['outcome']);
149
-	}
19
+    private ImportService $service;
20
+    private CalendarImpl|MockObject $calendar;
21
+    private CalDavBackend|MockObject $backend;
22
+    private array $importResults = [];
23
+
24
+    protected function setUp(): void {
25
+        parent::setUp();
26
+
27
+        $this->backend = $this->createMock(CalDavBackend::class);
28
+        $this->service = new ImportService($this->backend);
29
+        $this->calendar = $this->createMock(CalendarImpl::class);
30
+
31
+    }
32
+
33
+    public function testImport(): void {
34
+        // Arrange
35
+        // construct calendar with a 1 hour event and same start/end time zones
36
+        $vCalendar = new VCalendar();
37
+        /** @var VEvent $vEvent */
38
+        $vEvent = $vCalendar->add('VEVENT', []);
39
+        $vEvent->UID->setValue('96a0e6b1-d886-4a55-a60d-152b31401dcc');
40
+        $vEvent->add('DTSTART', '20240701T080000', ['TZID' => 'America/Toronto']);
41
+        $vEvent->add('DTEND', '20240701T090000', ['TZID' => 'America/Toronto']);
42
+        $vEvent->add('SUMMARY', 'Test Recurrence Event');
43
+        $vEvent->add('ORGANIZER', 'mailto:[email protected]', ['CN' => 'Organizer']);
44
+        $vEvent->add('ATTENDEE', 'mailto:[email protected]', [
45
+            'CN' => 'Attendee One',
46
+            'CUTYPE' => 'INDIVIDUAL',
47
+            'PARTSTAT' => 'NEEDS-ACTION',
48
+            'ROLE' => 'REQ-PARTICIPANT',
49
+            'RSVP' => 'TRUE'
50
+        ]);
51
+        // construct stream from mock calendar
52
+        $stream = fopen('php://memory', 'r+');
53
+        fwrite($stream, $vCalendar->serialize());
54
+        rewind($stream);
55
+        // construct import options
56
+        $options = new CalendarImportOptions();
57
+        $options->setFormat('ical');
58
+
59
+        // Mock calendar methods
60
+        $this->calendar->expects($this->once())
61
+            ->method('getKey')
62
+            ->willReturn('calendar-id-123');
63
+        $this->calendar->expects($this->once())
64
+            ->method('getPrincipalUri')
65
+            ->willReturn('principals/users/test-user');
66
+
67
+        // Mock backend methods
68
+        $this->backend->expects($this->once())
69
+            ->method('getCalendarObjectByUID')
70
+            ->with('principals/users/test-user', '96a0e6b1-d886-4a55-a60d-152b31401dcc')
71
+            ->willReturn(null); // Object doesn't exist, so it will be created
72
+
73
+        $this->backend->expects($this->once())
74
+            ->method('createCalendarObject')
75
+            ->with(
76
+                'calendar-id-123',
77
+                $this->isType('string'), // Object ID (UUID)
78
+                $this->isType('string')  // Object data
79
+            );
80
+
81
+        // Act
82
+        $result = $this->service->import($stream, $this->calendar, $options);
83
+
84
+        // Assert
85
+        $this->assertIsArray($result);
86
+        $this->assertCount(1, $result, 'Import result should contain one item');
87
+        $this->assertArrayHasKey('96a0e6b1-d886-4a55-a60d-152b31401dcc', $result);
88
+        $this->assertEquals('created', $result['96a0e6b1-d886-4a55-a60d-152b31401dcc']['outcome']);
89
+    }
90
+
91
+    public function testImportWithMultiLineUID(): void {
92
+        // Arrange
93
+        // construct calendar with a 1 hour event and same start/end time zones
94
+        $vCalendar = new VCalendar();
95
+        /** @var VEvent $vEvent */
96
+        $vEvent = $vCalendar->add('VEVENT', []);
97
+        $vEvent->UID->setValue('040000008200E00074C5B7101A82E00800000000000000000000000000000000000000004D0000004D14C68E6D285940B19A7D3D1DC1F8D23230323130363137743133333234387A2D383733323234373636303740666538303A303A303A303A33643A623066663A666533643A65383830656E7335');
98
+        $vEvent->add('DTSTART', '20240701T080000', ['TZID' => 'America/Toronto']);
99
+        $vEvent->add('DTEND', '20240701T090000', ['TZID' => 'America/Toronto']);
100
+        $vEvent->add('SUMMARY', 'Test Recurrence Event');
101
+        $vEvent->add('ORGANIZER', 'mailto:[email protected]', ['CN' => 'Organizer']);
102
+        $vEvent->add('ATTENDEE', 'mailto:[email protected]', [
103
+            'CN' => 'Attendee One',
104
+            'CUTYPE' => 'INDIVIDUAL',
105
+            'PARTSTAT' => 'NEEDS-ACTION',
106
+            'ROLE' => 'REQ-PARTICIPANT',
107
+            'RSVP' => 'TRUE'
108
+        ]);
109
+        // construct stream from mock calendar
110
+        $stream = fopen('php://memory', 'r+');
111
+        fwrite($stream, $vCalendar->serialize());
112
+        rewind($stream);
113
+        // construct import options
114
+        $options = new CalendarImportOptions();
115
+        $options->setFormat('ical');
116
+
117
+        $longUID = '040000008200E00074C5B7101A82E00800000000000000000000000000000000000000004D0000004D14C68E6D285940B19A7D3D1DC1F8D23230323130363137743133333234387A2D383733323234373636303740666538303A303A303A303A33643A623066663A666533643A65383830656E7335';
118
+
119
+        // Mock calendar methods
120
+        $this->calendar->expects($this->once())
121
+            ->method('getKey')
122
+            ->willReturn('calendar-id-123');
123
+        $this->calendar->expects($this->once())
124
+            ->method('getPrincipalUri')
125
+            ->willReturn('principals/users/test-user');
126
+
127
+        // Mock backend methods
128
+        $this->backend->expects($this->once())
129
+            ->method('getCalendarObjectByUID')
130
+            ->with('principals/users/test-user', $longUID)
131
+            ->willReturn(null); // Object doesn't exist, so it will be created
132
+
133
+        $this->backend->expects($this->once())
134
+            ->method('createCalendarObject')
135
+            ->with(
136
+                'calendar-id-123',
137
+                $this->isType('string'), // Object ID (UUID)
138
+                $this->isType('string')  // Object data
139
+            );
140
+
141
+        // Act
142
+        $result = $this->service->import($stream, $this->calendar, $options);
143
+
144
+        // Assert
145
+        $this->assertIsArray($result);
146
+        $this->assertCount(1, $result, 'Import result should contain one item');
147
+        $this->assertArrayHasKey($longUID, $result);
148
+        $this->assertEquals('created', $result[$longUID]['outcome']);
149
+    }
150 150
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@
 block discarded – undo
17 17
 class ImportServiceTest extends \Test\TestCase {
18 18
 
19 19
 	private ImportService $service;
20
-	private CalendarImpl|MockObject $calendar;
21
-	private CalDavBackend|MockObject $backend;
20
+	private CalendarImpl | MockObject $calendar;
21
+	private CalDavBackend | MockObject $backend;
22 22
 	private array $importResults = [];
23 23
 
24 24
 	protected function setUp(): void {
Please login to merge, or discard this patch.
apps/dav/composer/composer/autoload_static.php 1 patch
Spacing   +416 added lines, -416 removed lines patch added patch discarded remove patch
@@ -6,435 +6,435 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitDAV
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\DAV\\' => 8,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\DAV\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
25
-        'OCA\\DAV\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
26
-        'OCA\\DAV\\AppInfo\\PluginManager' => __DIR__ . '/..' . '/../lib/AppInfo/PluginManager.php',
27
-        'OCA\\DAV\\Avatars\\AvatarHome' => __DIR__ . '/..' . '/../lib/Avatars/AvatarHome.php',
28
-        'OCA\\DAV\\Avatars\\AvatarNode' => __DIR__ . '/..' . '/../lib/Avatars/AvatarNode.php',
29
-        'OCA\\DAV\\Avatars\\RootCollection' => __DIR__ . '/..' . '/../lib/Avatars/RootCollection.php',
30
-        'OCA\\DAV\\BackgroundJob\\BuildReminderIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/BuildReminderIndexBackgroundJob.php',
31
-        'OCA\\DAV\\BackgroundJob\\CalendarRetentionJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/CalendarRetentionJob.php',
32
-        'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupDirectLinksJob.php',
33
-        'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupInvitationTokenJob.php',
34
-        'OCA\\DAV\\BackgroundJob\\CleanupOrphanedChildrenJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupOrphanedChildrenJob.php',
35
-        'OCA\\DAV\\BackgroundJob\\DeleteOutdatedSchedulingObjects' => __DIR__ . '/..' . '/../lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php',
36
-        'OCA\\DAV\\BackgroundJob\\EventReminderJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/EventReminderJob.php',
37
-        'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php',
38
-        'OCA\\DAV\\BackgroundJob\\OutOfOfficeEventDispatcherJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php',
39
-        'OCA\\DAV\\BackgroundJob\\PruneOutdatedSyncTokensJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/PruneOutdatedSyncTokensJob.php',
40
-        'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/RefreshWebcalJob.php',
41
-        'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => __DIR__ . '/..' . '/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php',
42
-        'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php',
43
-        'OCA\\DAV\\BackgroundJob\\UploadCleanup' => __DIR__ . '/..' . '/../lib/BackgroundJob/UploadCleanup.php',
44
-        'OCA\\DAV\\BackgroundJob\\UserStatusAutomation' => __DIR__ . '/..' . '/../lib/BackgroundJob/UserStatusAutomation.php',
45
-        'OCA\\DAV\\BulkUpload\\BulkUploadPlugin' => __DIR__ . '/..' . '/../lib/BulkUpload/BulkUploadPlugin.php',
46
-        'OCA\\DAV\\BulkUpload\\MultipartRequestParser' => __DIR__ . '/..' . '/../lib/BulkUpload/MultipartRequestParser.php',
47
-        'OCA\\DAV\\CalDAV\\Activity\\Backend' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Backend.php',
48
-        'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Filter/Calendar.php',
49
-        'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Filter/Todo.php',
50
-        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Base.php',
51
-        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Calendar.php',
52
-        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Event.php',
53
-        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Todo.php',
54
-        'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/CalDAVSetting.php',
55
-        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Calendar.php',
56
-        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Event.php',
57
-        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Todo.php',
58
-        'OCA\\DAV\\CalDAV\\AppCalendar\\AppCalendar' => __DIR__ . '/..' . '/../lib/CalDAV/AppCalendar/AppCalendar.php',
59
-        'OCA\\DAV\\CalDAV\\AppCalendar\\AppCalendarPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/AppCalendar/AppCalendarPlugin.php',
60
-        'OCA\\DAV\\CalDAV\\AppCalendar\\CalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/AppCalendar/CalendarObject.php',
61
-        'OCA\\DAV\\CalDAV\\Auth\\CustomPrincipalPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Auth/CustomPrincipalPlugin.php',
62
-        'OCA\\DAV\\CalDAV\\Auth\\PublicPrincipalPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Auth/PublicPrincipalPlugin.php',
63
-        'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => __DIR__ . '/..' . '/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php',
64
-        'OCA\\DAV\\CalDAV\\BirthdayService' => __DIR__ . '/..' . '/../lib/CalDAV/BirthdayService.php',
65
-        'OCA\\DAV\\CalDAV\\CachedSubscription' => __DIR__ . '/..' . '/../lib/CalDAV/CachedSubscription.php',
66
-        'OCA\\DAV\\CalDAV\\CachedSubscriptionImpl' => __DIR__ . '/..' . '/../lib/CalDAV/CachedSubscriptionImpl.php',
67
-        'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => __DIR__ . '/..' . '/../lib/CalDAV/CachedSubscriptionObject.php',
68
-        'OCA\\DAV\\CalDAV\\CachedSubscriptionProvider' => __DIR__ . '/..' . '/../lib/CalDAV/CachedSubscriptionProvider.php',
69
-        'OCA\\DAV\\CalDAV\\CalDavBackend' => __DIR__ . '/..' . '/../lib/CalDAV/CalDavBackend.php',
70
-        'OCA\\DAV\\CalDAV\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Calendar.php',
71
-        'OCA\\DAV\\CalDAV\\CalendarHome' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarHome.php',
72
-        'OCA\\DAV\\CalDAV\\CalendarImpl' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarImpl.php',
73
-        'OCA\\DAV\\CalDAV\\CalendarManager' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarManager.php',
74
-        'OCA\\DAV\\CalDAV\\CalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarObject.php',
75
-        'OCA\\DAV\\CalDAV\\CalendarProvider' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarProvider.php',
76
-        'OCA\\DAV\\CalDAV\\CalendarRoot' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarRoot.php',
77
-        'OCA\\DAV\\CalDAV\\DefaultCalendarValidator' => __DIR__ . '/..' . '/../lib/CalDAV/DefaultCalendarValidator.php',
78
-        'OCA\\DAV\\CalDAV\\EmbeddedCalDavServer' => __DIR__ . '/..' . '/../lib/CalDAV/EmbeddedCalDavServer.php',
79
-        'OCA\\DAV\\CalDAV\\EventComparisonService' => __DIR__ . '/..' . '/../lib/CalDAV/EventComparisonService.php',
80
-        'OCA\\DAV\\CalDAV\\EventReader' => __DIR__ . '/..' . '/../lib/CalDAV/EventReader.php',
81
-        'OCA\\DAV\\CalDAV\\EventReaderRDate' => __DIR__ . '/..' . '/../lib/CalDAV/EventReaderRDate.php',
82
-        'OCA\\DAV\\CalDAV\\EventReaderRRule' => __DIR__ . '/..' . '/../lib/CalDAV/EventReaderRRule.php',
83
-        'OCA\\DAV\\CalDAV\\Export\\ExportService' => __DIR__ . '/..' . '/../lib/CalDAV/Export/ExportService.php',
84
-        'OCA\\DAV\\CalDAV\\FreeBusy\\FreeBusyGenerator' => __DIR__ . '/..' . '/../lib/CalDAV/FreeBusy/FreeBusyGenerator.php',
85
-        'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
86
-        'OCA\\DAV\\CalDAV\\IRestorable' => __DIR__ . '/..' . '/../lib/CalDAV/IRestorable.php',
87
-        'OCA\\DAV\\CalDAV\\Import\\ImportService' => __DIR__ . '/..' . '/../lib/CalDAV/Import/ImportService.php',
88
-        'OCA\\DAV\\CalDAV\\Import\\TextImporter' => __DIR__ . '/..' . '/../lib/CalDAV/Import/TextImporter.php',
89
-        'OCA\\DAV\\CalDAV\\Import\\XmlImporter' => __DIR__ . '/..' . '/../lib/CalDAV/Import/XmlImporter.php',
90
-        'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => __DIR__ . '/..' . '/../lib/CalDAV/Integration/ExternalCalendar.php',
91
-        'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Integration/ICalendarProvider.php',
92
-        'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => __DIR__ . '/..' . '/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php',
93
-        'OCA\\DAV\\CalDAV\\Outbox' => __DIR__ . '/..' . '/../lib/CalDAV/Outbox.php',
94
-        'OCA\\DAV\\CalDAV\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/Plugin.php',
95
-        'OCA\\DAV\\CalDAV\\Principal\\Collection' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/Collection.php',
96
-        'OCA\\DAV\\CalDAV\\Principal\\User' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/User.php',
97
-        'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => __DIR__ . '/..' . '/../lib/CalDAV/Proxy/Proxy.php',
98
-        'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => __DIR__ . '/..' . '/../lib/CalDAV/Proxy/ProxyMapper.php',
99
-        'OCA\\DAV\\CalDAV\\PublicCalendar' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendar.php',
100
-        'OCA\\DAV\\CalDAV\\PublicCalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendarObject.php',
101
-        'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendarRoot.php',
102
-        'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Publishing/PublishPlugin.php',
103
-        'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => __DIR__ . '/..' . '/../lib/CalDAV/Publishing/Xml/Publisher.php',
104
-        'OCA\\DAV\\CalDAV\\Reminder\\Backend' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/Backend.php',
105
-        'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/INotificationProvider.php',
106
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProviderManager.php',
107
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php',
108
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php',
109
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php',
110
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php',
111
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php',
112
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php',
113
-        'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/Notifier.php',
114
-        'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/ReminderService.php',
115
-        'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php',
116
-        'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php',
117
-        'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php',
118
-        'OCA\\DAV\\CalDAV\\RetentionService' => __DIR__ . '/..' . '/../lib/CalDAV/RetentionService.php',
119
-        'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Schedule/IMipPlugin.php',
120
-        'OCA\\DAV\\CalDAV\\Schedule\\IMipService' => __DIR__ . '/..' . '/../lib/CalDAV/Schedule/IMipService.php',
121
-        'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/Schedule/Plugin.php',
122
-        'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Search/SearchPlugin.php',
123
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/CompFilter.php',
124
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php',
125
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php',
126
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php',
127
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/PropFilter.php',
128
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php',
129
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php',
130
-        'OCA\\DAV\\CalDAV\\Security\\RateLimitingPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Security/RateLimitingPlugin.php',
131
-        'OCA\\DAV\\CalDAV\\Sharing\\Backend' => __DIR__ . '/..' . '/../lib/CalDAV/Sharing/Backend.php',
132
-        'OCA\\DAV\\CalDAV\\Sharing\\Service' => __DIR__ . '/..' . '/../lib/CalDAV/Sharing/Service.php',
133
-        'OCA\\DAV\\CalDAV\\Status\\StatusService' => __DIR__ . '/..' . '/../lib/CalDAV/Status/StatusService.php',
134
-        'OCA\\DAV\\CalDAV\\TimeZoneFactory' => __DIR__ . '/..' . '/../lib/CalDAV/TimeZoneFactory.php',
135
-        'OCA\\DAV\\CalDAV\\TimezoneService' => __DIR__ . '/..' . '/../lib/CalDAV/TimezoneService.php',
136
-        'OCA\\DAV\\CalDAV\\TipBroker' => __DIR__ . '/..' . '/../lib/CalDAV/TipBroker.php',
137
-        'OCA\\DAV\\CalDAV\\Trashbin\\DeletedCalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/Trashbin/DeletedCalendarObject.php',
138
-        'OCA\\DAV\\CalDAV\\Trashbin\\DeletedCalendarObjectsCollection' => __DIR__ . '/..' . '/../lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php',
139
-        'OCA\\DAV\\CalDAV\\Trashbin\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/Trashbin/Plugin.php',
140
-        'OCA\\DAV\\CalDAV\\Trashbin\\RestoreTarget' => __DIR__ . '/..' . '/../lib/CalDAV/Trashbin/RestoreTarget.php',
141
-        'OCA\\DAV\\CalDAV\\Trashbin\\TrashbinHome' => __DIR__ . '/..' . '/../lib/CalDAV/Trashbin/TrashbinHome.php',
142
-        'OCA\\DAV\\CalDAV\\UpcomingEvent' => __DIR__ . '/..' . '/../lib/CalDAV/UpcomingEvent.php',
143
-        'OCA\\DAV\\CalDAV\\UpcomingEventsService' => __DIR__ . '/..' . '/../lib/CalDAV/UpcomingEventsService.php',
144
-        'OCA\\DAV\\CalDAV\\Validation\\CalDavValidatePlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Validation/CalDavValidatePlugin.php',
145
-        'OCA\\DAV\\CalDAV\\WebcalCaching\\Connection' => __DIR__ . '/..' . '/../lib/CalDAV/WebcalCaching/Connection.php',
146
-        'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/WebcalCaching/Plugin.php',
147
-        'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => __DIR__ . '/..' . '/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php',
148
-        'OCA\\DAV\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php',
149
-        'OCA\\DAV\\CardDAV\\Activity\\Backend' => __DIR__ . '/..' . '/../lib/CardDAV/Activity/Backend.php',
150
-        'OCA\\DAV\\CardDAV\\Activity\\Filter' => __DIR__ . '/..' . '/../lib/CardDAV/Activity/Filter.php',
151
-        'OCA\\DAV\\CardDAV\\Activity\\Provider\\Addressbook' => __DIR__ . '/..' . '/../lib/CardDAV/Activity/Provider/Addressbook.php',
152
-        'OCA\\DAV\\CardDAV\\Activity\\Provider\\Base' => __DIR__ . '/..' . '/../lib/CardDAV/Activity/Provider/Base.php',
153
-        'OCA\\DAV\\CardDAV\\Activity\\Provider\\Card' => __DIR__ . '/..' . '/../lib/CardDAV/Activity/Provider/Card.php',
154
-        'OCA\\DAV\\CardDAV\\Activity\\Setting' => __DIR__ . '/..' . '/../lib/CardDAV/Activity/Setting.php',
155
-        'OCA\\DAV\\CardDAV\\AddressBook' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBook.php',
156
-        'OCA\\DAV\\CardDAV\\AddressBookImpl' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBookImpl.php',
157
-        'OCA\\DAV\\CardDAV\\AddressBookRoot' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBookRoot.php',
158
-        'OCA\\DAV\\CardDAV\\Card' => __DIR__ . '/..' . '/../lib/CardDAV/Card.php',
159
-        'OCA\\DAV\\CardDAV\\CardDavBackend' => __DIR__ . '/..' . '/../lib/CardDAV/CardDavBackend.php',
160
-        'OCA\\DAV\\CardDAV\\ContactsManager' => __DIR__ . '/..' . '/../lib/CardDAV/ContactsManager.php',
161
-        'OCA\\DAV\\CardDAV\\Converter' => __DIR__ . '/..' . '/../lib/CardDAV/Converter.php',
162
-        'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => __DIR__ . '/..' . '/../lib/CardDAV/HasPhotoPlugin.php',
163
-        'OCA\\DAV\\CardDAV\\ImageExportPlugin' => __DIR__ . '/..' . '/../lib/CardDAV/ImageExportPlugin.php',
164
-        'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => __DIR__ . '/..' . '/../lib/CardDAV/Integration/ExternalAddressBook.php',
165
-        'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => __DIR__ . '/..' . '/../lib/CardDAV/Integration/IAddressBookProvider.php',
166
-        'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => __DIR__ . '/..' . '/../lib/CardDAV/MultiGetExportPlugin.php',
167
-        'OCA\\DAV\\CardDAV\\PhotoCache' => __DIR__ . '/..' . '/../lib/CardDAV/PhotoCache.php',
168
-        'OCA\\DAV\\CardDAV\\Plugin' => __DIR__ . '/..' . '/../lib/CardDAV/Plugin.php',
169
-        'OCA\\DAV\\CardDAV\\Security\\CardDavRateLimitingPlugin' => __DIR__ . '/..' . '/../lib/CardDAV/Security/CardDavRateLimitingPlugin.php',
170
-        'OCA\\DAV\\CardDAV\\Sharing\\Backend' => __DIR__ . '/..' . '/../lib/CardDAV/Sharing/Backend.php',
171
-        'OCA\\DAV\\CardDAV\\Sharing\\Service' => __DIR__ . '/..' . '/../lib/CardDAV/Sharing/Service.php',
172
-        'OCA\\DAV\\CardDAV\\SyncService' => __DIR__ . '/..' . '/../lib/CardDAV/SyncService.php',
173
-        'OCA\\DAV\\CardDAV\\SystemAddressbook' => __DIR__ . '/..' . '/../lib/CardDAV/SystemAddressbook.php',
174
-        'OCA\\DAV\\CardDAV\\UserAddressBooks' => __DIR__ . '/..' . '/../lib/CardDAV/UserAddressBooks.php',
175
-        'OCA\\DAV\\CardDAV\\Validation\\CardDavValidatePlugin' => __DIR__ . '/..' . '/../lib/CardDAV/Validation/CardDavValidatePlugin.php',
176
-        'OCA\\DAV\\CardDAV\\Xml\\Groups' => __DIR__ . '/..' . '/../lib/CardDAV/Xml/Groups.php',
177
-        'OCA\\DAV\\Command\\ClearCalendarUnshares' => __DIR__ . '/..' . '/../lib/Command/ClearCalendarUnshares.php',
178
-        'OCA\\DAV\\Command\\ClearContactsPhotoCache' => __DIR__ . '/..' . '/../lib/Command/ClearContactsPhotoCache.php',
179
-        'OCA\\DAV\\Command\\CreateAddressBook' => __DIR__ . '/..' . '/../lib/Command/CreateAddressBook.php',
180
-        'OCA\\DAV\\Command\\CreateCalendar' => __DIR__ . '/..' . '/../lib/Command/CreateCalendar.php',
181
-        'OCA\\DAV\\Command\\CreateSubscription' => __DIR__ . '/..' . '/../lib/Command/CreateSubscription.php',
182
-        'OCA\\DAV\\Command\\DeleteCalendar' => __DIR__ . '/..' . '/../lib/Command/DeleteCalendar.php',
183
-        'OCA\\DAV\\Command\\DeleteSubscription' => __DIR__ . '/..' . '/../lib/Command/DeleteSubscription.php',
184
-        'OCA\\DAV\\Command\\ExportCalendar' => __DIR__ . '/..' . '/../lib/Command/ExportCalendar.php',
185
-        'OCA\\DAV\\Command\\FixCalendarSyncCommand' => __DIR__ . '/..' . '/../lib/Command/FixCalendarSyncCommand.php',
186
-        'OCA\\DAV\\Command\\GetAbsenceCommand' => __DIR__ . '/..' . '/../lib/Command/GetAbsenceCommand.php',
187
-        'OCA\\DAV\\Command\\ImportCalendar' => __DIR__ . '/..' . '/../lib/Command/ImportCalendar.php',
188
-        'OCA\\DAV\\Command\\ListAddressbooks' => __DIR__ . '/..' . '/../lib/Command/ListAddressbooks.php',
189
-        'OCA\\DAV\\Command\\ListCalendarShares' => __DIR__ . '/..' . '/../lib/Command/ListCalendarShares.php',
190
-        'OCA\\DAV\\Command\\ListCalendars' => __DIR__ . '/..' . '/../lib/Command/ListCalendars.php',
191
-        'OCA\\DAV\\Command\\ListSubscriptions' => __DIR__ . '/..' . '/../lib/Command/ListSubscriptions.php',
192
-        'OCA\\DAV\\Command\\MoveCalendar' => __DIR__ . '/..' . '/../lib/Command/MoveCalendar.php',
193
-        'OCA\\DAV\\Command\\RemoveInvalidShares' => __DIR__ . '/..' . '/../lib/Command/RemoveInvalidShares.php',
194
-        'OCA\\DAV\\Command\\RetentionCleanupCommand' => __DIR__ . '/..' . '/../lib/Command/RetentionCleanupCommand.php',
195
-        'OCA\\DAV\\Command\\SendEventReminders' => __DIR__ . '/..' . '/../lib/Command/SendEventReminders.php',
196
-        'OCA\\DAV\\Command\\SetAbsenceCommand' => __DIR__ . '/..' . '/../lib/Command/SetAbsenceCommand.php',
197
-        'OCA\\DAV\\Command\\SyncBirthdayCalendar' => __DIR__ . '/..' . '/../lib/Command/SyncBirthdayCalendar.php',
198
-        'OCA\\DAV\\Command\\SyncSystemAddressBook' => __DIR__ . '/..' . '/../lib/Command/SyncSystemAddressBook.php',
199
-        'OCA\\DAV\\Comments\\CommentNode' => __DIR__ . '/..' . '/../lib/Comments/CommentNode.php',
200
-        'OCA\\DAV\\Comments\\CommentsPlugin' => __DIR__ . '/..' . '/../lib/Comments/CommentsPlugin.php',
201
-        'OCA\\DAV\\Comments\\EntityCollection' => __DIR__ . '/..' . '/../lib/Comments/EntityCollection.php',
202
-        'OCA\\DAV\\Comments\\EntityTypeCollection' => __DIR__ . '/..' . '/../lib/Comments/EntityTypeCollection.php',
203
-        'OCA\\DAV\\Comments\\RootCollection' => __DIR__ . '/..' . '/../lib/Comments/RootCollection.php',
204
-        'OCA\\DAV\\Connector\\LegacyDAVACL' => __DIR__ . '/..' . '/../lib/Connector/LegacyDAVACL.php',
205
-        'OCA\\DAV\\Connector\\LegacyPublicAuth' => __DIR__ . '/..' . '/../lib/Connector/LegacyPublicAuth.php',
206
-        'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/AnonymousOptionsPlugin.php',
207
-        'OCA\\DAV\\Connector\\Sabre\\AppleQuirksPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/AppleQuirksPlugin.php',
208
-        'OCA\\DAV\\Connector\\Sabre\\Auth' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Auth.php',
209
-        'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => __DIR__ . '/..' . '/../lib/Connector/Sabre/BearerAuth.php',
210
-        'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/BlockLegacyClientPlugin.php',
211
-        'OCA\\DAV\\Connector\\Sabre\\CachingTree' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CachingTree.php',
212
-        'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ChecksumList.php',
213
-        'OCA\\DAV\\Connector\\Sabre\\ChecksumUpdatePlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ChecksumUpdatePlugin.php',
214
-        'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CommentPropertiesPlugin.php',
215
-        'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php',
216
-        'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/DavAclPlugin.php',
217
-        'OCA\\DAV\\Connector\\Sabre\\Directory' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Directory.php',
218
-        'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/DummyGetResponsePlugin.php',
219
-        'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ExceptionLoggerPlugin.php',
220
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\BadGateway' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/BadGateway.php',
221
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/EntityTooLarge.php',
222
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/FileLocked.php',
223
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/Forbidden.php',
224
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/InvalidPath.php',
225
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php',
226
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\TooManyRequests' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/TooManyRequests.php',
227
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php',
228
-        'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FakeLockerPlugin.php',
229
-        'OCA\\DAV\\Connector\\Sabre\\File' => __DIR__ . '/..' . '/../lib/Connector/Sabre/File.php',
230
-        'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FilesPlugin.php',
231
-        'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FilesReportPlugin.php',
232
-        'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/LockPlugin.php',
233
-        'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/MaintenancePlugin.php',
234
-        'OCA\\DAV\\Connector\\Sabre\\MtimeSanitizer' => __DIR__ . '/..' . '/../lib/Connector/Sabre/MtimeSanitizer.php',
235
-        'OCA\\DAV\\Connector\\Sabre\\Node' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Node.php',
236
-        'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ObjectTree.php',
237
-        'OCA\\DAV\\Connector\\Sabre\\Principal' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Principal.php',
238
-        'OCA\\DAV\\Connector\\Sabre\\PropFindMonitorPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/PropFindMonitorPlugin.php',
239
-        'OCA\\DAV\\Connector\\Sabre\\PropFindPreloadNotifyPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/PropFindPreloadNotifyPlugin.php',
240
-        'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/PropfindCompressionPlugin.php',
241
-        'OCA\\DAV\\Connector\\Sabre\\PublicAuth' => __DIR__ . '/..' . '/../lib/Connector/Sabre/PublicAuth.php',
242
-        'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/QuotaPlugin.php',
243
-        'OCA\\DAV\\Connector\\Sabre\\RequestIdHeaderPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/RequestIdHeaderPlugin.php',
244
-        'OCA\\DAV\\Connector\\Sabre\\Server' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Server.php',
245
-        'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ServerFactory.php',
246
-        'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ShareTypeList.php',
247
-        'OCA\\DAV\\Connector\\Sabre\\ShareeList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ShareeList.php',
248
-        'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/SharesPlugin.php',
249
-        'OCA\\DAV\\Connector\\Sabre\\TagList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/TagList.php',
250
-        'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/TagsPlugin.php',
251
-        'OCA\\DAV\\Connector\\Sabre\\ZipFolderPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ZipFolderPlugin.php',
252
-        'OCA\\DAV\\Controller\\BirthdayCalendarController' => __DIR__ . '/..' . '/../lib/Controller/BirthdayCalendarController.php',
253
-        'OCA\\DAV\\Controller\\DirectController' => __DIR__ . '/..' . '/../lib/Controller/DirectController.php',
254
-        'OCA\\DAV\\Controller\\ExampleContentController' => __DIR__ . '/..' . '/../lib/Controller/ExampleContentController.php',
255
-        'OCA\\DAV\\Controller\\InvitationResponseController' => __DIR__ . '/..' . '/../lib/Controller/InvitationResponseController.php',
256
-        'OCA\\DAV\\Controller\\OutOfOfficeController' => __DIR__ . '/..' . '/../lib/Controller/OutOfOfficeController.php',
257
-        'OCA\\DAV\\Controller\\UpcomingEventsController' => __DIR__ . '/..' . '/../lib/Controller/UpcomingEventsController.php',
258
-        'OCA\\DAV\\DAV\\CustomPropertiesBackend' => __DIR__ . '/..' . '/../lib/DAV/CustomPropertiesBackend.php',
259
-        'OCA\\DAV\\DAV\\GroupPrincipalBackend' => __DIR__ . '/..' . '/../lib/DAV/GroupPrincipalBackend.php',
260
-        'OCA\\DAV\\DAV\\PublicAuth' => __DIR__ . '/..' . '/../lib/DAV/PublicAuth.php',
261
-        'OCA\\DAV\\DAV\\Sharing\\Backend' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Backend.php',
262
-        'OCA\\DAV\\DAV\\Sharing\\IShareable' => __DIR__ . '/..' . '/../lib/DAV/Sharing/IShareable.php',
263
-        'OCA\\DAV\\DAV\\Sharing\\Plugin' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Plugin.php',
264
-        'OCA\\DAV\\DAV\\Sharing\\SharingMapper' => __DIR__ . '/..' . '/../lib/DAV/Sharing/SharingMapper.php',
265
-        'OCA\\DAV\\DAV\\Sharing\\SharingService' => __DIR__ . '/..' . '/../lib/DAV/Sharing/SharingService.php',
266
-        'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Xml/Invite.php',
267
-        'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Xml/ShareRequest.php',
268
-        'OCA\\DAV\\DAV\\SystemPrincipalBackend' => __DIR__ . '/..' . '/../lib/DAV/SystemPrincipalBackend.php',
269
-        'OCA\\DAV\\DAV\\ViewOnlyPlugin' => __DIR__ . '/..' . '/../lib/DAV/ViewOnlyPlugin.php',
270
-        'OCA\\DAV\\Db\\Absence' => __DIR__ . '/..' . '/../lib/Db/Absence.php',
271
-        'OCA\\DAV\\Db\\AbsenceMapper' => __DIR__ . '/..' . '/../lib/Db/AbsenceMapper.php',
272
-        'OCA\\DAV\\Db\\Direct' => __DIR__ . '/..' . '/../lib/Db/Direct.php',
273
-        'OCA\\DAV\\Db\\DirectMapper' => __DIR__ . '/..' . '/../lib/Db/DirectMapper.php',
274
-        'OCA\\DAV\\Db\\Property' => __DIR__ . '/..' . '/../lib/Db/Property.php',
275
-        'OCA\\DAV\\Db\\PropertyMapper' => __DIR__ . '/..' . '/../lib/Db/PropertyMapper.php',
276
-        'OCA\\DAV\\Direct\\DirectFile' => __DIR__ . '/..' . '/../lib/Direct/DirectFile.php',
277
-        'OCA\\DAV\\Direct\\DirectHome' => __DIR__ . '/..' . '/../lib/Direct/DirectHome.php',
278
-        'OCA\\DAV\\Direct\\Server' => __DIR__ . '/..' . '/../lib/Direct/Server.php',
279
-        'OCA\\DAV\\Direct\\ServerFactory' => __DIR__ . '/..' . '/../lib/Direct/ServerFactory.php',
280
-        'OCA\\DAV\\Events\\AddressBookCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookCreatedEvent.php',
281
-        'OCA\\DAV\\Events\\AddressBookDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookDeletedEvent.php',
282
-        'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookShareUpdatedEvent.php',
283
-        'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookUpdatedEvent.php',
284
-        'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => __DIR__ . '/..' . '/../lib/Events/BeforeFileDirectDownloadedEvent.php',
285
-        'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectCreatedEvent.php',
286
-        'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectDeletedEvent.php',
287
-        'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectUpdatedEvent.php',
288
-        'OCA\\DAV\\Events\\CalendarCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarCreatedEvent.php',
289
-        'OCA\\DAV\\Events\\CalendarDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarDeletedEvent.php',
290
-        'OCA\\DAV\\Events\\CalendarMovedToTrashEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarMovedToTrashEvent.php',
291
-        'OCA\\DAV\\Events\\CalendarPublishedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarPublishedEvent.php',
292
-        'OCA\\DAV\\Events\\CalendarRestoredEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarRestoredEvent.php',
293
-        'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarShareUpdatedEvent.php',
294
-        'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarUnpublishedEvent.php',
295
-        'OCA\\DAV\\Events\\CalendarUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarUpdatedEvent.php',
296
-        'OCA\\DAV\\Events\\CardCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CardCreatedEvent.php',
297
-        'OCA\\DAV\\Events\\CardDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CardDeletedEvent.php',
298
-        'OCA\\DAV\\Events\\CardMovedEvent' => __DIR__ . '/..' . '/../lib/Events/CardMovedEvent.php',
299
-        'OCA\\DAV\\Events\\CardUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CardUpdatedEvent.php',
300
-        'OCA\\DAV\\Events\\SabrePluginAddEvent' => __DIR__ . '/..' . '/../lib/Events/SabrePluginAddEvent.php',
301
-        'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => __DIR__ . '/..' . '/../lib/Events/SabrePluginAuthInitEvent.php',
302
-        'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionCreatedEvent.php',
303
-        'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionDeletedEvent.php',
304
-        'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionUpdatedEvent.php',
305
-        'OCA\\DAV\\Exception\\ExampleEventException' => __DIR__ . '/..' . '/../lib/Exception/ExampleEventException.php',
306
-        'OCA\\DAV\\Exception\\ServerMaintenanceMode' => __DIR__ . '/..' . '/../lib/Exception/ServerMaintenanceMode.php',
307
-        'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => __DIR__ . '/..' . '/../lib/Exception/UnsupportedLimitOnInitialSyncException.php',
308
-        'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => __DIR__ . '/..' . '/../lib/Files/BrowserErrorPagePlugin.php',
309
-        'OCA\\DAV\\Files\\FileSearchBackend' => __DIR__ . '/..' . '/../lib/Files/FileSearchBackend.php',
310
-        'OCA\\DAV\\Files\\FilesHome' => __DIR__ . '/..' . '/../lib/Files/FilesHome.php',
311
-        'OCA\\DAV\\Files\\LazySearchBackend' => __DIR__ . '/..' . '/../lib/Files/LazySearchBackend.php',
312
-        'OCA\\DAV\\Files\\RootCollection' => __DIR__ . '/..' . '/../lib/Files/RootCollection.php',
313
-        'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => __DIR__ . '/..' . '/../lib/Files/Sharing/FilesDropPlugin.php',
314
-        'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => __DIR__ . '/..' . '/../lib/Files/Sharing/PublicLinkCheckPlugin.php',
315
-        'OCA\\DAV\\Files\\Sharing\\RootCollection' => __DIR__ . '/..' . '/../lib/Files/Sharing/RootCollection.php',
316
-        'OCA\\DAV\\Listener\\ActivityUpdaterListener' => __DIR__ . '/..' . '/../lib/Listener/ActivityUpdaterListener.php',
317
-        'OCA\\DAV\\Listener\\AddMissingIndicesListener' => __DIR__ . '/..' . '/../lib/Listener/AddMissingIndicesListener.php',
318
-        'OCA\\DAV\\Listener\\AddressbookListener' => __DIR__ . '/..' . '/../lib/Listener/AddressbookListener.php',
319
-        'OCA\\DAV\\Listener\\BirthdayListener' => __DIR__ . '/..' . '/../lib/Listener/BirthdayListener.php',
320
-        'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarContactInteractionListener.php',
321
-        'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php',
322
-        'OCA\\DAV\\Listener\\CalendarObjectReminderUpdaterListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarObjectReminderUpdaterListener.php',
323
-        'OCA\\DAV\\Listener\\CalendarPublicationListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarPublicationListener.php',
324
-        'OCA\\DAV\\Listener\\CalendarShareUpdateListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarShareUpdateListener.php',
325
-        'OCA\\DAV\\Listener\\CardListener' => __DIR__ . '/..' . '/../lib/Listener/CardListener.php',
326
-        'OCA\\DAV\\Listener\\ClearPhotoCacheListener' => __DIR__ . '/..' . '/../lib/Listener/ClearPhotoCacheListener.php',
327
-        'OCA\\DAV\\Listener\\DavAdminSettingsListener' => __DIR__ . '/..' . '/../lib/Listener/DavAdminSettingsListener.php',
328
-        'OCA\\DAV\\Listener\\OutOfOfficeListener' => __DIR__ . '/..' . '/../lib/Listener/OutOfOfficeListener.php',
329
-        'OCA\\DAV\\Listener\\SubscriptionListener' => __DIR__ . '/..' . '/../lib/Listener/SubscriptionListener.php',
330
-        'OCA\\DAV\\Listener\\TrustedServerRemovedListener' => __DIR__ . '/..' . '/../lib/Listener/TrustedServerRemovedListener.php',
331
-        'OCA\\DAV\\Listener\\UserEventsListener' => __DIR__ . '/..' . '/../lib/Listener/UserEventsListener.php',
332
-        'OCA\\DAV\\Listener\\UserPreferenceListener' => __DIR__ . '/..' . '/../lib/Listener/UserPreferenceListener.php',
333
-        'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => __DIR__ . '/..' . '/../lib/Migration/BuildCalendarSearchIndex.php',
334
-        'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php',
335
-        'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => __DIR__ . '/..' . '/../lib/Migration/BuildSocialSearchIndex.php',
336
-        'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php',
337
-        'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => __DIR__ . '/..' . '/../lib/Migration/CalDAVRemoveEmptyValue.php',
338
-        'OCA\\DAV\\Migration\\ChunkCleanup' => __DIR__ . '/..' . '/../lib/Migration/ChunkCleanup.php',
339
-        'OCA\\DAV\\Migration\\CreateSystemAddressBookStep' => __DIR__ . '/..' . '/../lib/Migration/CreateSystemAddressBookStep.php',
340
-        'OCA\\DAV\\Migration\\DeleteSchedulingObjects' => __DIR__ . '/..' . '/../lib/Migration/DeleteSchedulingObjects.php',
341
-        'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => __DIR__ . '/..' . '/../lib/Migration/FixBirthdayCalendarComponent.php',
342
-        'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => __DIR__ . '/..' . '/../lib/Migration/RefreshWebcalJobRegistrar.php',
343
-        'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => __DIR__ . '/..' . '/../lib/Migration/RegenerateBirthdayCalendars.php',
344
-        'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php',
345
-        'OCA\\DAV\\Migration\\RegisterUpdateCalendarResourcesRoomBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php',
346
-        'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => __DIR__ . '/..' . '/../lib/Migration/RemoveClassifiedEventActivity.php',
347
-        'OCA\\DAV\\Migration\\RemoveDeletedUsersCalendarSubscriptions' => __DIR__ . '/..' . '/../lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php',
348
-        'OCA\\DAV\\Migration\\RemoveObjectProperties' => __DIR__ . '/..' . '/../lib/Migration/RemoveObjectProperties.php',
349
-        'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => __DIR__ . '/..' . '/../lib/Migration/RemoveOrphanEventsAndContacts.php',
350
-        'OCA\\DAV\\Migration\\Version1004Date20170825134824' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170825134824.php',
351
-        'OCA\\DAV\\Migration\\Version1004Date20170919104507' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170919104507.php',
352
-        'OCA\\DAV\\Migration\\Version1004Date20170924124212' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170924124212.php',
353
-        'OCA\\DAV\\Migration\\Version1004Date20170926103422' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170926103422.php',
354
-        'OCA\\DAV\\Migration\\Version1005Date20180413093149' => __DIR__ . '/..' . '/../lib/Migration/Version1005Date20180413093149.php',
355
-        'OCA\\DAV\\Migration\\Version1005Date20180530124431' => __DIR__ . '/..' . '/../lib/Migration/Version1005Date20180530124431.php',
356
-        'OCA\\DAV\\Migration\\Version1006Date20180619154313' => __DIR__ . '/..' . '/../lib/Migration/Version1006Date20180619154313.php',
357
-        'OCA\\DAV\\Migration\\Version1006Date20180628111625' => __DIR__ . '/..' . '/../lib/Migration/Version1006Date20180628111625.php',
358
-        'OCA\\DAV\\Migration\\Version1008Date20181030113700' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181030113700.php',
359
-        'OCA\\DAV\\Migration\\Version1008Date20181105104826' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105104826.php',
360
-        'OCA\\DAV\\Migration\\Version1008Date20181105104833' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105104833.php',
361
-        'OCA\\DAV\\Migration\\Version1008Date20181105110300' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105110300.php',
362
-        'OCA\\DAV\\Migration\\Version1008Date20181105112049' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105112049.php',
363
-        'OCA\\DAV\\Migration\\Version1008Date20181114084440' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181114084440.php',
364
-        'OCA\\DAV\\Migration\\Version1011Date20190725113607' => __DIR__ . '/..' . '/../lib/Migration/Version1011Date20190725113607.php',
365
-        'OCA\\DAV\\Migration\\Version1011Date20190806104428' => __DIR__ . '/..' . '/../lib/Migration/Version1011Date20190806104428.php',
366
-        'OCA\\DAV\\Migration\\Version1012Date20190808122342' => __DIR__ . '/..' . '/../lib/Migration/Version1012Date20190808122342.php',
367
-        'OCA\\DAV\\Migration\\Version1016Date20201109085907' => __DIR__ . '/..' . '/../lib/Migration/Version1016Date20201109085907.php',
368
-        'OCA\\DAV\\Migration\\Version1017Date20210216083742' => __DIR__ . '/..' . '/../lib/Migration/Version1017Date20210216083742.php',
369
-        'OCA\\DAV\\Migration\\Version1018Date20210312100735' => __DIR__ . '/..' . '/../lib/Migration/Version1018Date20210312100735.php',
370
-        'OCA\\DAV\\Migration\\Version1024Date20211221144219' => __DIR__ . '/..' . '/../lib/Migration/Version1024Date20211221144219.php',
371
-        'OCA\\DAV\\Migration\\Version1025Date20240308063933' => __DIR__ . '/..' . '/../lib/Migration/Version1025Date20240308063933.php',
372
-        'OCA\\DAV\\Migration\\Version1027Date20230504122946' => __DIR__ . '/..' . '/../lib/Migration/Version1027Date20230504122946.php',
373
-        'OCA\\DAV\\Migration\\Version1029Date20221114151721' => __DIR__ . '/..' . '/../lib/Migration/Version1029Date20221114151721.php',
374
-        'OCA\\DAV\\Migration\\Version1029Date20231004091403' => __DIR__ . '/..' . '/../lib/Migration/Version1029Date20231004091403.php',
375
-        'OCA\\DAV\\Migration\\Version1030Date20240205103243' => __DIR__ . '/..' . '/../lib/Migration/Version1030Date20240205103243.php',
376
-        'OCA\\DAV\\Migration\\Version1031Date20240610134258' => __DIR__ . '/..' . '/../lib/Migration/Version1031Date20240610134258.php',
377
-        'OCA\\DAV\\Migration\\Version1034Date20250813093701' => __DIR__ . '/..' . '/../lib/Migration/Version1034Date20250813093701.php',
378
-        'OCA\\DAV\\Model\\ExampleEvent' => __DIR__ . '/..' . '/../lib/Model/ExampleEvent.php',
379
-        'OCA\\DAV\\Paginate\\LimitedCopyIterator' => __DIR__ . '/..' . '/../lib/Paginate/LimitedCopyIterator.php',
380
-        'OCA\\DAV\\Paginate\\PaginateCache' => __DIR__ . '/..' . '/../lib/Paginate/PaginateCache.php',
381
-        'OCA\\DAV\\Paginate\\PaginatePlugin' => __DIR__ . '/..' . '/../lib/Paginate/PaginatePlugin.php',
382
-        'OCA\\DAV\\Profiler\\ProfilerPlugin' => __DIR__ . '/..' . '/../lib/Profiler/ProfilerPlugin.php',
383
-        'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => __DIR__ . '/..' . '/../lib/Provisioning/Apple/AppleProvisioningNode.php',
384
-        'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => __DIR__ . '/..' . '/../lib/Provisioning/Apple/AppleProvisioningPlugin.php',
385
-        'OCA\\DAV\\ResponseDefinitions' => __DIR__ . '/..' . '/../lib/ResponseDefinitions.php',
386
-        'OCA\\DAV\\RootCollection' => __DIR__ . '/..' . '/../lib/RootCollection.php',
387
-        'OCA\\DAV\\Search\\ACalendarSearchProvider' => __DIR__ . '/..' . '/../lib/Search/ACalendarSearchProvider.php',
388
-        'OCA\\DAV\\Search\\ContactsSearchProvider' => __DIR__ . '/..' . '/../lib/Search/ContactsSearchProvider.php',
389
-        'OCA\\DAV\\Search\\EventsSearchProvider' => __DIR__ . '/..' . '/../lib/Search/EventsSearchProvider.php',
390
-        'OCA\\DAV\\Search\\TasksSearchProvider' => __DIR__ . '/..' . '/../lib/Search/TasksSearchProvider.php',
391
-        'OCA\\DAV\\Server' => __DIR__ . '/..' . '/../lib/Server.php',
392
-        'OCA\\DAV\\ServerFactory' => __DIR__ . '/..' . '/../lib/ServerFactory.php',
393
-        'OCA\\DAV\\Service\\AbsenceService' => __DIR__ . '/..' . '/../lib/Service/AbsenceService.php',
394
-        'OCA\\DAV\\Service\\ExampleContactService' => __DIR__ . '/..' . '/../lib/Service/ExampleContactService.php',
395
-        'OCA\\DAV\\Service\\ExampleEventService' => __DIR__ . '/..' . '/../lib/Service/ExampleEventService.php',
396
-        'OCA\\DAV\\Settings\\Admin\\SystemAddressBookSettings' => __DIR__ . '/..' . '/../lib/Settings/Admin/SystemAddressBookSettings.php',
397
-        'OCA\\DAV\\Settings\\AvailabilitySettings' => __DIR__ . '/..' . '/../lib/Settings/AvailabilitySettings.php',
398
-        'OCA\\DAV\\Settings\\CalDAVSettings' => __DIR__ . '/..' . '/../lib/Settings/CalDAVSettings.php',
399
-        'OCA\\DAV\\Settings\\ExampleContentSettings' => __DIR__ . '/..' . '/../lib/Settings/ExampleContentSettings.php',
400
-        'OCA\\DAV\\SetupChecks\\NeedsSystemAddressBookSync' => __DIR__ . '/..' . '/../lib/SetupChecks/NeedsSystemAddressBookSync.php',
401
-        'OCA\\DAV\\SetupChecks\\WebdavEndpoint' => __DIR__ . '/..' . '/../lib/SetupChecks/WebdavEndpoint.php',
402
-        'OCA\\DAV\\Storage\\PublicOwnerWrapper' => __DIR__ . '/..' . '/../lib/Storage/PublicOwnerWrapper.php',
403
-        'OCA\\DAV\\Storage\\PublicShareWrapper' => __DIR__ . '/..' . '/../lib/Storage/PublicShareWrapper.php',
404
-        'OCA\\DAV\\SystemTag\\SystemTagList' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagList.php',
405
-        'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagMappingNode.php',
406
-        'OCA\\DAV\\SystemTag\\SystemTagNode' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagNode.php',
407
-        'OCA\\DAV\\SystemTag\\SystemTagObjectType' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagObjectType.php',
408
-        'OCA\\DAV\\SystemTag\\SystemTagPlugin' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagPlugin.php',
409
-        'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsByIdCollection.php',
410
-        'OCA\\DAV\\SystemTag\\SystemTagsInUseCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsInUseCollection.php',
411
-        'OCA\\DAV\\SystemTag\\SystemTagsObjectList' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsObjectList.php',
412
-        'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsObjectMappingCollection.php',
413
-        'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsObjectTypeCollection.php',
414
-        'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsRelationsCollection.php',
415
-        'OCA\\DAV\\Traits\\PrincipalProxyTrait' => __DIR__ . '/..' . '/../lib/Traits/PrincipalProxyTrait.php',
416
-        'OCA\\DAV\\Upload\\AssemblyStream' => __DIR__ . '/..' . '/../lib/Upload/AssemblyStream.php',
417
-        'OCA\\DAV\\Upload\\ChunkingPlugin' => __DIR__ . '/..' . '/../lib/Upload/ChunkingPlugin.php',
418
-        'OCA\\DAV\\Upload\\ChunkingV2Plugin' => __DIR__ . '/..' . '/../lib/Upload/ChunkingV2Plugin.php',
419
-        'OCA\\DAV\\Upload\\CleanupService' => __DIR__ . '/..' . '/../lib/Upload/CleanupService.php',
420
-        'OCA\\DAV\\Upload\\FutureFile' => __DIR__ . '/..' . '/../lib/Upload/FutureFile.php',
421
-        'OCA\\DAV\\Upload\\PartFile' => __DIR__ . '/..' . '/../lib/Upload/PartFile.php',
422
-        'OCA\\DAV\\Upload\\RootCollection' => __DIR__ . '/..' . '/../lib/Upload/RootCollection.php',
423
-        'OCA\\DAV\\Upload\\UploadAutoMkcolPlugin' => __DIR__ . '/..' . '/../lib/Upload/UploadAutoMkcolPlugin.php',
424
-        'OCA\\DAV\\Upload\\UploadFile' => __DIR__ . '/..' . '/../lib/Upload/UploadFile.php',
425
-        'OCA\\DAV\\Upload\\UploadFolder' => __DIR__ . '/..' . '/../lib/Upload/UploadFolder.php',
426
-        'OCA\\DAV\\Upload\\UploadHome' => __DIR__ . '/..' . '/../lib/Upload/UploadHome.php',
427
-        'OCA\\DAV\\UserMigration\\CalendarMigrator' => __DIR__ . '/..' . '/../lib/UserMigration/CalendarMigrator.php',
428
-        'OCA\\DAV\\UserMigration\\CalendarMigratorException' => __DIR__ . '/..' . '/../lib/UserMigration/CalendarMigratorException.php',
429
-        'OCA\\DAV\\UserMigration\\ContactsMigrator' => __DIR__ . '/..' . '/../lib/UserMigration/ContactsMigrator.php',
430
-        'OCA\\DAV\\UserMigration\\ContactsMigratorException' => __DIR__ . '/..' . '/../lib/UserMigration/ContactsMigratorException.php',
431
-        'OCA\\DAV\\UserMigration\\InvalidAddressBookException' => __DIR__ . '/..' . '/../lib/UserMigration/InvalidAddressBookException.php',
432
-        'OCA\\DAV\\UserMigration\\InvalidCalendarException' => __DIR__ . '/..' . '/../lib/UserMigration/InvalidCalendarException.php',
23
+    public static $classMap = array(
24
+        'Composer\\InstalledVersions' => __DIR__.'/..'.'/composer/InstalledVersions.php',
25
+        'OCA\\DAV\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
26
+        'OCA\\DAV\\AppInfo\\PluginManager' => __DIR__.'/..'.'/../lib/AppInfo/PluginManager.php',
27
+        'OCA\\DAV\\Avatars\\AvatarHome' => __DIR__.'/..'.'/../lib/Avatars/AvatarHome.php',
28
+        'OCA\\DAV\\Avatars\\AvatarNode' => __DIR__.'/..'.'/../lib/Avatars/AvatarNode.php',
29
+        'OCA\\DAV\\Avatars\\RootCollection' => __DIR__.'/..'.'/../lib/Avatars/RootCollection.php',
30
+        'OCA\\DAV\\BackgroundJob\\BuildReminderIndexBackgroundJob' => __DIR__.'/..'.'/../lib/BackgroundJob/BuildReminderIndexBackgroundJob.php',
31
+        'OCA\\DAV\\BackgroundJob\\CalendarRetentionJob' => __DIR__.'/..'.'/../lib/BackgroundJob/CalendarRetentionJob.php',
32
+        'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupDirectLinksJob.php',
33
+        'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupInvitationTokenJob.php',
34
+        'OCA\\DAV\\BackgroundJob\\CleanupOrphanedChildrenJob' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupOrphanedChildrenJob.php',
35
+        'OCA\\DAV\\BackgroundJob\\DeleteOutdatedSchedulingObjects' => __DIR__.'/..'.'/../lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php',
36
+        'OCA\\DAV\\BackgroundJob\\EventReminderJob' => __DIR__.'/..'.'/../lib/BackgroundJob/EventReminderJob.php',
37
+        'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => __DIR__.'/..'.'/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php',
38
+        'OCA\\DAV\\BackgroundJob\\OutOfOfficeEventDispatcherJob' => __DIR__.'/..'.'/../lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php',
39
+        'OCA\\DAV\\BackgroundJob\\PruneOutdatedSyncTokensJob' => __DIR__.'/..'.'/../lib/BackgroundJob/PruneOutdatedSyncTokensJob.php',
40
+        'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => __DIR__.'/..'.'/../lib/BackgroundJob/RefreshWebcalJob.php',
41
+        'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => __DIR__.'/..'.'/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php',
42
+        'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => __DIR__.'/..'.'/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php',
43
+        'OCA\\DAV\\BackgroundJob\\UploadCleanup' => __DIR__.'/..'.'/../lib/BackgroundJob/UploadCleanup.php',
44
+        'OCA\\DAV\\BackgroundJob\\UserStatusAutomation' => __DIR__.'/..'.'/../lib/BackgroundJob/UserStatusAutomation.php',
45
+        'OCA\\DAV\\BulkUpload\\BulkUploadPlugin' => __DIR__.'/..'.'/../lib/BulkUpload/BulkUploadPlugin.php',
46
+        'OCA\\DAV\\BulkUpload\\MultipartRequestParser' => __DIR__.'/..'.'/../lib/BulkUpload/MultipartRequestParser.php',
47
+        'OCA\\DAV\\CalDAV\\Activity\\Backend' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Backend.php',
48
+        'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Filter/Calendar.php',
49
+        'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Filter/Todo.php',
50
+        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Base.php',
51
+        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Calendar.php',
52
+        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Event.php',
53
+        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Todo.php',
54
+        'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/CalDAVSetting.php',
55
+        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Calendar.php',
56
+        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Event.php',
57
+        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Todo.php',
58
+        'OCA\\DAV\\CalDAV\\AppCalendar\\AppCalendar' => __DIR__.'/..'.'/../lib/CalDAV/AppCalendar/AppCalendar.php',
59
+        'OCA\\DAV\\CalDAV\\AppCalendar\\AppCalendarPlugin' => __DIR__.'/..'.'/../lib/CalDAV/AppCalendar/AppCalendarPlugin.php',
60
+        'OCA\\DAV\\CalDAV\\AppCalendar\\CalendarObject' => __DIR__.'/..'.'/../lib/CalDAV/AppCalendar/CalendarObject.php',
61
+        'OCA\\DAV\\CalDAV\\Auth\\CustomPrincipalPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Auth/CustomPrincipalPlugin.php',
62
+        'OCA\\DAV\\CalDAV\\Auth\\PublicPrincipalPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Auth/PublicPrincipalPlugin.php',
63
+        'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => __DIR__.'/..'.'/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php',
64
+        'OCA\\DAV\\CalDAV\\BirthdayService' => __DIR__.'/..'.'/../lib/CalDAV/BirthdayService.php',
65
+        'OCA\\DAV\\CalDAV\\CachedSubscription' => __DIR__.'/..'.'/../lib/CalDAV/CachedSubscription.php',
66
+        'OCA\\DAV\\CalDAV\\CachedSubscriptionImpl' => __DIR__.'/..'.'/../lib/CalDAV/CachedSubscriptionImpl.php',
67
+        'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => __DIR__.'/..'.'/../lib/CalDAV/CachedSubscriptionObject.php',
68
+        'OCA\\DAV\\CalDAV\\CachedSubscriptionProvider' => __DIR__.'/..'.'/../lib/CalDAV/CachedSubscriptionProvider.php',
69
+        'OCA\\DAV\\CalDAV\\CalDavBackend' => __DIR__.'/..'.'/../lib/CalDAV/CalDavBackend.php',
70
+        'OCA\\DAV\\CalDAV\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Calendar.php',
71
+        'OCA\\DAV\\CalDAV\\CalendarHome' => __DIR__.'/..'.'/../lib/CalDAV/CalendarHome.php',
72
+        'OCA\\DAV\\CalDAV\\CalendarImpl' => __DIR__.'/..'.'/../lib/CalDAV/CalendarImpl.php',
73
+        'OCA\\DAV\\CalDAV\\CalendarManager' => __DIR__.'/..'.'/../lib/CalDAV/CalendarManager.php',
74
+        'OCA\\DAV\\CalDAV\\CalendarObject' => __DIR__.'/..'.'/../lib/CalDAV/CalendarObject.php',
75
+        'OCA\\DAV\\CalDAV\\CalendarProvider' => __DIR__.'/..'.'/../lib/CalDAV/CalendarProvider.php',
76
+        'OCA\\DAV\\CalDAV\\CalendarRoot' => __DIR__.'/..'.'/../lib/CalDAV/CalendarRoot.php',
77
+        'OCA\\DAV\\CalDAV\\DefaultCalendarValidator' => __DIR__.'/..'.'/../lib/CalDAV/DefaultCalendarValidator.php',
78
+        'OCA\\DAV\\CalDAV\\EmbeddedCalDavServer' => __DIR__.'/..'.'/../lib/CalDAV/EmbeddedCalDavServer.php',
79
+        'OCA\\DAV\\CalDAV\\EventComparisonService' => __DIR__.'/..'.'/../lib/CalDAV/EventComparisonService.php',
80
+        'OCA\\DAV\\CalDAV\\EventReader' => __DIR__.'/..'.'/../lib/CalDAV/EventReader.php',
81
+        'OCA\\DAV\\CalDAV\\EventReaderRDate' => __DIR__.'/..'.'/../lib/CalDAV/EventReaderRDate.php',
82
+        'OCA\\DAV\\CalDAV\\EventReaderRRule' => __DIR__.'/..'.'/../lib/CalDAV/EventReaderRRule.php',
83
+        'OCA\\DAV\\CalDAV\\Export\\ExportService' => __DIR__.'/..'.'/../lib/CalDAV/Export/ExportService.php',
84
+        'OCA\\DAV\\CalDAV\\FreeBusy\\FreeBusyGenerator' => __DIR__.'/..'.'/../lib/CalDAV/FreeBusy/FreeBusyGenerator.php',
85
+        'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => __DIR__.'/..'.'/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
86
+        'OCA\\DAV\\CalDAV\\IRestorable' => __DIR__.'/..'.'/../lib/CalDAV/IRestorable.php',
87
+        'OCA\\DAV\\CalDAV\\Import\\ImportService' => __DIR__.'/..'.'/../lib/CalDAV/Import/ImportService.php',
88
+        'OCA\\DAV\\CalDAV\\Import\\TextImporter' => __DIR__.'/..'.'/../lib/CalDAV/Import/TextImporter.php',
89
+        'OCA\\DAV\\CalDAV\\Import\\XmlImporter' => __DIR__.'/..'.'/../lib/CalDAV/Import/XmlImporter.php',
90
+        'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => __DIR__.'/..'.'/../lib/CalDAV/Integration/ExternalCalendar.php',
91
+        'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => __DIR__.'/..'.'/../lib/CalDAV/Integration/ICalendarProvider.php',
92
+        'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => __DIR__.'/..'.'/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php',
93
+        'OCA\\DAV\\CalDAV\\Outbox' => __DIR__.'/..'.'/../lib/CalDAV/Outbox.php',
94
+        'OCA\\DAV\\CalDAV\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/Plugin.php',
95
+        'OCA\\DAV\\CalDAV\\Principal\\Collection' => __DIR__.'/..'.'/../lib/CalDAV/Principal/Collection.php',
96
+        'OCA\\DAV\\CalDAV\\Principal\\User' => __DIR__.'/..'.'/../lib/CalDAV/Principal/User.php',
97
+        'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => __DIR__.'/..'.'/../lib/CalDAV/Proxy/Proxy.php',
98
+        'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => __DIR__.'/..'.'/../lib/CalDAV/Proxy/ProxyMapper.php',
99
+        'OCA\\DAV\\CalDAV\\PublicCalendar' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendar.php',
100
+        'OCA\\DAV\\CalDAV\\PublicCalendarObject' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendarObject.php',
101
+        'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendarRoot.php',
102
+        'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Publishing/PublishPlugin.php',
103
+        'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => __DIR__.'/..'.'/../lib/CalDAV/Publishing/Xml/Publisher.php',
104
+        'OCA\\DAV\\CalDAV\\Reminder\\Backend' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/Backend.php',
105
+        'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/INotificationProvider.php',
106
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProviderManager.php',
107
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php',
108
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php',
109
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php',
110
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php',
111
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php',
112
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php',
113
+        'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/Notifier.php',
114
+        'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/ReminderService.php',
115
+        'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php',
116
+        'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php',
117
+        'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php',
118
+        'OCA\\DAV\\CalDAV\\RetentionService' => __DIR__.'/..'.'/../lib/CalDAV/RetentionService.php',
119
+        'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Schedule/IMipPlugin.php',
120
+        'OCA\\DAV\\CalDAV\\Schedule\\IMipService' => __DIR__.'/..'.'/../lib/CalDAV/Schedule/IMipService.php',
121
+        'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/Schedule/Plugin.php',
122
+        'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Search/SearchPlugin.php',
123
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/CompFilter.php',
124
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php',
125
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php',
126
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php',
127
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/PropFilter.php',
128
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php',
129
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php',
130
+        'OCA\\DAV\\CalDAV\\Security\\RateLimitingPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Security/RateLimitingPlugin.php',
131
+        'OCA\\DAV\\CalDAV\\Sharing\\Backend' => __DIR__.'/..'.'/../lib/CalDAV/Sharing/Backend.php',
132
+        'OCA\\DAV\\CalDAV\\Sharing\\Service' => __DIR__.'/..'.'/../lib/CalDAV/Sharing/Service.php',
133
+        'OCA\\DAV\\CalDAV\\Status\\StatusService' => __DIR__.'/..'.'/../lib/CalDAV/Status/StatusService.php',
134
+        'OCA\\DAV\\CalDAV\\TimeZoneFactory' => __DIR__.'/..'.'/../lib/CalDAV/TimeZoneFactory.php',
135
+        'OCA\\DAV\\CalDAV\\TimezoneService' => __DIR__.'/..'.'/../lib/CalDAV/TimezoneService.php',
136
+        'OCA\\DAV\\CalDAV\\TipBroker' => __DIR__.'/..'.'/../lib/CalDAV/TipBroker.php',
137
+        'OCA\\DAV\\CalDAV\\Trashbin\\DeletedCalendarObject' => __DIR__.'/..'.'/../lib/CalDAV/Trashbin/DeletedCalendarObject.php',
138
+        'OCA\\DAV\\CalDAV\\Trashbin\\DeletedCalendarObjectsCollection' => __DIR__.'/..'.'/../lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php',
139
+        'OCA\\DAV\\CalDAV\\Trashbin\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/Trashbin/Plugin.php',
140
+        'OCA\\DAV\\CalDAV\\Trashbin\\RestoreTarget' => __DIR__.'/..'.'/../lib/CalDAV/Trashbin/RestoreTarget.php',
141
+        'OCA\\DAV\\CalDAV\\Trashbin\\TrashbinHome' => __DIR__.'/..'.'/../lib/CalDAV/Trashbin/TrashbinHome.php',
142
+        'OCA\\DAV\\CalDAV\\UpcomingEvent' => __DIR__.'/..'.'/../lib/CalDAV/UpcomingEvent.php',
143
+        'OCA\\DAV\\CalDAV\\UpcomingEventsService' => __DIR__.'/..'.'/../lib/CalDAV/UpcomingEventsService.php',
144
+        'OCA\\DAV\\CalDAV\\Validation\\CalDavValidatePlugin' => __DIR__.'/..'.'/../lib/CalDAV/Validation/CalDavValidatePlugin.php',
145
+        'OCA\\DAV\\CalDAV\\WebcalCaching\\Connection' => __DIR__.'/..'.'/../lib/CalDAV/WebcalCaching/Connection.php',
146
+        'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/WebcalCaching/Plugin.php',
147
+        'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => __DIR__.'/..'.'/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php',
148
+        'OCA\\DAV\\Capabilities' => __DIR__.'/..'.'/../lib/Capabilities.php',
149
+        'OCA\\DAV\\CardDAV\\Activity\\Backend' => __DIR__.'/..'.'/../lib/CardDAV/Activity/Backend.php',
150
+        'OCA\\DAV\\CardDAV\\Activity\\Filter' => __DIR__.'/..'.'/../lib/CardDAV/Activity/Filter.php',
151
+        'OCA\\DAV\\CardDAV\\Activity\\Provider\\Addressbook' => __DIR__.'/..'.'/../lib/CardDAV/Activity/Provider/Addressbook.php',
152
+        'OCA\\DAV\\CardDAV\\Activity\\Provider\\Base' => __DIR__.'/..'.'/../lib/CardDAV/Activity/Provider/Base.php',
153
+        'OCA\\DAV\\CardDAV\\Activity\\Provider\\Card' => __DIR__.'/..'.'/../lib/CardDAV/Activity/Provider/Card.php',
154
+        'OCA\\DAV\\CardDAV\\Activity\\Setting' => __DIR__.'/..'.'/../lib/CardDAV/Activity/Setting.php',
155
+        'OCA\\DAV\\CardDAV\\AddressBook' => __DIR__.'/..'.'/../lib/CardDAV/AddressBook.php',
156
+        'OCA\\DAV\\CardDAV\\AddressBookImpl' => __DIR__.'/..'.'/../lib/CardDAV/AddressBookImpl.php',
157
+        'OCA\\DAV\\CardDAV\\AddressBookRoot' => __DIR__.'/..'.'/../lib/CardDAV/AddressBookRoot.php',
158
+        'OCA\\DAV\\CardDAV\\Card' => __DIR__.'/..'.'/../lib/CardDAV/Card.php',
159
+        'OCA\\DAV\\CardDAV\\CardDavBackend' => __DIR__.'/..'.'/../lib/CardDAV/CardDavBackend.php',
160
+        'OCA\\DAV\\CardDAV\\ContactsManager' => __DIR__.'/..'.'/../lib/CardDAV/ContactsManager.php',
161
+        'OCA\\DAV\\CardDAV\\Converter' => __DIR__.'/..'.'/../lib/CardDAV/Converter.php',
162
+        'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => __DIR__.'/..'.'/../lib/CardDAV/HasPhotoPlugin.php',
163
+        'OCA\\DAV\\CardDAV\\ImageExportPlugin' => __DIR__.'/..'.'/../lib/CardDAV/ImageExportPlugin.php',
164
+        'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => __DIR__.'/..'.'/../lib/CardDAV/Integration/ExternalAddressBook.php',
165
+        'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => __DIR__.'/..'.'/../lib/CardDAV/Integration/IAddressBookProvider.php',
166
+        'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => __DIR__.'/..'.'/../lib/CardDAV/MultiGetExportPlugin.php',
167
+        'OCA\\DAV\\CardDAV\\PhotoCache' => __DIR__.'/..'.'/../lib/CardDAV/PhotoCache.php',
168
+        'OCA\\DAV\\CardDAV\\Plugin' => __DIR__.'/..'.'/../lib/CardDAV/Plugin.php',
169
+        'OCA\\DAV\\CardDAV\\Security\\CardDavRateLimitingPlugin' => __DIR__.'/..'.'/../lib/CardDAV/Security/CardDavRateLimitingPlugin.php',
170
+        'OCA\\DAV\\CardDAV\\Sharing\\Backend' => __DIR__.'/..'.'/../lib/CardDAV/Sharing/Backend.php',
171
+        'OCA\\DAV\\CardDAV\\Sharing\\Service' => __DIR__.'/..'.'/../lib/CardDAV/Sharing/Service.php',
172
+        'OCA\\DAV\\CardDAV\\SyncService' => __DIR__.'/..'.'/../lib/CardDAV/SyncService.php',
173
+        'OCA\\DAV\\CardDAV\\SystemAddressbook' => __DIR__.'/..'.'/../lib/CardDAV/SystemAddressbook.php',
174
+        'OCA\\DAV\\CardDAV\\UserAddressBooks' => __DIR__.'/..'.'/../lib/CardDAV/UserAddressBooks.php',
175
+        'OCA\\DAV\\CardDAV\\Validation\\CardDavValidatePlugin' => __DIR__.'/..'.'/../lib/CardDAV/Validation/CardDavValidatePlugin.php',
176
+        'OCA\\DAV\\CardDAV\\Xml\\Groups' => __DIR__.'/..'.'/../lib/CardDAV/Xml/Groups.php',
177
+        'OCA\\DAV\\Command\\ClearCalendarUnshares' => __DIR__.'/..'.'/../lib/Command/ClearCalendarUnshares.php',
178
+        'OCA\\DAV\\Command\\ClearContactsPhotoCache' => __DIR__.'/..'.'/../lib/Command/ClearContactsPhotoCache.php',
179
+        'OCA\\DAV\\Command\\CreateAddressBook' => __DIR__.'/..'.'/../lib/Command/CreateAddressBook.php',
180
+        'OCA\\DAV\\Command\\CreateCalendar' => __DIR__.'/..'.'/../lib/Command/CreateCalendar.php',
181
+        'OCA\\DAV\\Command\\CreateSubscription' => __DIR__.'/..'.'/../lib/Command/CreateSubscription.php',
182
+        'OCA\\DAV\\Command\\DeleteCalendar' => __DIR__.'/..'.'/../lib/Command/DeleteCalendar.php',
183
+        'OCA\\DAV\\Command\\DeleteSubscription' => __DIR__.'/..'.'/../lib/Command/DeleteSubscription.php',
184
+        'OCA\\DAV\\Command\\ExportCalendar' => __DIR__.'/..'.'/../lib/Command/ExportCalendar.php',
185
+        'OCA\\DAV\\Command\\FixCalendarSyncCommand' => __DIR__.'/..'.'/../lib/Command/FixCalendarSyncCommand.php',
186
+        'OCA\\DAV\\Command\\GetAbsenceCommand' => __DIR__.'/..'.'/../lib/Command/GetAbsenceCommand.php',
187
+        'OCA\\DAV\\Command\\ImportCalendar' => __DIR__.'/..'.'/../lib/Command/ImportCalendar.php',
188
+        'OCA\\DAV\\Command\\ListAddressbooks' => __DIR__.'/..'.'/../lib/Command/ListAddressbooks.php',
189
+        'OCA\\DAV\\Command\\ListCalendarShares' => __DIR__.'/..'.'/../lib/Command/ListCalendarShares.php',
190
+        'OCA\\DAV\\Command\\ListCalendars' => __DIR__.'/..'.'/../lib/Command/ListCalendars.php',
191
+        'OCA\\DAV\\Command\\ListSubscriptions' => __DIR__.'/..'.'/../lib/Command/ListSubscriptions.php',
192
+        'OCA\\DAV\\Command\\MoveCalendar' => __DIR__.'/..'.'/../lib/Command/MoveCalendar.php',
193
+        'OCA\\DAV\\Command\\RemoveInvalidShares' => __DIR__.'/..'.'/../lib/Command/RemoveInvalidShares.php',
194
+        'OCA\\DAV\\Command\\RetentionCleanupCommand' => __DIR__.'/..'.'/../lib/Command/RetentionCleanupCommand.php',
195
+        'OCA\\DAV\\Command\\SendEventReminders' => __DIR__.'/..'.'/../lib/Command/SendEventReminders.php',
196
+        'OCA\\DAV\\Command\\SetAbsenceCommand' => __DIR__.'/..'.'/../lib/Command/SetAbsenceCommand.php',
197
+        'OCA\\DAV\\Command\\SyncBirthdayCalendar' => __DIR__.'/..'.'/../lib/Command/SyncBirthdayCalendar.php',
198
+        'OCA\\DAV\\Command\\SyncSystemAddressBook' => __DIR__.'/..'.'/../lib/Command/SyncSystemAddressBook.php',
199
+        'OCA\\DAV\\Comments\\CommentNode' => __DIR__.'/..'.'/../lib/Comments/CommentNode.php',
200
+        'OCA\\DAV\\Comments\\CommentsPlugin' => __DIR__.'/..'.'/../lib/Comments/CommentsPlugin.php',
201
+        'OCA\\DAV\\Comments\\EntityCollection' => __DIR__.'/..'.'/../lib/Comments/EntityCollection.php',
202
+        'OCA\\DAV\\Comments\\EntityTypeCollection' => __DIR__.'/..'.'/../lib/Comments/EntityTypeCollection.php',
203
+        'OCA\\DAV\\Comments\\RootCollection' => __DIR__.'/..'.'/../lib/Comments/RootCollection.php',
204
+        'OCA\\DAV\\Connector\\LegacyDAVACL' => __DIR__.'/..'.'/../lib/Connector/LegacyDAVACL.php',
205
+        'OCA\\DAV\\Connector\\LegacyPublicAuth' => __DIR__.'/..'.'/../lib/Connector/LegacyPublicAuth.php',
206
+        'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/AnonymousOptionsPlugin.php',
207
+        'OCA\\DAV\\Connector\\Sabre\\AppleQuirksPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/AppleQuirksPlugin.php',
208
+        'OCA\\DAV\\Connector\\Sabre\\Auth' => __DIR__.'/..'.'/../lib/Connector/Sabre/Auth.php',
209
+        'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => __DIR__.'/..'.'/../lib/Connector/Sabre/BearerAuth.php',
210
+        'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/BlockLegacyClientPlugin.php',
211
+        'OCA\\DAV\\Connector\\Sabre\\CachingTree' => __DIR__.'/..'.'/../lib/Connector/Sabre/CachingTree.php',
212
+        'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => __DIR__.'/..'.'/../lib/Connector/Sabre/ChecksumList.php',
213
+        'OCA\\DAV\\Connector\\Sabre\\ChecksumUpdatePlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/ChecksumUpdatePlugin.php',
214
+        'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/CommentPropertiesPlugin.php',
215
+        'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php',
216
+        'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/DavAclPlugin.php',
217
+        'OCA\\DAV\\Connector\\Sabre\\Directory' => __DIR__.'/..'.'/../lib/Connector/Sabre/Directory.php',
218
+        'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/DummyGetResponsePlugin.php',
219
+        'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/ExceptionLoggerPlugin.php',
220
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\BadGateway' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/BadGateway.php',
221
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/EntityTooLarge.php',
222
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/FileLocked.php',
223
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/Forbidden.php',
224
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/InvalidPath.php',
225
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php',
226
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\TooManyRequests' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/TooManyRequests.php',
227
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php',
228
+        'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FakeLockerPlugin.php',
229
+        'OCA\\DAV\\Connector\\Sabre\\File' => __DIR__.'/..'.'/../lib/Connector/Sabre/File.php',
230
+        'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FilesPlugin.php',
231
+        'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FilesReportPlugin.php',
232
+        'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/LockPlugin.php',
233
+        'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/MaintenancePlugin.php',
234
+        'OCA\\DAV\\Connector\\Sabre\\MtimeSanitizer' => __DIR__.'/..'.'/../lib/Connector/Sabre/MtimeSanitizer.php',
235
+        'OCA\\DAV\\Connector\\Sabre\\Node' => __DIR__.'/..'.'/../lib/Connector/Sabre/Node.php',
236
+        'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => __DIR__.'/..'.'/../lib/Connector/Sabre/ObjectTree.php',
237
+        'OCA\\DAV\\Connector\\Sabre\\Principal' => __DIR__.'/..'.'/../lib/Connector/Sabre/Principal.php',
238
+        'OCA\\DAV\\Connector\\Sabre\\PropFindMonitorPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/PropFindMonitorPlugin.php',
239
+        'OCA\\DAV\\Connector\\Sabre\\PropFindPreloadNotifyPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/PropFindPreloadNotifyPlugin.php',
240
+        'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/PropfindCompressionPlugin.php',
241
+        'OCA\\DAV\\Connector\\Sabre\\PublicAuth' => __DIR__.'/..'.'/../lib/Connector/Sabre/PublicAuth.php',
242
+        'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/QuotaPlugin.php',
243
+        'OCA\\DAV\\Connector\\Sabre\\RequestIdHeaderPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/RequestIdHeaderPlugin.php',
244
+        'OCA\\DAV\\Connector\\Sabre\\Server' => __DIR__.'/..'.'/../lib/Connector/Sabre/Server.php',
245
+        'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => __DIR__.'/..'.'/../lib/Connector/Sabre/ServerFactory.php',
246
+        'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => __DIR__.'/..'.'/../lib/Connector/Sabre/ShareTypeList.php',
247
+        'OCA\\DAV\\Connector\\Sabre\\ShareeList' => __DIR__.'/..'.'/../lib/Connector/Sabre/ShareeList.php',
248
+        'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/SharesPlugin.php',
249
+        'OCA\\DAV\\Connector\\Sabre\\TagList' => __DIR__.'/..'.'/../lib/Connector/Sabre/TagList.php',
250
+        'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/TagsPlugin.php',
251
+        'OCA\\DAV\\Connector\\Sabre\\ZipFolderPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/ZipFolderPlugin.php',
252
+        'OCA\\DAV\\Controller\\BirthdayCalendarController' => __DIR__.'/..'.'/../lib/Controller/BirthdayCalendarController.php',
253
+        'OCA\\DAV\\Controller\\DirectController' => __DIR__.'/..'.'/../lib/Controller/DirectController.php',
254
+        'OCA\\DAV\\Controller\\ExampleContentController' => __DIR__.'/..'.'/../lib/Controller/ExampleContentController.php',
255
+        'OCA\\DAV\\Controller\\InvitationResponseController' => __DIR__.'/..'.'/../lib/Controller/InvitationResponseController.php',
256
+        'OCA\\DAV\\Controller\\OutOfOfficeController' => __DIR__.'/..'.'/../lib/Controller/OutOfOfficeController.php',
257
+        'OCA\\DAV\\Controller\\UpcomingEventsController' => __DIR__.'/..'.'/../lib/Controller/UpcomingEventsController.php',
258
+        'OCA\\DAV\\DAV\\CustomPropertiesBackend' => __DIR__.'/..'.'/../lib/DAV/CustomPropertiesBackend.php',
259
+        'OCA\\DAV\\DAV\\GroupPrincipalBackend' => __DIR__.'/..'.'/../lib/DAV/GroupPrincipalBackend.php',
260
+        'OCA\\DAV\\DAV\\PublicAuth' => __DIR__.'/..'.'/../lib/DAV/PublicAuth.php',
261
+        'OCA\\DAV\\DAV\\Sharing\\Backend' => __DIR__.'/..'.'/../lib/DAV/Sharing/Backend.php',
262
+        'OCA\\DAV\\DAV\\Sharing\\IShareable' => __DIR__.'/..'.'/../lib/DAV/Sharing/IShareable.php',
263
+        'OCA\\DAV\\DAV\\Sharing\\Plugin' => __DIR__.'/..'.'/../lib/DAV/Sharing/Plugin.php',
264
+        'OCA\\DAV\\DAV\\Sharing\\SharingMapper' => __DIR__.'/..'.'/../lib/DAV/Sharing/SharingMapper.php',
265
+        'OCA\\DAV\\DAV\\Sharing\\SharingService' => __DIR__.'/..'.'/../lib/DAV/Sharing/SharingService.php',
266
+        'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => __DIR__.'/..'.'/../lib/DAV/Sharing/Xml/Invite.php',
267
+        'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => __DIR__.'/..'.'/../lib/DAV/Sharing/Xml/ShareRequest.php',
268
+        'OCA\\DAV\\DAV\\SystemPrincipalBackend' => __DIR__.'/..'.'/../lib/DAV/SystemPrincipalBackend.php',
269
+        'OCA\\DAV\\DAV\\ViewOnlyPlugin' => __DIR__.'/..'.'/../lib/DAV/ViewOnlyPlugin.php',
270
+        'OCA\\DAV\\Db\\Absence' => __DIR__.'/..'.'/../lib/Db/Absence.php',
271
+        'OCA\\DAV\\Db\\AbsenceMapper' => __DIR__.'/..'.'/../lib/Db/AbsenceMapper.php',
272
+        'OCA\\DAV\\Db\\Direct' => __DIR__.'/..'.'/../lib/Db/Direct.php',
273
+        'OCA\\DAV\\Db\\DirectMapper' => __DIR__.'/..'.'/../lib/Db/DirectMapper.php',
274
+        'OCA\\DAV\\Db\\Property' => __DIR__.'/..'.'/../lib/Db/Property.php',
275
+        'OCA\\DAV\\Db\\PropertyMapper' => __DIR__.'/..'.'/../lib/Db/PropertyMapper.php',
276
+        'OCA\\DAV\\Direct\\DirectFile' => __DIR__.'/..'.'/../lib/Direct/DirectFile.php',
277
+        'OCA\\DAV\\Direct\\DirectHome' => __DIR__.'/..'.'/../lib/Direct/DirectHome.php',
278
+        'OCA\\DAV\\Direct\\Server' => __DIR__.'/..'.'/../lib/Direct/Server.php',
279
+        'OCA\\DAV\\Direct\\ServerFactory' => __DIR__.'/..'.'/../lib/Direct/ServerFactory.php',
280
+        'OCA\\DAV\\Events\\AddressBookCreatedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookCreatedEvent.php',
281
+        'OCA\\DAV\\Events\\AddressBookDeletedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookDeletedEvent.php',
282
+        'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookShareUpdatedEvent.php',
283
+        'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookUpdatedEvent.php',
284
+        'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => __DIR__.'/..'.'/../lib/Events/BeforeFileDirectDownloadedEvent.php',
285
+        'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => __DIR__.'/..'.'/../lib/Events/CachedCalendarObjectCreatedEvent.php',
286
+        'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => __DIR__.'/..'.'/../lib/Events/CachedCalendarObjectDeletedEvent.php',
287
+        'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CachedCalendarObjectUpdatedEvent.php',
288
+        'OCA\\DAV\\Events\\CalendarCreatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarCreatedEvent.php',
289
+        'OCA\\DAV\\Events\\CalendarDeletedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarDeletedEvent.php',
290
+        'OCA\\DAV\\Events\\CalendarMovedToTrashEvent' => __DIR__.'/..'.'/../lib/Events/CalendarMovedToTrashEvent.php',
291
+        'OCA\\DAV\\Events\\CalendarPublishedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarPublishedEvent.php',
292
+        'OCA\\DAV\\Events\\CalendarRestoredEvent' => __DIR__.'/..'.'/../lib/Events/CalendarRestoredEvent.php',
293
+        'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarShareUpdatedEvent.php',
294
+        'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarUnpublishedEvent.php',
295
+        'OCA\\DAV\\Events\\CalendarUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarUpdatedEvent.php',
296
+        'OCA\\DAV\\Events\\CardCreatedEvent' => __DIR__.'/..'.'/../lib/Events/CardCreatedEvent.php',
297
+        'OCA\\DAV\\Events\\CardDeletedEvent' => __DIR__.'/..'.'/../lib/Events/CardDeletedEvent.php',
298
+        'OCA\\DAV\\Events\\CardMovedEvent' => __DIR__.'/..'.'/../lib/Events/CardMovedEvent.php',
299
+        'OCA\\DAV\\Events\\CardUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CardUpdatedEvent.php',
300
+        'OCA\\DAV\\Events\\SabrePluginAddEvent' => __DIR__.'/..'.'/../lib/Events/SabrePluginAddEvent.php',
301
+        'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => __DIR__.'/..'.'/../lib/Events/SabrePluginAuthInitEvent.php',
302
+        'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => __DIR__.'/..'.'/../lib/Events/SubscriptionCreatedEvent.php',
303
+        'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => __DIR__.'/..'.'/../lib/Events/SubscriptionDeletedEvent.php',
304
+        'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/SubscriptionUpdatedEvent.php',
305
+        'OCA\\DAV\\Exception\\ExampleEventException' => __DIR__.'/..'.'/../lib/Exception/ExampleEventException.php',
306
+        'OCA\\DAV\\Exception\\ServerMaintenanceMode' => __DIR__.'/..'.'/../lib/Exception/ServerMaintenanceMode.php',
307
+        'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => __DIR__.'/..'.'/../lib/Exception/UnsupportedLimitOnInitialSyncException.php',
308
+        'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => __DIR__.'/..'.'/../lib/Files/BrowserErrorPagePlugin.php',
309
+        'OCA\\DAV\\Files\\FileSearchBackend' => __DIR__.'/..'.'/../lib/Files/FileSearchBackend.php',
310
+        'OCA\\DAV\\Files\\FilesHome' => __DIR__.'/..'.'/../lib/Files/FilesHome.php',
311
+        'OCA\\DAV\\Files\\LazySearchBackend' => __DIR__.'/..'.'/../lib/Files/LazySearchBackend.php',
312
+        'OCA\\DAV\\Files\\RootCollection' => __DIR__.'/..'.'/../lib/Files/RootCollection.php',
313
+        'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => __DIR__.'/..'.'/../lib/Files/Sharing/FilesDropPlugin.php',
314
+        'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => __DIR__.'/..'.'/../lib/Files/Sharing/PublicLinkCheckPlugin.php',
315
+        'OCA\\DAV\\Files\\Sharing\\RootCollection' => __DIR__.'/..'.'/../lib/Files/Sharing/RootCollection.php',
316
+        'OCA\\DAV\\Listener\\ActivityUpdaterListener' => __DIR__.'/..'.'/../lib/Listener/ActivityUpdaterListener.php',
317
+        'OCA\\DAV\\Listener\\AddMissingIndicesListener' => __DIR__.'/..'.'/../lib/Listener/AddMissingIndicesListener.php',
318
+        'OCA\\DAV\\Listener\\AddressbookListener' => __DIR__.'/..'.'/../lib/Listener/AddressbookListener.php',
319
+        'OCA\\DAV\\Listener\\BirthdayListener' => __DIR__.'/..'.'/../lib/Listener/BirthdayListener.php',
320
+        'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => __DIR__.'/..'.'/../lib/Listener/CalendarContactInteractionListener.php',
321
+        'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => __DIR__.'/..'.'/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php',
322
+        'OCA\\DAV\\Listener\\CalendarObjectReminderUpdaterListener' => __DIR__.'/..'.'/../lib/Listener/CalendarObjectReminderUpdaterListener.php',
323
+        'OCA\\DAV\\Listener\\CalendarPublicationListener' => __DIR__.'/..'.'/../lib/Listener/CalendarPublicationListener.php',
324
+        'OCA\\DAV\\Listener\\CalendarShareUpdateListener' => __DIR__.'/..'.'/../lib/Listener/CalendarShareUpdateListener.php',
325
+        'OCA\\DAV\\Listener\\CardListener' => __DIR__.'/..'.'/../lib/Listener/CardListener.php',
326
+        'OCA\\DAV\\Listener\\ClearPhotoCacheListener' => __DIR__.'/..'.'/../lib/Listener/ClearPhotoCacheListener.php',
327
+        'OCA\\DAV\\Listener\\DavAdminSettingsListener' => __DIR__.'/..'.'/../lib/Listener/DavAdminSettingsListener.php',
328
+        'OCA\\DAV\\Listener\\OutOfOfficeListener' => __DIR__.'/..'.'/../lib/Listener/OutOfOfficeListener.php',
329
+        'OCA\\DAV\\Listener\\SubscriptionListener' => __DIR__.'/..'.'/../lib/Listener/SubscriptionListener.php',
330
+        'OCA\\DAV\\Listener\\TrustedServerRemovedListener' => __DIR__.'/..'.'/../lib/Listener/TrustedServerRemovedListener.php',
331
+        'OCA\\DAV\\Listener\\UserEventsListener' => __DIR__.'/..'.'/../lib/Listener/UserEventsListener.php',
332
+        'OCA\\DAV\\Listener\\UserPreferenceListener' => __DIR__.'/..'.'/../lib/Listener/UserPreferenceListener.php',
333
+        'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => __DIR__.'/..'.'/../lib/Migration/BuildCalendarSearchIndex.php',
334
+        'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => __DIR__.'/..'.'/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php',
335
+        'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => __DIR__.'/..'.'/../lib/Migration/BuildSocialSearchIndex.php',
336
+        'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => __DIR__.'/..'.'/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php',
337
+        'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => __DIR__.'/..'.'/../lib/Migration/CalDAVRemoveEmptyValue.php',
338
+        'OCA\\DAV\\Migration\\ChunkCleanup' => __DIR__.'/..'.'/../lib/Migration/ChunkCleanup.php',
339
+        'OCA\\DAV\\Migration\\CreateSystemAddressBookStep' => __DIR__.'/..'.'/../lib/Migration/CreateSystemAddressBookStep.php',
340
+        'OCA\\DAV\\Migration\\DeleteSchedulingObjects' => __DIR__.'/..'.'/../lib/Migration/DeleteSchedulingObjects.php',
341
+        'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => __DIR__.'/..'.'/../lib/Migration/FixBirthdayCalendarComponent.php',
342
+        'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => __DIR__.'/..'.'/../lib/Migration/RefreshWebcalJobRegistrar.php',
343
+        'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => __DIR__.'/..'.'/../lib/Migration/RegenerateBirthdayCalendars.php',
344
+        'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => __DIR__.'/..'.'/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php',
345
+        'OCA\\DAV\\Migration\\RegisterUpdateCalendarResourcesRoomBackgroundJob' => __DIR__.'/..'.'/../lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php',
346
+        'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => __DIR__.'/..'.'/../lib/Migration/RemoveClassifiedEventActivity.php',
347
+        'OCA\\DAV\\Migration\\RemoveDeletedUsersCalendarSubscriptions' => __DIR__.'/..'.'/../lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php',
348
+        'OCA\\DAV\\Migration\\RemoveObjectProperties' => __DIR__.'/..'.'/../lib/Migration/RemoveObjectProperties.php',
349
+        'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => __DIR__.'/..'.'/../lib/Migration/RemoveOrphanEventsAndContacts.php',
350
+        'OCA\\DAV\\Migration\\Version1004Date20170825134824' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170825134824.php',
351
+        'OCA\\DAV\\Migration\\Version1004Date20170919104507' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170919104507.php',
352
+        'OCA\\DAV\\Migration\\Version1004Date20170924124212' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170924124212.php',
353
+        'OCA\\DAV\\Migration\\Version1004Date20170926103422' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170926103422.php',
354
+        'OCA\\DAV\\Migration\\Version1005Date20180413093149' => __DIR__.'/..'.'/../lib/Migration/Version1005Date20180413093149.php',
355
+        'OCA\\DAV\\Migration\\Version1005Date20180530124431' => __DIR__.'/..'.'/../lib/Migration/Version1005Date20180530124431.php',
356
+        'OCA\\DAV\\Migration\\Version1006Date20180619154313' => __DIR__.'/..'.'/../lib/Migration/Version1006Date20180619154313.php',
357
+        'OCA\\DAV\\Migration\\Version1006Date20180628111625' => __DIR__.'/..'.'/../lib/Migration/Version1006Date20180628111625.php',
358
+        'OCA\\DAV\\Migration\\Version1008Date20181030113700' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181030113700.php',
359
+        'OCA\\DAV\\Migration\\Version1008Date20181105104826' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105104826.php',
360
+        'OCA\\DAV\\Migration\\Version1008Date20181105104833' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105104833.php',
361
+        'OCA\\DAV\\Migration\\Version1008Date20181105110300' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105110300.php',
362
+        'OCA\\DAV\\Migration\\Version1008Date20181105112049' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105112049.php',
363
+        'OCA\\DAV\\Migration\\Version1008Date20181114084440' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181114084440.php',
364
+        'OCA\\DAV\\Migration\\Version1011Date20190725113607' => __DIR__.'/..'.'/../lib/Migration/Version1011Date20190725113607.php',
365
+        'OCA\\DAV\\Migration\\Version1011Date20190806104428' => __DIR__.'/..'.'/../lib/Migration/Version1011Date20190806104428.php',
366
+        'OCA\\DAV\\Migration\\Version1012Date20190808122342' => __DIR__.'/..'.'/../lib/Migration/Version1012Date20190808122342.php',
367
+        'OCA\\DAV\\Migration\\Version1016Date20201109085907' => __DIR__.'/..'.'/../lib/Migration/Version1016Date20201109085907.php',
368
+        'OCA\\DAV\\Migration\\Version1017Date20210216083742' => __DIR__.'/..'.'/../lib/Migration/Version1017Date20210216083742.php',
369
+        'OCA\\DAV\\Migration\\Version1018Date20210312100735' => __DIR__.'/..'.'/../lib/Migration/Version1018Date20210312100735.php',
370
+        'OCA\\DAV\\Migration\\Version1024Date20211221144219' => __DIR__.'/..'.'/../lib/Migration/Version1024Date20211221144219.php',
371
+        'OCA\\DAV\\Migration\\Version1025Date20240308063933' => __DIR__.'/..'.'/../lib/Migration/Version1025Date20240308063933.php',
372
+        'OCA\\DAV\\Migration\\Version1027Date20230504122946' => __DIR__.'/..'.'/../lib/Migration/Version1027Date20230504122946.php',
373
+        'OCA\\DAV\\Migration\\Version1029Date20221114151721' => __DIR__.'/..'.'/../lib/Migration/Version1029Date20221114151721.php',
374
+        'OCA\\DAV\\Migration\\Version1029Date20231004091403' => __DIR__.'/..'.'/../lib/Migration/Version1029Date20231004091403.php',
375
+        'OCA\\DAV\\Migration\\Version1030Date20240205103243' => __DIR__.'/..'.'/../lib/Migration/Version1030Date20240205103243.php',
376
+        'OCA\\DAV\\Migration\\Version1031Date20240610134258' => __DIR__.'/..'.'/../lib/Migration/Version1031Date20240610134258.php',
377
+        'OCA\\DAV\\Migration\\Version1034Date20250813093701' => __DIR__.'/..'.'/../lib/Migration/Version1034Date20250813093701.php',
378
+        'OCA\\DAV\\Model\\ExampleEvent' => __DIR__.'/..'.'/../lib/Model/ExampleEvent.php',
379
+        'OCA\\DAV\\Paginate\\LimitedCopyIterator' => __DIR__.'/..'.'/../lib/Paginate/LimitedCopyIterator.php',
380
+        'OCA\\DAV\\Paginate\\PaginateCache' => __DIR__.'/..'.'/../lib/Paginate/PaginateCache.php',
381
+        'OCA\\DAV\\Paginate\\PaginatePlugin' => __DIR__.'/..'.'/../lib/Paginate/PaginatePlugin.php',
382
+        'OCA\\DAV\\Profiler\\ProfilerPlugin' => __DIR__.'/..'.'/../lib/Profiler/ProfilerPlugin.php',
383
+        'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => __DIR__.'/..'.'/../lib/Provisioning/Apple/AppleProvisioningNode.php',
384
+        'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => __DIR__.'/..'.'/../lib/Provisioning/Apple/AppleProvisioningPlugin.php',
385
+        'OCA\\DAV\\ResponseDefinitions' => __DIR__.'/..'.'/../lib/ResponseDefinitions.php',
386
+        'OCA\\DAV\\RootCollection' => __DIR__.'/..'.'/../lib/RootCollection.php',
387
+        'OCA\\DAV\\Search\\ACalendarSearchProvider' => __DIR__.'/..'.'/../lib/Search/ACalendarSearchProvider.php',
388
+        'OCA\\DAV\\Search\\ContactsSearchProvider' => __DIR__.'/..'.'/../lib/Search/ContactsSearchProvider.php',
389
+        'OCA\\DAV\\Search\\EventsSearchProvider' => __DIR__.'/..'.'/../lib/Search/EventsSearchProvider.php',
390
+        'OCA\\DAV\\Search\\TasksSearchProvider' => __DIR__.'/..'.'/../lib/Search/TasksSearchProvider.php',
391
+        'OCA\\DAV\\Server' => __DIR__.'/..'.'/../lib/Server.php',
392
+        'OCA\\DAV\\ServerFactory' => __DIR__.'/..'.'/../lib/ServerFactory.php',
393
+        'OCA\\DAV\\Service\\AbsenceService' => __DIR__.'/..'.'/../lib/Service/AbsenceService.php',
394
+        'OCA\\DAV\\Service\\ExampleContactService' => __DIR__.'/..'.'/../lib/Service/ExampleContactService.php',
395
+        'OCA\\DAV\\Service\\ExampleEventService' => __DIR__.'/..'.'/../lib/Service/ExampleEventService.php',
396
+        'OCA\\DAV\\Settings\\Admin\\SystemAddressBookSettings' => __DIR__.'/..'.'/../lib/Settings/Admin/SystemAddressBookSettings.php',
397
+        'OCA\\DAV\\Settings\\AvailabilitySettings' => __DIR__.'/..'.'/../lib/Settings/AvailabilitySettings.php',
398
+        'OCA\\DAV\\Settings\\CalDAVSettings' => __DIR__.'/..'.'/../lib/Settings/CalDAVSettings.php',
399
+        'OCA\\DAV\\Settings\\ExampleContentSettings' => __DIR__.'/..'.'/../lib/Settings/ExampleContentSettings.php',
400
+        'OCA\\DAV\\SetupChecks\\NeedsSystemAddressBookSync' => __DIR__.'/..'.'/../lib/SetupChecks/NeedsSystemAddressBookSync.php',
401
+        'OCA\\DAV\\SetupChecks\\WebdavEndpoint' => __DIR__.'/..'.'/../lib/SetupChecks/WebdavEndpoint.php',
402
+        'OCA\\DAV\\Storage\\PublicOwnerWrapper' => __DIR__.'/..'.'/../lib/Storage/PublicOwnerWrapper.php',
403
+        'OCA\\DAV\\Storage\\PublicShareWrapper' => __DIR__.'/..'.'/../lib/Storage/PublicShareWrapper.php',
404
+        'OCA\\DAV\\SystemTag\\SystemTagList' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagList.php',
405
+        'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagMappingNode.php',
406
+        'OCA\\DAV\\SystemTag\\SystemTagNode' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagNode.php',
407
+        'OCA\\DAV\\SystemTag\\SystemTagObjectType' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagObjectType.php',
408
+        'OCA\\DAV\\SystemTag\\SystemTagPlugin' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagPlugin.php',
409
+        'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsByIdCollection.php',
410
+        'OCA\\DAV\\SystemTag\\SystemTagsInUseCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsInUseCollection.php',
411
+        'OCA\\DAV\\SystemTag\\SystemTagsObjectList' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsObjectList.php',
412
+        'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsObjectMappingCollection.php',
413
+        'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsObjectTypeCollection.php',
414
+        'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsRelationsCollection.php',
415
+        'OCA\\DAV\\Traits\\PrincipalProxyTrait' => __DIR__.'/..'.'/../lib/Traits/PrincipalProxyTrait.php',
416
+        'OCA\\DAV\\Upload\\AssemblyStream' => __DIR__.'/..'.'/../lib/Upload/AssemblyStream.php',
417
+        'OCA\\DAV\\Upload\\ChunkingPlugin' => __DIR__.'/..'.'/../lib/Upload/ChunkingPlugin.php',
418
+        'OCA\\DAV\\Upload\\ChunkingV2Plugin' => __DIR__.'/..'.'/../lib/Upload/ChunkingV2Plugin.php',
419
+        'OCA\\DAV\\Upload\\CleanupService' => __DIR__.'/..'.'/../lib/Upload/CleanupService.php',
420
+        'OCA\\DAV\\Upload\\FutureFile' => __DIR__.'/..'.'/../lib/Upload/FutureFile.php',
421
+        'OCA\\DAV\\Upload\\PartFile' => __DIR__.'/..'.'/../lib/Upload/PartFile.php',
422
+        'OCA\\DAV\\Upload\\RootCollection' => __DIR__.'/..'.'/../lib/Upload/RootCollection.php',
423
+        'OCA\\DAV\\Upload\\UploadAutoMkcolPlugin' => __DIR__.'/..'.'/../lib/Upload/UploadAutoMkcolPlugin.php',
424
+        'OCA\\DAV\\Upload\\UploadFile' => __DIR__.'/..'.'/../lib/Upload/UploadFile.php',
425
+        'OCA\\DAV\\Upload\\UploadFolder' => __DIR__.'/..'.'/../lib/Upload/UploadFolder.php',
426
+        'OCA\\DAV\\Upload\\UploadHome' => __DIR__.'/..'.'/../lib/Upload/UploadHome.php',
427
+        'OCA\\DAV\\UserMigration\\CalendarMigrator' => __DIR__.'/..'.'/../lib/UserMigration/CalendarMigrator.php',
428
+        'OCA\\DAV\\UserMigration\\CalendarMigratorException' => __DIR__.'/..'.'/../lib/UserMigration/CalendarMigratorException.php',
429
+        'OCA\\DAV\\UserMigration\\ContactsMigrator' => __DIR__.'/..'.'/../lib/UserMigration/ContactsMigrator.php',
430
+        'OCA\\DAV\\UserMigration\\ContactsMigratorException' => __DIR__.'/..'.'/../lib/UserMigration/ContactsMigratorException.php',
431
+        'OCA\\DAV\\UserMigration\\InvalidAddressBookException' => __DIR__.'/..'.'/../lib/UserMigration/InvalidAddressBookException.php',
432
+        'OCA\\DAV\\UserMigration\\InvalidCalendarException' => __DIR__.'/..'.'/../lib/UserMigration/InvalidCalendarException.php',
433 433
     );
434 434
 
435 435
     public static function getInitializer(ClassLoader $loader)
436 436
     {
437
-        return \Closure::bind(function () use ($loader) {
437
+        return \Closure::bind(function() use ($loader) {
438 438
             $loader->prefixLengthsPsr4 = ComposerStaticInitDAV::$prefixLengthsPsr4;
439 439
             $loader->prefixDirsPsr4 = ComposerStaticInitDAV::$prefixDirsPsr4;
440 440
             $loader->classMap = ComposerStaticInitDAV::$classMap;
Please login to merge, or discard this patch.
apps/dav/composer/composer/autoload_classmap.php 1 patch
Spacing   +409 added lines, -409 removed lines patch added patch discarded remove patch
@@ -6,413 +6,413 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10
-    'OCA\\DAV\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
11
-    'OCA\\DAV\\AppInfo\\PluginManager' => $baseDir . '/../lib/AppInfo/PluginManager.php',
12
-    'OCA\\DAV\\Avatars\\AvatarHome' => $baseDir . '/../lib/Avatars/AvatarHome.php',
13
-    'OCA\\DAV\\Avatars\\AvatarNode' => $baseDir . '/../lib/Avatars/AvatarNode.php',
14
-    'OCA\\DAV\\Avatars\\RootCollection' => $baseDir . '/../lib/Avatars/RootCollection.php',
15
-    'OCA\\DAV\\BackgroundJob\\BuildReminderIndexBackgroundJob' => $baseDir . '/../lib/BackgroundJob/BuildReminderIndexBackgroundJob.php',
16
-    'OCA\\DAV\\BackgroundJob\\CalendarRetentionJob' => $baseDir . '/../lib/BackgroundJob/CalendarRetentionJob.php',
17
-    'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => $baseDir . '/../lib/BackgroundJob/CleanupDirectLinksJob.php',
18
-    'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => $baseDir . '/../lib/BackgroundJob/CleanupInvitationTokenJob.php',
19
-    'OCA\\DAV\\BackgroundJob\\CleanupOrphanedChildrenJob' => $baseDir . '/../lib/BackgroundJob/CleanupOrphanedChildrenJob.php',
20
-    'OCA\\DAV\\BackgroundJob\\DeleteOutdatedSchedulingObjects' => $baseDir . '/../lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php',
21
-    'OCA\\DAV\\BackgroundJob\\EventReminderJob' => $baseDir . '/../lib/BackgroundJob/EventReminderJob.php',
22
-    'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => $baseDir . '/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php',
23
-    'OCA\\DAV\\BackgroundJob\\OutOfOfficeEventDispatcherJob' => $baseDir . '/../lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php',
24
-    'OCA\\DAV\\BackgroundJob\\PruneOutdatedSyncTokensJob' => $baseDir . '/../lib/BackgroundJob/PruneOutdatedSyncTokensJob.php',
25
-    'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => $baseDir . '/../lib/BackgroundJob/RefreshWebcalJob.php',
26
-    'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => $baseDir . '/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php',
27
-    'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => $baseDir . '/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php',
28
-    'OCA\\DAV\\BackgroundJob\\UploadCleanup' => $baseDir . '/../lib/BackgroundJob/UploadCleanup.php',
29
-    'OCA\\DAV\\BackgroundJob\\UserStatusAutomation' => $baseDir . '/../lib/BackgroundJob/UserStatusAutomation.php',
30
-    'OCA\\DAV\\BulkUpload\\BulkUploadPlugin' => $baseDir . '/../lib/BulkUpload/BulkUploadPlugin.php',
31
-    'OCA\\DAV\\BulkUpload\\MultipartRequestParser' => $baseDir . '/../lib/BulkUpload/MultipartRequestParser.php',
32
-    'OCA\\DAV\\CalDAV\\Activity\\Backend' => $baseDir . '/../lib/CalDAV/Activity/Backend.php',
33
-    'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Filter/Calendar.php',
34
-    'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Filter/Todo.php',
35
-    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => $baseDir . '/../lib/CalDAV/Activity/Provider/Base.php',
36
-    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Provider/Calendar.php',
37
-    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => $baseDir . '/../lib/CalDAV/Activity/Provider/Event.php',
38
-    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Provider/Todo.php',
39
-    'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => $baseDir . '/../lib/CalDAV/Activity/Setting/CalDAVSetting.php',
40
-    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Setting/Calendar.php',
41
-    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => $baseDir . '/../lib/CalDAV/Activity/Setting/Event.php',
42
-    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Setting/Todo.php',
43
-    'OCA\\DAV\\CalDAV\\AppCalendar\\AppCalendar' => $baseDir . '/../lib/CalDAV/AppCalendar/AppCalendar.php',
44
-    'OCA\\DAV\\CalDAV\\AppCalendar\\AppCalendarPlugin' => $baseDir . '/../lib/CalDAV/AppCalendar/AppCalendarPlugin.php',
45
-    'OCA\\DAV\\CalDAV\\AppCalendar\\CalendarObject' => $baseDir . '/../lib/CalDAV/AppCalendar/CalendarObject.php',
46
-    'OCA\\DAV\\CalDAV\\Auth\\CustomPrincipalPlugin' => $baseDir . '/../lib/CalDAV/Auth/CustomPrincipalPlugin.php',
47
-    'OCA\\DAV\\CalDAV\\Auth\\PublicPrincipalPlugin' => $baseDir . '/../lib/CalDAV/Auth/PublicPrincipalPlugin.php',
48
-    'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => $baseDir . '/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php',
49
-    'OCA\\DAV\\CalDAV\\BirthdayService' => $baseDir . '/../lib/CalDAV/BirthdayService.php',
50
-    'OCA\\DAV\\CalDAV\\CachedSubscription' => $baseDir . '/../lib/CalDAV/CachedSubscription.php',
51
-    'OCA\\DAV\\CalDAV\\CachedSubscriptionImpl' => $baseDir . '/../lib/CalDAV/CachedSubscriptionImpl.php',
52
-    'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => $baseDir . '/../lib/CalDAV/CachedSubscriptionObject.php',
53
-    'OCA\\DAV\\CalDAV\\CachedSubscriptionProvider' => $baseDir . '/../lib/CalDAV/CachedSubscriptionProvider.php',
54
-    'OCA\\DAV\\CalDAV\\CalDavBackend' => $baseDir . '/../lib/CalDAV/CalDavBackend.php',
55
-    'OCA\\DAV\\CalDAV\\Calendar' => $baseDir . '/../lib/CalDAV/Calendar.php',
56
-    'OCA\\DAV\\CalDAV\\CalendarHome' => $baseDir . '/../lib/CalDAV/CalendarHome.php',
57
-    'OCA\\DAV\\CalDAV\\CalendarImpl' => $baseDir . '/../lib/CalDAV/CalendarImpl.php',
58
-    'OCA\\DAV\\CalDAV\\CalendarManager' => $baseDir . '/../lib/CalDAV/CalendarManager.php',
59
-    'OCA\\DAV\\CalDAV\\CalendarObject' => $baseDir . '/../lib/CalDAV/CalendarObject.php',
60
-    'OCA\\DAV\\CalDAV\\CalendarProvider' => $baseDir . '/../lib/CalDAV/CalendarProvider.php',
61
-    'OCA\\DAV\\CalDAV\\CalendarRoot' => $baseDir . '/../lib/CalDAV/CalendarRoot.php',
62
-    'OCA\\DAV\\CalDAV\\DefaultCalendarValidator' => $baseDir . '/../lib/CalDAV/DefaultCalendarValidator.php',
63
-    'OCA\\DAV\\CalDAV\\EmbeddedCalDavServer' => $baseDir . '/../lib/CalDAV/EmbeddedCalDavServer.php',
64
-    'OCA\\DAV\\CalDAV\\EventComparisonService' => $baseDir . '/../lib/CalDAV/EventComparisonService.php',
65
-    'OCA\\DAV\\CalDAV\\EventReader' => $baseDir . '/../lib/CalDAV/EventReader.php',
66
-    'OCA\\DAV\\CalDAV\\EventReaderRDate' => $baseDir . '/../lib/CalDAV/EventReaderRDate.php',
67
-    'OCA\\DAV\\CalDAV\\EventReaderRRule' => $baseDir . '/../lib/CalDAV/EventReaderRRule.php',
68
-    'OCA\\DAV\\CalDAV\\Export\\ExportService' => $baseDir . '/../lib/CalDAV/Export/ExportService.php',
69
-    'OCA\\DAV\\CalDAV\\FreeBusy\\FreeBusyGenerator' => $baseDir . '/../lib/CalDAV/FreeBusy/FreeBusyGenerator.php',
70
-    'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => $baseDir . '/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
71
-    'OCA\\DAV\\CalDAV\\IRestorable' => $baseDir . '/../lib/CalDAV/IRestorable.php',
72
-    'OCA\\DAV\\CalDAV\\Import\\ImportService' => $baseDir . '/../lib/CalDAV/Import/ImportService.php',
73
-    'OCA\\DAV\\CalDAV\\Import\\TextImporter' => $baseDir . '/../lib/CalDAV/Import/TextImporter.php',
74
-    'OCA\\DAV\\CalDAV\\Import\\XmlImporter' => $baseDir . '/../lib/CalDAV/Import/XmlImporter.php',
75
-    'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => $baseDir . '/../lib/CalDAV/Integration/ExternalCalendar.php',
76
-    'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => $baseDir . '/../lib/CalDAV/Integration/ICalendarProvider.php',
77
-    'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => $baseDir . '/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php',
78
-    'OCA\\DAV\\CalDAV\\Outbox' => $baseDir . '/../lib/CalDAV/Outbox.php',
79
-    'OCA\\DAV\\CalDAV\\Plugin' => $baseDir . '/../lib/CalDAV/Plugin.php',
80
-    'OCA\\DAV\\CalDAV\\Principal\\Collection' => $baseDir . '/../lib/CalDAV/Principal/Collection.php',
81
-    'OCA\\DAV\\CalDAV\\Principal\\User' => $baseDir . '/../lib/CalDAV/Principal/User.php',
82
-    'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => $baseDir . '/../lib/CalDAV/Proxy/Proxy.php',
83
-    'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => $baseDir . '/../lib/CalDAV/Proxy/ProxyMapper.php',
84
-    'OCA\\DAV\\CalDAV\\PublicCalendar' => $baseDir . '/../lib/CalDAV/PublicCalendar.php',
85
-    'OCA\\DAV\\CalDAV\\PublicCalendarObject' => $baseDir . '/../lib/CalDAV/PublicCalendarObject.php',
86
-    'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => $baseDir . '/../lib/CalDAV/PublicCalendarRoot.php',
87
-    'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => $baseDir . '/../lib/CalDAV/Publishing/PublishPlugin.php',
88
-    'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => $baseDir . '/../lib/CalDAV/Publishing/Xml/Publisher.php',
89
-    'OCA\\DAV\\CalDAV\\Reminder\\Backend' => $baseDir . '/../lib/CalDAV/Reminder/Backend.php',
90
-    'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => $baseDir . '/../lib/CalDAV/Reminder/INotificationProvider.php',
91
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProviderManager.php',
92
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php',
93
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php',
94
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php',
95
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php',
96
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php',
97
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => $baseDir . '/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php',
98
-    'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => $baseDir . '/../lib/CalDAV/Reminder/Notifier.php',
99
-    'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => $baseDir . '/../lib/CalDAV/Reminder/ReminderService.php',
100
-    'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php',
101
-    'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php',
102
-    'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php',
103
-    'OCA\\DAV\\CalDAV\\RetentionService' => $baseDir . '/../lib/CalDAV/RetentionService.php',
104
-    'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => $baseDir . '/../lib/CalDAV/Schedule/IMipPlugin.php',
105
-    'OCA\\DAV\\CalDAV\\Schedule\\IMipService' => $baseDir . '/../lib/CalDAV/Schedule/IMipService.php',
106
-    'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => $baseDir . '/../lib/CalDAV/Schedule/Plugin.php',
107
-    'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => $baseDir . '/../lib/CalDAV/Search/SearchPlugin.php',
108
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/CompFilter.php',
109
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php',
110
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php',
111
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php',
112
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/PropFilter.php',
113
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php',
114
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => $baseDir . '/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php',
115
-    'OCA\\DAV\\CalDAV\\Security\\RateLimitingPlugin' => $baseDir . '/../lib/CalDAV/Security/RateLimitingPlugin.php',
116
-    'OCA\\DAV\\CalDAV\\Sharing\\Backend' => $baseDir . '/../lib/CalDAV/Sharing/Backend.php',
117
-    'OCA\\DAV\\CalDAV\\Sharing\\Service' => $baseDir . '/../lib/CalDAV/Sharing/Service.php',
118
-    'OCA\\DAV\\CalDAV\\Status\\StatusService' => $baseDir . '/../lib/CalDAV/Status/StatusService.php',
119
-    'OCA\\DAV\\CalDAV\\TimeZoneFactory' => $baseDir . '/../lib/CalDAV/TimeZoneFactory.php',
120
-    'OCA\\DAV\\CalDAV\\TimezoneService' => $baseDir . '/../lib/CalDAV/TimezoneService.php',
121
-    'OCA\\DAV\\CalDAV\\TipBroker' => $baseDir . '/../lib/CalDAV/TipBroker.php',
122
-    'OCA\\DAV\\CalDAV\\Trashbin\\DeletedCalendarObject' => $baseDir . '/../lib/CalDAV/Trashbin/DeletedCalendarObject.php',
123
-    'OCA\\DAV\\CalDAV\\Trashbin\\DeletedCalendarObjectsCollection' => $baseDir . '/../lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php',
124
-    'OCA\\DAV\\CalDAV\\Trashbin\\Plugin' => $baseDir . '/../lib/CalDAV/Trashbin/Plugin.php',
125
-    'OCA\\DAV\\CalDAV\\Trashbin\\RestoreTarget' => $baseDir . '/../lib/CalDAV/Trashbin/RestoreTarget.php',
126
-    'OCA\\DAV\\CalDAV\\Trashbin\\TrashbinHome' => $baseDir . '/../lib/CalDAV/Trashbin/TrashbinHome.php',
127
-    'OCA\\DAV\\CalDAV\\UpcomingEvent' => $baseDir . '/../lib/CalDAV/UpcomingEvent.php',
128
-    'OCA\\DAV\\CalDAV\\UpcomingEventsService' => $baseDir . '/../lib/CalDAV/UpcomingEventsService.php',
129
-    'OCA\\DAV\\CalDAV\\Validation\\CalDavValidatePlugin' => $baseDir . '/../lib/CalDAV/Validation/CalDavValidatePlugin.php',
130
-    'OCA\\DAV\\CalDAV\\WebcalCaching\\Connection' => $baseDir . '/../lib/CalDAV/WebcalCaching/Connection.php',
131
-    'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => $baseDir . '/../lib/CalDAV/WebcalCaching/Plugin.php',
132
-    'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => $baseDir . '/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php',
133
-    'OCA\\DAV\\Capabilities' => $baseDir . '/../lib/Capabilities.php',
134
-    'OCA\\DAV\\CardDAV\\Activity\\Backend' => $baseDir . '/../lib/CardDAV/Activity/Backend.php',
135
-    'OCA\\DAV\\CardDAV\\Activity\\Filter' => $baseDir . '/../lib/CardDAV/Activity/Filter.php',
136
-    'OCA\\DAV\\CardDAV\\Activity\\Provider\\Addressbook' => $baseDir . '/../lib/CardDAV/Activity/Provider/Addressbook.php',
137
-    'OCA\\DAV\\CardDAV\\Activity\\Provider\\Base' => $baseDir . '/../lib/CardDAV/Activity/Provider/Base.php',
138
-    'OCA\\DAV\\CardDAV\\Activity\\Provider\\Card' => $baseDir . '/../lib/CardDAV/Activity/Provider/Card.php',
139
-    'OCA\\DAV\\CardDAV\\Activity\\Setting' => $baseDir . '/../lib/CardDAV/Activity/Setting.php',
140
-    'OCA\\DAV\\CardDAV\\AddressBook' => $baseDir . '/../lib/CardDAV/AddressBook.php',
141
-    'OCA\\DAV\\CardDAV\\AddressBookImpl' => $baseDir . '/../lib/CardDAV/AddressBookImpl.php',
142
-    'OCA\\DAV\\CardDAV\\AddressBookRoot' => $baseDir . '/../lib/CardDAV/AddressBookRoot.php',
143
-    'OCA\\DAV\\CardDAV\\Card' => $baseDir . '/../lib/CardDAV/Card.php',
144
-    'OCA\\DAV\\CardDAV\\CardDavBackend' => $baseDir . '/../lib/CardDAV/CardDavBackend.php',
145
-    'OCA\\DAV\\CardDAV\\ContactsManager' => $baseDir . '/../lib/CardDAV/ContactsManager.php',
146
-    'OCA\\DAV\\CardDAV\\Converter' => $baseDir . '/../lib/CardDAV/Converter.php',
147
-    'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => $baseDir . '/../lib/CardDAV/HasPhotoPlugin.php',
148
-    'OCA\\DAV\\CardDAV\\ImageExportPlugin' => $baseDir . '/../lib/CardDAV/ImageExportPlugin.php',
149
-    'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => $baseDir . '/../lib/CardDAV/Integration/ExternalAddressBook.php',
150
-    'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => $baseDir . '/../lib/CardDAV/Integration/IAddressBookProvider.php',
151
-    'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => $baseDir . '/../lib/CardDAV/MultiGetExportPlugin.php',
152
-    'OCA\\DAV\\CardDAV\\PhotoCache' => $baseDir . '/../lib/CardDAV/PhotoCache.php',
153
-    'OCA\\DAV\\CardDAV\\Plugin' => $baseDir . '/../lib/CardDAV/Plugin.php',
154
-    'OCA\\DAV\\CardDAV\\Security\\CardDavRateLimitingPlugin' => $baseDir . '/../lib/CardDAV/Security/CardDavRateLimitingPlugin.php',
155
-    'OCA\\DAV\\CardDAV\\Sharing\\Backend' => $baseDir . '/../lib/CardDAV/Sharing/Backend.php',
156
-    'OCA\\DAV\\CardDAV\\Sharing\\Service' => $baseDir . '/../lib/CardDAV/Sharing/Service.php',
157
-    'OCA\\DAV\\CardDAV\\SyncService' => $baseDir . '/../lib/CardDAV/SyncService.php',
158
-    'OCA\\DAV\\CardDAV\\SystemAddressbook' => $baseDir . '/../lib/CardDAV/SystemAddressbook.php',
159
-    'OCA\\DAV\\CardDAV\\UserAddressBooks' => $baseDir . '/../lib/CardDAV/UserAddressBooks.php',
160
-    'OCA\\DAV\\CardDAV\\Validation\\CardDavValidatePlugin' => $baseDir . '/../lib/CardDAV/Validation/CardDavValidatePlugin.php',
161
-    'OCA\\DAV\\CardDAV\\Xml\\Groups' => $baseDir . '/../lib/CardDAV/Xml/Groups.php',
162
-    'OCA\\DAV\\Command\\ClearCalendarUnshares' => $baseDir . '/../lib/Command/ClearCalendarUnshares.php',
163
-    'OCA\\DAV\\Command\\ClearContactsPhotoCache' => $baseDir . '/../lib/Command/ClearContactsPhotoCache.php',
164
-    'OCA\\DAV\\Command\\CreateAddressBook' => $baseDir . '/../lib/Command/CreateAddressBook.php',
165
-    'OCA\\DAV\\Command\\CreateCalendar' => $baseDir . '/../lib/Command/CreateCalendar.php',
166
-    'OCA\\DAV\\Command\\CreateSubscription' => $baseDir . '/../lib/Command/CreateSubscription.php',
167
-    'OCA\\DAV\\Command\\DeleteCalendar' => $baseDir . '/../lib/Command/DeleteCalendar.php',
168
-    'OCA\\DAV\\Command\\DeleteSubscription' => $baseDir . '/../lib/Command/DeleteSubscription.php',
169
-    'OCA\\DAV\\Command\\ExportCalendar' => $baseDir . '/../lib/Command/ExportCalendar.php',
170
-    'OCA\\DAV\\Command\\FixCalendarSyncCommand' => $baseDir . '/../lib/Command/FixCalendarSyncCommand.php',
171
-    'OCA\\DAV\\Command\\GetAbsenceCommand' => $baseDir . '/../lib/Command/GetAbsenceCommand.php',
172
-    'OCA\\DAV\\Command\\ImportCalendar' => $baseDir . '/../lib/Command/ImportCalendar.php',
173
-    'OCA\\DAV\\Command\\ListAddressbooks' => $baseDir . '/../lib/Command/ListAddressbooks.php',
174
-    'OCA\\DAV\\Command\\ListCalendarShares' => $baseDir . '/../lib/Command/ListCalendarShares.php',
175
-    'OCA\\DAV\\Command\\ListCalendars' => $baseDir . '/../lib/Command/ListCalendars.php',
176
-    'OCA\\DAV\\Command\\ListSubscriptions' => $baseDir . '/../lib/Command/ListSubscriptions.php',
177
-    'OCA\\DAV\\Command\\MoveCalendar' => $baseDir . '/../lib/Command/MoveCalendar.php',
178
-    'OCA\\DAV\\Command\\RemoveInvalidShares' => $baseDir . '/../lib/Command/RemoveInvalidShares.php',
179
-    'OCA\\DAV\\Command\\RetentionCleanupCommand' => $baseDir . '/../lib/Command/RetentionCleanupCommand.php',
180
-    'OCA\\DAV\\Command\\SendEventReminders' => $baseDir . '/../lib/Command/SendEventReminders.php',
181
-    'OCA\\DAV\\Command\\SetAbsenceCommand' => $baseDir . '/../lib/Command/SetAbsenceCommand.php',
182
-    'OCA\\DAV\\Command\\SyncBirthdayCalendar' => $baseDir . '/../lib/Command/SyncBirthdayCalendar.php',
183
-    'OCA\\DAV\\Command\\SyncSystemAddressBook' => $baseDir . '/../lib/Command/SyncSystemAddressBook.php',
184
-    'OCA\\DAV\\Comments\\CommentNode' => $baseDir . '/../lib/Comments/CommentNode.php',
185
-    'OCA\\DAV\\Comments\\CommentsPlugin' => $baseDir . '/../lib/Comments/CommentsPlugin.php',
186
-    'OCA\\DAV\\Comments\\EntityCollection' => $baseDir . '/../lib/Comments/EntityCollection.php',
187
-    'OCA\\DAV\\Comments\\EntityTypeCollection' => $baseDir . '/../lib/Comments/EntityTypeCollection.php',
188
-    'OCA\\DAV\\Comments\\RootCollection' => $baseDir . '/../lib/Comments/RootCollection.php',
189
-    'OCA\\DAV\\Connector\\LegacyDAVACL' => $baseDir . '/../lib/Connector/LegacyDAVACL.php',
190
-    'OCA\\DAV\\Connector\\LegacyPublicAuth' => $baseDir . '/../lib/Connector/LegacyPublicAuth.php',
191
-    'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => $baseDir . '/../lib/Connector/Sabre/AnonymousOptionsPlugin.php',
192
-    'OCA\\DAV\\Connector\\Sabre\\AppleQuirksPlugin' => $baseDir . '/../lib/Connector/Sabre/AppleQuirksPlugin.php',
193
-    'OCA\\DAV\\Connector\\Sabre\\Auth' => $baseDir . '/../lib/Connector/Sabre/Auth.php',
194
-    'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => $baseDir . '/../lib/Connector/Sabre/BearerAuth.php',
195
-    'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => $baseDir . '/../lib/Connector/Sabre/BlockLegacyClientPlugin.php',
196
-    'OCA\\DAV\\Connector\\Sabre\\CachingTree' => $baseDir . '/../lib/Connector/Sabre/CachingTree.php',
197
-    'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => $baseDir . '/../lib/Connector/Sabre/ChecksumList.php',
198
-    'OCA\\DAV\\Connector\\Sabre\\ChecksumUpdatePlugin' => $baseDir . '/../lib/Connector/Sabre/ChecksumUpdatePlugin.php',
199
-    'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => $baseDir . '/../lib/Connector/Sabre/CommentPropertiesPlugin.php',
200
-    'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => $baseDir . '/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php',
201
-    'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => $baseDir . '/../lib/Connector/Sabre/DavAclPlugin.php',
202
-    'OCA\\DAV\\Connector\\Sabre\\Directory' => $baseDir . '/../lib/Connector/Sabre/Directory.php',
203
-    'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => $baseDir . '/../lib/Connector/Sabre/DummyGetResponsePlugin.php',
204
-    'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => $baseDir . '/../lib/Connector/Sabre/ExceptionLoggerPlugin.php',
205
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\BadGateway' => $baseDir . '/../lib/Connector/Sabre/Exception/BadGateway.php',
206
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => $baseDir . '/../lib/Connector/Sabre/Exception/EntityTooLarge.php',
207
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => $baseDir . '/../lib/Connector/Sabre/Exception/FileLocked.php',
208
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => $baseDir . '/../lib/Connector/Sabre/Exception/Forbidden.php',
209
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => $baseDir . '/../lib/Connector/Sabre/Exception/InvalidPath.php',
210
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => $baseDir . '/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php',
211
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\TooManyRequests' => $baseDir . '/../lib/Connector/Sabre/Exception/TooManyRequests.php',
212
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => $baseDir . '/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php',
213
-    'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => $baseDir . '/../lib/Connector/Sabre/FakeLockerPlugin.php',
214
-    'OCA\\DAV\\Connector\\Sabre\\File' => $baseDir . '/../lib/Connector/Sabre/File.php',
215
-    'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => $baseDir . '/../lib/Connector/Sabre/FilesPlugin.php',
216
-    'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => $baseDir . '/../lib/Connector/Sabre/FilesReportPlugin.php',
217
-    'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => $baseDir . '/../lib/Connector/Sabre/LockPlugin.php',
218
-    'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => $baseDir . '/../lib/Connector/Sabre/MaintenancePlugin.php',
219
-    'OCA\\DAV\\Connector\\Sabre\\MtimeSanitizer' => $baseDir . '/../lib/Connector/Sabre/MtimeSanitizer.php',
220
-    'OCA\\DAV\\Connector\\Sabre\\Node' => $baseDir . '/../lib/Connector/Sabre/Node.php',
221
-    'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => $baseDir . '/../lib/Connector/Sabre/ObjectTree.php',
222
-    'OCA\\DAV\\Connector\\Sabre\\Principal' => $baseDir . '/../lib/Connector/Sabre/Principal.php',
223
-    'OCA\\DAV\\Connector\\Sabre\\PropFindMonitorPlugin' => $baseDir . '/../lib/Connector/Sabre/PropFindMonitorPlugin.php',
224
-    'OCA\\DAV\\Connector\\Sabre\\PropFindPreloadNotifyPlugin' => $baseDir . '/../lib/Connector/Sabre/PropFindPreloadNotifyPlugin.php',
225
-    'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => $baseDir . '/../lib/Connector/Sabre/PropfindCompressionPlugin.php',
226
-    'OCA\\DAV\\Connector\\Sabre\\PublicAuth' => $baseDir . '/../lib/Connector/Sabre/PublicAuth.php',
227
-    'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => $baseDir . '/../lib/Connector/Sabre/QuotaPlugin.php',
228
-    'OCA\\DAV\\Connector\\Sabre\\RequestIdHeaderPlugin' => $baseDir . '/../lib/Connector/Sabre/RequestIdHeaderPlugin.php',
229
-    'OCA\\DAV\\Connector\\Sabre\\Server' => $baseDir . '/../lib/Connector/Sabre/Server.php',
230
-    'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => $baseDir . '/../lib/Connector/Sabre/ServerFactory.php',
231
-    'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => $baseDir . '/../lib/Connector/Sabre/ShareTypeList.php',
232
-    'OCA\\DAV\\Connector\\Sabre\\ShareeList' => $baseDir . '/../lib/Connector/Sabre/ShareeList.php',
233
-    'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => $baseDir . '/../lib/Connector/Sabre/SharesPlugin.php',
234
-    'OCA\\DAV\\Connector\\Sabre\\TagList' => $baseDir . '/../lib/Connector/Sabre/TagList.php',
235
-    'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => $baseDir . '/../lib/Connector/Sabre/TagsPlugin.php',
236
-    'OCA\\DAV\\Connector\\Sabre\\ZipFolderPlugin' => $baseDir . '/../lib/Connector/Sabre/ZipFolderPlugin.php',
237
-    'OCA\\DAV\\Controller\\BirthdayCalendarController' => $baseDir . '/../lib/Controller/BirthdayCalendarController.php',
238
-    'OCA\\DAV\\Controller\\DirectController' => $baseDir . '/../lib/Controller/DirectController.php',
239
-    'OCA\\DAV\\Controller\\ExampleContentController' => $baseDir . '/../lib/Controller/ExampleContentController.php',
240
-    'OCA\\DAV\\Controller\\InvitationResponseController' => $baseDir . '/../lib/Controller/InvitationResponseController.php',
241
-    'OCA\\DAV\\Controller\\OutOfOfficeController' => $baseDir . '/../lib/Controller/OutOfOfficeController.php',
242
-    'OCA\\DAV\\Controller\\UpcomingEventsController' => $baseDir . '/../lib/Controller/UpcomingEventsController.php',
243
-    'OCA\\DAV\\DAV\\CustomPropertiesBackend' => $baseDir . '/../lib/DAV/CustomPropertiesBackend.php',
244
-    'OCA\\DAV\\DAV\\GroupPrincipalBackend' => $baseDir . '/../lib/DAV/GroupPrincipalBackend.php',
245
-    'OCA\\DAV\\DAV\\PublicAuth' => $baseDir . '/../lib/DAV/PublicAuth.php',
246
-    'OCA\\DAV\\DAV\\Sharing\\Backend' => $baseDir . '/../lib/DAV/Sharing/Backend.php',
247
-    'OCA\\DAV\\DAV\\Sharing\\IShareable' => $baseDir . '/../lib/DAV/Sharing/IShareable.php',
248
-    'OCA\\DAV\\DAV\\Sharing\\Plugin' => $baseDir . '/../lib/DAV/Sharing/Plugin.php',
249
-    'OCA\\DAV\\DAV\\Sharing\\SharingMapper' => $baseDir . '/../lib/DAV/Sharing/SharingMapper.php',
250
-    'OCA\\DAV\\DAV\\Sharing\\SharingService' => $baseDir . '/../lib/DAV/Sharing/SharingService.php',
251
-    'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => $baseDir . '/../lib/DAV/Sharing/Xml/Invite.php',
252
-    'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => $baseDir . '/../lib/DAV/Sharing/Xml/ShareRequest.php',
253
-    'OCA\\DAV\\DAV\\SystemPrincipalBackend' => $baseDir . '/../lib/DAV/SystemPrincipalBackend.php',
254
-    'OCA\\DAV\\DAV\\ViewOnlyPlugin' => $baseDir . '/../lib/DAV/ViewOnlyPlugin.php',
255
-    'OCA\\DAV\\Db\\Absence' => $baseDir . '/../lib/Db/Absence.php',
256
-    'OCA\\DAV\\Db\\AbsenceMapper' => $baseDir . '/../lib/Db/AbsenceMapper.php',
257
-    'OCA\\DAV\\Db\\Direct' => $baseDir . '/../lib/Db/Direct.php',
258
-    'OCA\\DAV\\Db\\DirectMapper' => $baseDir . '/../lib/Db/DirectMapper.php',
259
-    'OCA\\DAV\\Db\\Property' => $baseDir . '/../lib/Db/Property.php',
260
-    'OCA\\DAV\\Db\\PropertyMapper' => $baseDir . '/../lib/Db/PropertyMapper.php',
261
-    'OCA\\DAV\\Direct\\DirectFile' => $baseDir . '/../lib/Direct/DirectFile.php',
262
-    'OCA\\DAV\\Direct\\DirectHome' => $baseDir . '/../lib/Direct/DirectHome.php',
263
-    'OCA\\DAV\\Direct\\Server' => $baseDir . '/../lib/Direct/Server.php',
264
-    'OCA\\DAV\\Direct\\ServerFactory' => $baseDir . '/../lib/Direct/ServerFactory.php',
265
-    'OCA\\DAV\\Events\\AddressBookCreatedEvent' => $baseDir . '/../lib/Events/AddressBookCreatedEvent.php',
266
-    'OCA\\DAV\\Events\\AddressBookDeletedEvent' => $baseDir . '/../lib/Events/AddressBookDeletedEvent.php',
267
-    'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => $baseDir . '/../lib/Events/AddressBookShareUpdatedEvent.php',
268
-    'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => $baseDir . '/../lib/Events/AddressBookUpdatedEvent.php',
269
-    'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => $baseDir . '/../lib/Events/BeforeFileDirectDownloadedEvent.php',
270
-    'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectCreatedEvent.php',
271
-    'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectDeletedEvent.php',
272
-    'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectUpdatedEvent.php',
273
-    'OCA\\DAV\\Events\\CalendarCreatedEvent' => $baseDir . '/../lib/Events/CalendarCreatedEvent.php',
274
-    'OCA\\DAV\\Events\\CalendarDeletedEvent' => $baseDir . '/../lib/Events/CalendarDeletedEvent.php',
275
-    'OCA\\DAV\\Events\\CalendarMovedToTrashEvent' => $baseDir . '/../lib/Events/CalendarMovedToTrashEvent.php',
276
-    'OCA\\DAV\\Events\\CalendarPublishedEvent' => $baseDir . '/../lib/Events/CalendarPublishedEvent.php',
277
-    'OCA\\DAV\\Events\\CalendarRestoredEvent' => $baseDir . '/../lib/Events/CalendarRestoredEvent.php',
278
-    'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => $baseDir . '/../lib/Events/CalendarShareUpdatedEvent.php',
279
-    'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => $baseDir . '/../lib/Events/CalendarUnpublishedEvent.php',
280
-    'OCA\\DAV\\Events\\CalendarUpdatedEvent' => $baseDir . '/../lib/Events/CalendarUpdatedEvent.php',
281
-    'OCA\\DAV\\Events\\CardCreatedEvent' => $baseDir . '/../lib/Events/CardCreatedEvent.php',
282
-    'OCA\\DAV\\Events\\CardDeletedEvent' => $baseDir . '/../lib/Events/CardDeletedEvent.php',
283
-    'OCA\\DAV\\Events\\CardMovedEvent' => $baseDir . '/../lib/Events/CardMovedEvent.php',
284
-    'OCA\\DAV\\Events\\CardUpdatedEvent' => $baseDir . '/../lib/Events/CardUpdatedEvent.php',
285
-    'OCA\\DAV\\Events\\SabrePluginAddEvent' => $baseDir . '/../lib/Events/SabrePluginAddEvent.php',
286
-    'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => $baseDir . '/../lib/Events/SabrePluginAuthInitEvent.php',
287
-    'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => $baseDir . '/../lib/Events/SubscriptionCreatedEvent.php',
288
-    'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => $baseDir . '/../lib/Events/SubscriptionDeletedEvent.php',
289
-    'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => $baseDir . '/../lib/Events/SubscriptionUpdatedEvent.php',
290
-    'OCA\\DAV\\Exception\\ExampleEventException' => $baseDir . '/../lib/Exception/ExampleEventException.php',
291
-    'OCA\\DAV\\Exception\\ServerMaintenanceMode' => $baseDir . '/../lib/Exception/ServerMaintenanceMode.php',
292
-    'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => $baseDir . '/../lib/Exception/UnsupportedLimitOnInitialSyncException.php',
293
-    'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => $baseDir . '/../lib/Files/BrowserErrorPagePlugin.php',
294
-    'OCA\\DAV\\Files\\FileSearchBackend' => $baseDir . '/../lib/Files/FileSearchBackend.php',
295
-    'OCA\\DAV\\Files\\FilesHome' => $baseDir . '/../lib/Files/FilesHome.php',
296
-    'OCA\\DAV\\Files\\LazySearchBackend' => $baseDir . '/../lib/Files/LazySearchBackend.php',
297
-    'OCA\\DAV\\Files\\RootCollection' => $baseDir . '/../lib/Files/RootCollection.php',
298
-    'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => $baseDir . '/../lib/Files/Sharing/FilesDropPlugin.php',
299
-    'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => $baseDir . '/../lib/Files/Sharing/PublicLinkCheckPlugin.php',
300
-    'OCA\\DAV\\Files\\Sharing\\RootCollection' => $baseDir . '/../lib/Files/Sharing/RootCollection.php',
301
-    'OCA\\DAV\\Listener\\ActivityUpdaterListener' => $baseDir . '/../lib/Listener/ActivityUpdaterListener.php',
302
-    'OCA\\DAV\\Listener\\AddMissingIndicesListener' => $baseDir . '/../lib/Listener/AddMissingIndicesListener.php',
303
-    'OCA\\DAV\\Listener\\AddressbookListener' => $baseDir . '/../lib/Listener/AddressbookListener.php',
304
-    'OCA\\DAV\\Listener\\BirthdayListener' => $baseDir . '/../lib/Listener/BirthdayListener.php',
305
-    'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => $baseDir . '/../lib/Listener/CalendarContactInteractionListener.php',
306
-    'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => $baseDir . '/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php',
307
-    'OCA\\DAV\\Listener\\CalendarObjectReminderUpdaterListener' => $baseDir . '/../lib/Listener/CalendarObjectReminderUpdaterListener.php',
308
-    'OCA\\DAV\\Listener\\CalendarPublicationListener' => $baseDir . '/../lib/Listener/CalendarPublicationListener.php',
309
-    'OCA\\DAV\\Listener\\CalendarShareUpdateListener' => $baseDir . '/../lib/Listener/CalendarShareUpdateListener.php',
310
-    'OCA\\DAV\\Listener\\CardListener' => $baseDir . '/../lib/Listener/CardListener.php',
311
-    'OCA\\DAV\\Listener\\ClearPhotoCacheListener' => $baseDir . '/../lib/Listener/ClearPhotoCacheListener.php',
312
-    'OCA\\DAV\\Listener\\DavAdminSettingsListener' => $baseDir . '/../lib/Listener/DavAdminSettingsListener.php',
313
-    'OCA\\DAV\\Listener\\OutOfOfficeListener' => $baseDir . '/../lib/Listener/OutOfOfficeListener.php',
314
-    'OCA\\DAV\\Listener\\SubscriptionListener' => $baseDir . '/../lib/Listener/SubscriptionListener.php',
315
-    'OCA\\DAV\\Listener\\TrustedServerRemovedListener' => $baseDir . '/../lib/Listener/TrustedServerRemovedListener.php',
316
-    'OCA\\DAV\\Listener\\UserEventsListener' => $baseDir . '/../lib/Listener/UserEventsListener.php',
317
-    'OCA\\DAV\\Listener\\UserPreferenceListener' => $baseDir . '/../lib/Listener/UserPreferenceListener.php',
318
-    'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => $baseDir . '/../lib/Migration/BuildCalendarSearchIndex.php',
319
-    'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => $baseDir . '/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php',
320
-    'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => $baseDir . '/../lib/Migration/BuildSocialSearchIndex.php',
321
-    'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => $baseDir . '/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php',
322
-    'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => $baseDir . '/../lib/Migration/CalDAVRemoveEmptyValue.php',
323
-    'OCA\\DAV\\Migration\\ChunkCleanup' => $baseDir . '/../lib/Migration/ChunkCleanup.php',
324
-    'OCA\\DAV\\Migration\\CreateSystemAddressBookStep' => $baseDir . '/../lib/Migration/CreateSystemAddressBookStep.php',
325
-    'OCA\\DAV\\Migration\\DeleteSchedulingObjects' => $baseDir . '/../lib/Migration/DeleteSchedulingObjects.php',
326
-    'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => $baseDir . '/../lib/Migration/FixBirthdayCalendarComponent.php',
327
-    'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => $baseDir . '/../lib/Migration/RefreshWebcalJobRegistrar.php',
328
-    'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => $baseDir . '/../lib/Migration/RegenerateBirthdayCalendars.php',
329
-    'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => $baseDir . '/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php',
330
-    'OCA\\DAV\\Migration\\RegisterUpdateCalendarResourcesRoomBackgroundJob' => $baseDir . '/../lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php',
331
-    'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => $baseDir . '/../lib/Migration/RemoveClassifiedEventActivity.php',
332
-    'OCA\\DAV\\Migration\\RemoveDeletedUsersCalendarSubscriptions' => $baseDir . '/../lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php',
333
-    'OCA\\DAV\\Migration\\RemoveObjectProperties' => $baseDir . '/../lib/Migration/RemoveObjectProperties.php',
334
-    'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => $baseDir . '/../lib/Migration/RemoveOrphanEventsAndContacts.php',
335
-    'OCA\\DAV\\Migration\\Version1004Date20170825134824' => $baseDir . '/../lib/Migration/Version1004Date20170825134824.php',
336
-    'OCA\\DAV\\Migration\\Version1004Date20170919104507' => $baseDir . '/../lib/Migration/Version1004Date20170919104507.php',
337
-    'OCA\\DAV\\Migration\\Version1004Date20170924124212' => $baseDir . '/../lib/Migration/Version1004Date20170924124212.php',
338
-    'OCA\\DAV\\Migration\\Version1004Date20170926103422' => $baseDir . '/../lib/Migration/Version1004Date20170926103422.php',
339
-    'OCA\\DAV\\Migration\\Version1005Date20180413093149' => $baseDir . '/../lib/Migration/Version1005Date20180413093149.php',
340
-    'OCA\\DAV\\Migration\\Version1005Date20180530124431' => $baseDir . '/../lib/Migration/Version1005Date20180530124431.php',
341
-    'OCA\\DAV\\Migration\\Version1006Date20180619154313' => $baseDir . '/../lib/Migration/Version1006Date20180619154313.php',
342
-    'OCA\\DAV\\Migration\\Version1006Date20180628111625' => $baseDir . '/../lib/Migration/Version1006Date20180628111625.php',
343
-    'OCA\\DAV\\Migration\\Version1008Date20181030113700' => $baseDir . '/../lib/Migration/Version1008Date20181030113700.php',
344
-    'OCA\\DAV\\Migration\\Version1008Date20181105104826' => $baseDir . '/../lib/Migration/Version1008Date20181105104826.php',
345
-    'OCA\\DAV\\Migration\\Version1008Date20181105104833' => $baseDir . '/../lib/Migration/Version1008Date20181105104833.php',
346
-    'OCA\\DAV\\Migration\\Version1008Date20181105110300' => $baseDir . '/../lib/Migration/Version1008Date20181105110300.php',
347
-    'OCA\\DAV\\Migration\\Version1008Date20181105112049' => $baseDir . '/../lib/Migration/Version1008Date20181105112049.php',
348
-    'OCA\\DAV\\Migration\\Version1008Date20181114084440' => $baseDir . '/../lib/Migration/Version1008Date20181114084440.php',
349
-    'OCA\\DAV\\Migration\\Version1011Date20190725113607' => $baseDir . '/../lib/Migration/Version1011Date20190725113607.php',
350
-    'OCA\\DAV\\Migration\\Version1011Date20190806104428' => $baseDir . '/../lib/Migration/Version1011Date20190806104428.php',
351
-    'OCA\\DAV\\Migration\\Version1012Date20190808122342' => $baseDir . '/../lib/Migration/Version1012Date20190808122342.php',
352
-    'OCA\\DAV\\Migration\\Version1016Date20201109085907' => $baseDir . '/../lib/Migration/Version1016Date20201109085907.php',
353
-    'OCA\\DAV\\Migration\\Version1017Date20210216083742' => $baseDir . '/../lib/Migration/Version1017Date20210216083742.php',
354
-    'OCA\\DAV\\Migration\\Version1018Date20210312100735' => $baseDir . '/../lib/Migration/Version1018Date20210312100735.php',
355
-    'OCA\\DAV\\Migration\\Version1024Date20211221144219' => $baseDir . '/../lib/Migration/Version1024Date20211221144219.php',
356
-    'OCA\\DAV\\Migration\\Version1025Date20240308063933' => $baseDir . '/../lib/Migration/Version1025Date20240308063933.php',
357
-    'OCA\\DAV\\Migration\\Version1027Date20230504122946' => $baseDir . '/../lib/Migration/Version1027Date20230504122946.php',
358
-    'OCA\\DAV\\Migration\\Version1029Date20221114151721' => $baseDir . '/../lib/Migration/Version1029Date20221114151721.php',
359
-    'OCA\\DAV\\Migration\\Version1029Date20231004091403' => $baseDir . '/../lib/Migration/Version1029Date20231004091403.php',
360
-    'OCA\\DAV\\Migration\\Version1030Date20240205103243' => $baseDir . '/../lib/Migration/Version1030Date20240205103243.php',
361
-    'OCA\\DAV\\Migration\\Version1031Date20240610134258' => $baseDir . '/../lib/Migration/Version1031Date20240610134258.php',
362
-    'OCA\\DAV\\Migration\\Version1034Date20250813093701' => $baseDir . '/../lib/Migration/Version1034Date20250813093701.php',
363
-    'OCA\\DAV\\Model\\ExampleEvent' => $baseDir . '/../lib/Model/ExampleEvent.php',
364
-    'OCA\\DAV\\Paginate\\LimitedCopyIterator' => $baseDir . '/../lib/Paginate/LimitedCopyIterator.php',
365
-    'OCA\\DAV\\Paginate\\PaginateCache' => $baseDir . '/../lib/Paginate/PaginateCache.php',
366
-    'OCA\\DAV\\Paginate\\PaginatePlugin' => $baseDir . '/../lib/Paginate/PaginatePlugin.php',
367
-    'OCA\\DAV\\Profiler\\ProfilerPlugin' => $baseDir . '/../lib/Profiler/ProfilerPlugin.php',
368
-    'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => $baseDir . '/../lib/Provisioning/Apple/AppleProvisioningNode.php',
369
-    'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => $baseDir . '/../lib/Provisioning/Apple/AppleProvisioningPlugin.php',
370
-    'OCA\\DAV\\ResponseDefinitions' => $baseDir . '/../lib/ResponseDefinitions.php',
371
-    'OCA\\DAV\\RootCollection' => $baseDir . '/../lib/RootCollection.php',
372
-    'OCA\\DAV\\Search\\ACalendarSearchProvider' => $baseDir . '/../lib/Search/ACalendarSearchProvider.php',
373
-    'OCA\\DAV\\Search\\ContactsSearchProvider' => $baseDir . '/../lib/Search/ContactsSearchProvider.php',
374
-    'OCA\\DAV\\Search\\EventsSearchProvider' => $baseDir . '/../lib/Search/EventsSearchProvider.php',
375
-    'OCA\\DAV\\Search\\TasksSearchProvider' => $baseDir . '/../lib/Search/TasksSearchProvider.php',
376
-    'OCA\\DAV\\Server' => $baseDir . '/../lib/Server.php',
377
-    'OCA\\DAV\\ServerFactory' => $baseDir . '/../lib/ServerFactory.php',
378
-    'OCA\\DAV\\Service\\AbsenceService' => $baseDir . '/../lib/Service/AbsenceService.php',
379
-    'OCA\\DAV\\Service\\ExampleContactService' => $baseDir . '/../lib/Service/ExampleContactService.php',
380
-    'OCA\\DAV\\Service\\ExampleEventService' => $baseDir . '/../lib/Service/ExampleEventService.php',
381
-    'OCA\\DAV\\Settings\\Admin\\SystemAddressBookSettings' => $baseDir . '/../lib/Settings/Admin/SystemAddressBookSettings.php',
382
-    'OCA\\DAV\\Settings\\AvailabilitySettings' => $baseDir . '/../lib/Settings/AvailabilitySettings.php',
383
-    'OCA\\DAV\\Settings\\CalDAVSettings' => $baseDir . '/../lib/Settings/CalDAVSettings.php',
384
-    'OCA\\DAV\\Settings\\ExampleContentSettings' => $baseDir . '/../lib/Settings/ExampleContentSettings.php',
385
-    'OCA\\DAV\\SetupChecks\\NeedsSystemAddressBookSync' => $baseDir . '/../lib/SetupChecks/NeedsSystemAddressBookSync.php',
386
-    'OCA\\DAV\\SetupChecks\\WebdavEndpoint' => $baseDir . '/../lib/SetupChecks/WebdavEndpoint.php',
387
-    'OCA\\DAV\\Storage\\PublicOwnerWrapper' => $baseDir . '/../lib/Storage/PublicOwnerWrapper.php',
388
-    'OCA\\DAV\\Storage\\PublicShareWrapper' => $baseDir . '/../lib/Storage/PublicShareWrapper.php',
389
-    'OCA\\DAV\\SystemTag\\SystemTagList' => $baseDir . '/../lib/SystemTag/SystemTagList.php',
390
-    'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => $baseDir . '/../lib/SystemTag/SystemTagMappingNode.php',
391
-    'OCA\\DAV\\SystemTag\\SystemTagNode' => $baseDir . '/../lib/SystemTag/SystemTagNode.php',
392
-    'OCA\\DAV\\SystemTag\\SystemTagObjectType' => $baseDir . '/../lib/SystemTag/SystemTagObjectType.php',
393
-    'OCA\\DAV\\SystemTag\\SystemTagPlugin' => $baseDir . '/../lib/SystemTag/SystemTagPlugin.php',
394
-    'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => $baseDir . '/../lib/SystemTag/SystemTagsByIdCollection.php',
395
-    'OCA\\DAV\\SystemTag\\SystemTagsInUseCollection' => $baseDir . '/../lib/SystemTag/SystemTagsInUseCollection.php',
396
-    'OCA\\DAV\\SystemTag\\SystemTagsObjectList' => $baseDir . '/../lib/SystemTag/SystemTagsObjectList.php',
397
-    'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => $baseDir . '/../lib/SystemTag/SystemTagsObjectMappingCollection.php',
398
-    'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => $baseDir . '/../lib/SystemTag/SystemTagsObjectTypeCollection.php',
399
-    'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => $baseDir . '/../lib/SystemTag/SystemTagsRelationsCollection.php',
400
-    'OCA\\DAV\\Traits\\PrincipalProxyTrait' => $baseDir . '/../lib/Traits/PrincipalProxyTrait.php',
401
-    'OCA\\DAV\\Upload\\AssemblyStream' => $baseDir . '/../lib/Upload/AssemblyStream.php',
402
-    'OCA\\DAV\\Upload\\ChunkingPlugin' => $baseDir . '/../lib/Upload/ChunkingPlugin.php',
403
-    'OCA\\DAV\\Upload\\ChunkingV2Plugin' => $baseDir . '/../lib/Upload/ChunkingV2Plugin.php',
404
-    'OCA\\DAV\\Upload\\CleanupService' => $baseDir . '/../lib/Upload/CleanupService.php',
405
-    'OCA\\DAV\\Upload\\FutureFile' => $baseDir . '/../lib/Upload/FutureFile.php',
406
-    'OCA\\DAV\\Upload\\PartFile' => $baseDir . '/../lib/Upload/PartFile.php',
407
-    'OCA\\DAV\\Upload\\RootCollection' => $baseDir . '/../lib/Upload/RootCollection.php',
408
-    'OCA\\DAV\\Upload\\UploadAutoMkcolPlugin' => $baseDir . '/../lib/Upload/UploadAutoMkcolPlugin.php',
409
-    'OCA\\DAV\\Upload\\UploadFile' => $baseDir . '/../lib/Upload/UploadFile.php',
410
-    'OCA\\DAV\\Upload\\UploadFolder' => $baseDir . '/../lib/Upload/UploadFolder.php',
411
-    'OCA\\DAV\\Upload\\UploadHome' => $baseDir . '/../lib/Upload/UploadHome.php',
412
-    'OCA\\DAV\\UserMigration\\CalendarMigrator' => $baseDir . '/../lib/UserMigration/CalendarMigrator.php',
413
-    'OCA\\DAV\\UserMigration\\CalendarMigratorException' => $baseDir . '/../lib/UserMigration/CalendarMigratorException.php',
414
-    'OCA\\DAV\\UserMigration\\ContactsMigrator' => $baseDir . '/../lib/UserMigration/ContactsMigrator.php',
415
-    'OCA\\DAV\\UserMigration\\ContactsMigratorException' => $baseDir . '/../lib/UserMigration/ContactsMigratorException.php',
416
-    'OCA\\DAV\\UserMigration\\InvalidAddressBookException' => $baseDir . '/../lib/UserMigration/InvalidAddressBookException.php',
417
-    'OCA\\DAV\\UserMigration\\InvalidCalendarException' => $baseDir . '/../lib/UserMigration/InvalidCalendarException.php',
9
+    'Composer\\InstalledVersions' => $vendorDir.'/composer/InstalledVersions.php',
10
+    'OCA\\DAV\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php',
11
+    'OCA\\DAV\\AppInfo\\PluginManager' => $baseDir.'/../lib/AppInfo/PluginManager.php',
12
+    'OCA\\DAV\\Avatars\\AvatarHome' => $baseDir.'/../lib/Avatars/AvatarHome.php',
13
+    'OCA\\DAV\\Avatars\\AvatarNode' => $baseDir.'/../lib/Avatars/AvatarNode.php',
14
+    'OCA\\DAV\\Avatars\\RootCollection' => $baseDir.'/../lib/Avatars/RootCollection.php',
15
+    'OCA\\DAV\\BackgroundJob\\BuildReminderIndexBackgroundJob' => $baseDir.'/../lib/BackgroundJob/BuildReminderIndexBackgroundJob.php',
16
+    'OCA\\DAV\\BackgroundJob\\CalendarRetentionJob' => $baseDir.'/../lib/BackgroundJob/CalendarRetentionJob.php',
17
+    'OCA\\DAV\\BackgroundJob\\CleanupDirectLinksJob' => $baseDir.'/../lib/BackgroundJob/CleanupDirectLinksJob.php',
18
+    'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => $baseDir.'/../lib/BackgroundJob/CleanupInvitationTokenJob.php',
19
+    'OCA\\DAV\\BackgroundJob\\CleanupOrphanedChildrenJob' => $baseDir.'/../lib/BackgroundJob/CleanupOrphanedChildrenJob.php',
20
+    'OCA\\DAV\\BackgroundJob\\DeleteOutdatedSchedulingObjects' => $baseDir.'/../lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php',
21
+    'OCA\\DAV\\BackgroundJob\\EventReminderJob' => $baseDir.'/../lib/BackgroundJob/EventReminderJob.php',
22
+    'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => $baseDir.'/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php',
23
+    'OCA\\DAV\\BackgroundJob\\OutOfOfficeEventDispatcherJob' => $baseDir.'/../lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php',
24
+    'OCA\\DAV\\BackgroundJob\\PruneOutdatedSyncTokensJob' => $baseDir.'/../lib/BackgroundJob/PruneOutdatedSyncTokensJob.php',
25
+    'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => $baseDir.'/../lib/BackgroundJob/RefreshWebcalJob.php',
26
+    'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => $baseDir.'/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php',
27
+    'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => $baseDir.'/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php',
28
+    'OCA\\DAV\\BackgroundJob\\UploadCleanup' => $baseDir.'/../lib/BackgroundJob/UploadCleanup.php',
29
+    'OCA\\DAV\\BackgroundJob\\UserStatusAutomation' => $baseDir.'/../lib/BackgroundJob/UserStatusAutomation.php',
30
+    'OCA\\DAV\\BulkUpload\\BulkUploadPlugin' => $baseDir.'/../lib/BulkUpload/BulkUploadPlugin.php',
31
+    'OCA\\DAV\\BulkUpload\\MultipartRequestParser' => $baseDir.'/../lib/BulkUpload/MultipartRequestParser.php',
32
+    'OCA\\DAV\\CalDAV\\Activity\\Backend' => $baseDir.'/../lib/CalDAV/Activity/Backend.php',
33
+    'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Filter/Calendar.php',
34
+    'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Filter/Todo.php',
35
+    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => $baseDir.'/../lib/CalDAV/Activity/Provider/Base.php',
36
+    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Provider/Calendar.php',
37
+    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => $baseDir.'/../lib/CalDAV/Activity/Provider/Event.php',
38
+    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Provider/Todo.php',
39
+    'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => $baseDir.'/../lib/CalDAV/Activity/Setting/CalDAVSetting.php',
40
+    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Setting/Calendar.php',
41
+    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => $baseDir.'/../lib/CalDAV/Activity/Setting/Event.php',
42
+    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Setting/Todo.php',
43
+    'OCA\\DAV\\CalDAV\\AppCalendar\\AppCalendar' => $baseDir.'/../lib/CalDAV/AppCalendar/AppCalendar.php',
44
+    'OCA\\DAV\\CalDAV\\AppCalendar\\AppCalendarPlugin' => $baseDir.'/../lib/CalDAV/AppCalendar/AppCalendarPlugin.php',
45
+    'OCA\\DAV\\CalDAV\\AppCalendar\\CalendarObject' => $baseDir.'/../lib/CalDAV/AppCalendar/CalendarObject.php',
46
+    'OCA\\DAV\\CalDAV\\Auth\\CustomPrincipalPlugin' => $baseDir.'/../lib/CalDAV/Auth/CustomPrincipalPlugin.php',
47
+    'OCA\\DAV\\CalDAV\\Auth\\PublicPrincipalPlugin' => $baseDir.'/../lib/CalDAV/Auth/PublicPrincipalPlugin.php',
48
+    'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => $baseDir.'/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php',
49
+    'OCA\\DAV\\CalDAV\\BirthdayService' => $baseDir.'/../lib/CalDAV/BirthdayService.php',
50
+    'OCA\\DAV\\CalDAV\\CachedSubscription' => $baseDir.'/../lib/CalDAV/CachedSubscription.php',
51
+    'OCA\\DAV\\CalDAV\\CachedSubscriptionImpl' => $baseDir.'/../lib/CalDAV/CachedSubscriptionImpl.php',
52
+    'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => $baseDir.'/../lib/CalDAV/CachedSubscriptionObject.php',
53
+    'OCA\\DAV\\CalDAV\\CachedSubscriptionProvider' => $baseDir.'/../lib/CalDAV/CachedSubscriptionProvider.php',
54
+    'OCA\\DAV\\CalDAV\\CalDavBackend' => $baseDir.'/../lib/CalDAV/CalDavBackend.php',
55
+    'OCA\\DAV\\CalDAV\\Calendar' => $baseDir.'/../lib/CalDAV/Calendar.php',
56
+    'OCA\\DAV\\CalDAV\\CalendarHome' => $baseDir.'/../lib/CalDAV/CalendarHome.php',
57
+    'OCA\\DAV\\CalDAV\\CalendarImpl' => $baseDir.'/../lib/CalDAV/CalendarImpl.php',
58
+    'OCA\\DAV\\CalDAV\\CalendarManager' => $baseDir.'/../lib/CalDAV/CalendarManager.php',
59
+    'OCA\\DAV\\CalDAV\\CalendarObject' => $baseDir.'/../lib/CalDAV/CalendarObject.php',
60
+    'OCA\\DAV\\CalDAV\\CalendarProvider' => $baseDir.'/../lib/CalDAV/CalendarProvider.php',
61
+    'OCA\\DAV\\CalDAV\\CalendarRoot' => $baseDir.'/../lib/CalDAV/CalendarRoot.php',
62
+    'OCA\\DAV\\CalDAV\\DefaultCalendarValidator' => $baseDir.'/../lib/CalDAV/DefaultCalendarValidator.php',
63
+    'OCA\\DAV\\CalDAV\\EmbeddedCalDavServer' => $baseDir.'/../lib/CalDAV/EmbeddedCalDavServer.php',
64
+    'OCA\\DAV\\CalDAV\\EventComparisonService' => $baseDir.'/../lib/CalDAV/EventComparisonService.php',
65
+    'OCA\\DAV\\CalDAV\\EventReader' => $baseDir.'/../lib/CalDAV/EventReader.php',
66
+    'OCA\\DAV\\CalDAV\\EventReaderRDate' => $baseDir.'/../lib/CalDAV/EventReaderRDate.php',
67
+    'OCA\\DAV\\CalDAV\\EventReaderRRule' => $baseDir.'/../lib/CalDAV/EventReaderRRule.php',
68
+    'OCA\\DAV\\CalDAV\\Export\\ExportService' => $baseDir.'/../lib/CalDAV/Export/ExportService.php',
69
+    'OCA\\DAV\\CalDAV\\FreeBusy\\FreeBusyGenerator' => $baseDir.'/../lib/CalDAV/FreeBusy/FreeBusyGenerator.php',
70
+    'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => $baseDir.'/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
71
+    'OCA\\DAV\\CalDAV\\IRestorable' => $baseDir.'/../lib/CalDAV/IRestorable.php',
72
+    'OCA\\DAV\\CalDAV\\Import\\ImportService' => $baseDir.'/../lib/CalDAV/Import/ImportService.php',
73
+    'OCA\\DAV\\CalDAV\\Import\\TextImporter' => $baseDir.'/../lib/CalDAV/Import/TextImporter.php',
74
+    'OCA\\DAV\\CalDAV\\Import\\XmlImporter' => $baseDir.'/../lib/CalDAV/Import/XmlImporter.php',
75
+    'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => $baseDir.'/../lib/CalDAV/Integration/ExternalCalendar.php',
76
+    'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => $baseDir.'/../lib/CalDAV/Integration/ICalendarProvider.php',
77
+    'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => $baseDir.'/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php',
78
+    'OCA\\DAV\\CalDAV\\Outbox' => $baseDir.'/../lib/CalDAV/Outbox.php',
79
+    'OCA\\DAV\\CalDAV\\Plugin' => $baseDir.'/../lib/CalDAV/Plugin.php',
80
+    'OCA\\DAV\\CalDAV\\Principal\\Collection' => $baseDir.'/../lib/CalDAV/Principal/Collection.php',
81
+    'OCA\\DAV\\CalDAV\\Principal\\User' => $baseDir.'/../lib/CalDAV/Principal/User.php',
82
+    'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => $baseDir.'/../lib/CalDAV/Proxy/Proxy.php',
83
+    'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => $baseDir.'/../lib/CalDAV/Proxy/ProxyMapper.php',
84
+    'OCA\\DAV\\CalDAV\\PublicCalendar' => $baseDir.'/../lib/CalDAV/PublicCalendar.php',
85
+    'OCA\\DAV\\CalDAV\\PublicCalendarObject' => $baseDir.'/../lib/CalDAV/PublicCalendarObject.php',
86
+    'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => $baseDir.'/../lib/CalDAV/PublicCalendarRoot.php',
87
+    'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => $baseDir.'/../lib/CalDAV/Publishing/PublishPlugin.php',
88
+    'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => $baseDir.'/../lib/CalDAV/Publishing/Xml/Publisher.php',
89
+    'OCA\\DAV\\CalDAV\\Reminder\\Backend' => $baseDir.'/../lib/CalDAV/Reminder/Backend.php',
90
+    'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => $baseDir.'/../lib/CalDAV/Reminder/INotificationProvider.php',
91
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProviderManager.php',
92
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php',
93
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php',
94
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php',
95
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php',
96
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php',
97
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => $baseDir.'/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php',
98
+    'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => $baseDir.'/../lib/CalDAV/Reminder/Notifier.php',
99
+    'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => $baseDir.'/../lib/CalDAV/Reminder/ReminderService.php',
100
+    'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php',
101
+    'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php',
102
+    'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php',
103
+    'OCA\\DAV\\CalDAV\\RetentionService' => $baseDir.'/../lib/CalDAV/RetentionService.php',
104
+    'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => $baseDir.'/../lib/CalDAV/Schedule/IMipPlugin.php',
105
+    'OCA\\DAV\\CalDAV\\Schedule\\IMipService' => $baseDir.'/../lib/CalDAV/Schedule/IMipService.php',
106
+    'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => $baseDir.'/../lib/CalDAV/Schedule/Plugin.php',
107
+    'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => $baseDir.'/../lib/CalDAV/Search/SearchPlugin.php',
108
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/CompFilter.php',
109
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php',
110
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php',
111
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php',
112
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/PropFilter.php',
113
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php',
114
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => $baseDir.'/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php',
115
+    'OCA\\DAV\\CalDAV\\Security\\RateLimitingPlugin' => $baseDir.'/../lib/CalDAV/Security/RateLimitingPlugin.php',
116
+    'OCA\\DAV\\CalDAV\\Sharing\\Backend' => $baseDir.'/../lib/CalDAV/Sharing/Backend.php',
117
+    'OCA\\DAV\\CalDAV\\Sharing\\Service' => $baseDir.'/../lib/CalDAV/Sharing/Service.php',
118
+    'OCA\\DAV\\CalDAV\\Status\\StatusService' => $baseDir.'/../lib/CalDAV/Status/StatusService.php',
119
+    'OCA\\DAV\\CalDAV\\TimeZoneFactory' => $baseDir.'/../lib/CalDAV/TimeZoneFactory.php',
120
+    'OCA\\DAV\\CalDAV\\TimezoneService' => $baseDir.'/../lib/CalDAV/TimezoneService.php',
121
+    'OCA\\DAV\\CalDAV\\TipBroker' => $baseDir.'/../lib/CalDAV/TipBroker.php',
122
+    'OCA\\DAV\\CalDAV\\Trashbin\\DeletedCalendarObject' => $baseDir.'/../lib/CalDAV/Trashbin/DeletedCalendarObject.php',
123
+    'OCA\\DAV\\CalDAV\\Trashbin\\DeletedCalendarObjectsCollection' => $baseDir.'/../lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php',
124
+    'OCA\\DAV\\CalDAV\\Trashbin\\Plugin' => $baseDir.'/../lib/CalDAV/Trashbin/Plugin.php',
125
+    'OCA\\DAV\\CalDAV\\Trashbin\\RestoreTarget' => $baseDir.'/../lib/CalDAV/Trashbin/RestoreTarget.php',
126
+    'OCA\\DAV\\CalDAV\\Trashbin\\TrashbinHome' => $baseDir.'/../lib/CalDAV/Trashbin/TrashbinHome.php',
127
+    'OCA\\DAV\\CalDAV\\UpcomingEvent' => $baseDir.'/../lib/CalDAV/UpcomingEvent.php',
128
+    'OCA\\DAV\\CalDAV\\UpcomingEventsService' => $baseDir.'/../lib/CalDAV/UpcomingEventsService.php',
129
+    'OCA\\DAV\\CalDAV\\Validation\\CalDavValidatePlugin' => $baseDir.'/../lib/CalDAV/Validation/CalDavValidatePlugin.php',
130
+    'OCA\\DAV\\CalDAV\\WebcalCaching\\Connection' => $baseDir.'/../lib/CalDAV/WebcalCaching/Connection.php',
131
+    'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => $baseDir.'/../lib/CalDAV/WebcalCaching/Plugin.php',
132
+    'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => $baseDir.'/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php',
133
+    'OCA\\DAV\\Capabilities' => $baseDir.'/../lib/Capabilities.php',
134
+    'OCA\\DAV\\CardDAV\\Activity\\Backend' => $baseDir.'/../lib/CardDAV/Activity/Backend.php',
135
+    'OCA\\DAV\\CardDAV\\Activity\\Filter' => $baseDir.'/../lib/CardDAV/Activity/Filter.php',
136
+    'OCA\\DAV\\CardDAV\\Activity\\Provider\\Addressbook' => $baseDir.'/../lib/CardDAV/Activity/Provider/Addressbook.php',
137
+    'OCA\\DAV\\CardDAV\\Activity\\Provider\\Base' => $baseDir.'/../lib/CardDAV/Activity/Provider/Base.php',
138
+    'OCA\\DAV\\CardDAV\\Activity\\Provider\\Card' => $baseDir.'/../lib/CardDAV/Activity/Provider/Card.php',
139
+    'OCA\\DAV\\CardDAV\\Activity\\Setting' => $baseDir.'/../lib/CardDAV/Activity/Setting.php',
140
+    'OCA\\DAV\\CardDAV\\AddressBook' => $baseDir.'/../lib/CardDAV/AddressBook.php',
141
+    'OCA\\DAV\\CardDAV\\AddressBookImpl' => $baseDir.'/../lib/CardDAV/AddressBookImpl.php',
142
+    'OCA\\DAV\\CardDAV\\AddressBookRoot' => $baseDir.'/../lib/CardDAV/AddressBookRoot.php',
143
+    'OCA\\DAV\\CardDAV\\Card' => $baseDir.'/../lib/CardDAV/Card.php',
144
+    'OCA\\DAV\\CardDAV\\CardDavBackend' => $baseDir.'/../lib/CardDAV/CardDavBackend.php',
145
+    'OCA\\DAV\\CardDAV\\ContactsManager' => $baseDir.'/../lib/CardDAV/ContactsManager.php',
146
+    'OCA\\DAV\\CardDAV\\Converter' => $baseDir.'/../lib/CardDAV/Converter.php',
147
+    'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => $baseDir.'/../lib/CardDAV/HasPhotoPlugin.php',
148
+    'OCA\\DAV\\CardDAV\\ImageExportPlugin' => $baseDir.'/../lib/CardDAV/ImageExportPlugin.php',
149
+    'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => $baseDir.'/../lib/CardDAV/Integration/ExternalAddressBook.php',
150
+    'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => $baseDir.'/../lib/CardDAV/Integration/IAddressBookProvider.php',
151
+    'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => $baseDir.'/../lib/CardDAV/MultiGetExportPlugin.php',
152
+    'OCA\\DAV\\CardDAV\\PhotoCache' => $baseDir.'/../lib/CardDAV/PhotoCache.php',
153
+    'OCA\\DAV\\CardDAV\\Plugin' => $baseDir.'/../lib/CardDAV/Plugin.php',
154
+    'OCA\\DAV\\CardDAV\\Security\\CardDavRateLimitingPlugin' => $baseDir.'/../lib/CardDAV/Security/CardDavRateLimitingPlugin.php',
155
+    'OCA\\DAV\\CardDAV\\Sharing\\Backend' => $baseDir.'/../lib/CardDAV/Sharing/Backend.php',
156
+    'OCA\\DAV\\CardDAV\\Sharing\\Service' => $baseDir.'/../lib/CardDAV/Sharing/Service.php',
157
+    'OCA\\DAV\\CardDAV\\SyncService' => $baseDir.'/../lib/CardDAV/SyncService.php',
158
+    'OCA\\DAV\\CardDAV\\SystemAddressbook' => $baseDir.'/../lib/CardDAV/SystemAddressbook.php',
159
+    'OCA\\DAV\\CardDAV\\UserAddressBooks' => $baseDir.'/../lib/CardDAV/UserAddressBooks.php',
160
+    'OCA\\DAV\\CardDAV\\Validation\\CardDavValidatePlugin' => $baseDir.'/../lib/CardDAV/Validation/CardDavValidatePlugin.php',
161
+    'OCA\\DAV\\CardDAV\\Xml\\Groups' => $baseDir.'/../lib/CardDAV/Xml/Groups.php',
162
+    'OCA\\DAV\\Command\\ClearCalendarUnshares' => $baseDir.'/../lib/Command/ClearCalendarUnshares.php',
163
+    'OCA\\DAV\\Command\\ClearContactsPhotoCache' => $baseDir.'/../lib/Command/ClearContactsPhotoCache.php',
164
+    'OCA\\DAV\\Command\\CreateAddressBook' => $baseDir.'/../lib/Command/CreateAddressBook.php',
165
+    'OCA\\DAV\\Command\\CreateCalendar' => $baseDir.'/../lib/Command/CreateCalendar.php',
166
+    'OCA\\DAV\\Command\\CreateSubscription' => $baseDir.'/../lib/Command/CreateSubscription.php',
167
+    'OCA\\DAV\\Command\\DeleteCalendar' => $baseDir.'/../lib/Command/DeleteCalendar.php',
168
+    'OCA\\DAV\\Command\\DeleteSubscription' => $baseDir.'/../lib/Command/DeleteSubscription.php',
169
+    'OCA\\DAV\\Command\\ExportCalendar' => $baseDir.'/../lib/Command/ExportCalendar.php',
170
+    'OCA\\DAV\\Command\\FixCalendarSyncCommand' => $baseDir.'/../lib/Command/FixCalendarSyncCommand.php',
171
+    'OCA\\DAV\\Command\\GetAbsenceCommand' => $baseDir.'/../lib/Command/GetAbsenceCommand.php',
172
+    'OCA\\DAV\\Command\\ImportCalendar' => $baseDir.'/../lib/Command/ImportCalendar.php',
173
+    'OCA\\DAV\\Command\\ListAddressbooks' => $baseDir.'/../lib/Command/ListAddressbooks.php',
174
+    'OCA\\DAV\\Command\\ListCalendarShares' => $baseDir.'/../lib/Command/ListCalendarShares.php',
175
+    'OCA\\DAV\\Command\\ListCalendars' => $baseDir.'/../lib/Command/ListCalendars.php',
176
+    'OCA\\DAV\\Command\\ListSubscriptions' => $baseDir.'/../lib/Command/ListSubscriptions.php',
177
+    'OCA\\DAV\\Command\\MoveCalendar' => $baseDir.'/../lib/Command/MoveCalendar.php',
178
+    'OCA\\DAV\\Command\\RemoveInvalidShares' => $baseDir.'/../lib/Command/RemoveInvalidShares.php',
179
+    'OCA\\DAV\\Command\\RetentionCleanupCommand' => $baseDir.'/../lib/Command/RetentionCleanupCommand.php',
180
+    'OCA\\DAV\\Command\\SendEventReminders' => $baseDir.'/../lib/Command/SendEventReminders.php',
181
+    'OCA\\DAV\\Command\\SetAbsenceCommand' => $baseDir.'/../lib/Command/SetAbsenceCommand.php',
182
+    'OCA\\DAV\\Command\\SyncBirthdayCalendar' => $baseDir.'/../lib/Command/SyncBirthdayCalendar.php',
183
+    'OCA\\DAV\\Command\\SyncSystemAddressBook' => $baseDir.'/../lib/Command/SyncSystemAddressBook.php',
184
+    'OCA\\DAV\\Comments\\CommentNode' => $baseDir.'/../lib/Comments/CommentNode.php',
185
+    'OCA\\DAV\\Comments\\CommentsPlugin' => $baseDir.'/../lib/Comments/CommentsPlugin.php',
186
+    'OCA\\DAV\\Comments\\EntityCollection' => $baseDir.'/../lib/Comments/EntityCollection.php',
187
+    'OCA\\DAV\\Comments\\EntityTypeCollection' => $baseDir.'/../lib/Comments/EntityTypeCollection.php',
188
+    'OCA\\DAV\\Comments\\RootCollection' => $baseDir.'/../lib/Comments/RootCollection.php',
189
+    'OCA\\DAV\\Connector\\LegacyDAVACL' => $baseDir.'/../lib/Connector/LegacyDAVACL.php',
190
+    'OCA\\DAV\\Connector\\LegacyPublicAuth' => $baseDir.'/../lib/Connector/LegacyPublicAuth.php',
191
+    'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => $baseDir.'/../lib/Connector/Sabre/AnonymousOptionsPlugin.php',
192
+    'OCA\\DAV\\Connector\\Sabre\\AppleQuirksPlugin' => $baseDir.'/../lib/Connector/Sabre/AppleQuirksPlugin.php',
193
+    'OCA\\DAV\\Connector\\Sabre\\Auth' => $baseDir.'/../lib/Connector/Sabre/Auth.php',
194
+    'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => $baseDir.'/../lib/Connector/Sabre/BearerAuth.php',
195
+    'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => $baseDir.'/../lib/Connector/Sabre/BlockLegacyClientPlugin.php',
196
+    'OCA\\DAV\\Connector\\Sabre\\CachingTree' => $baseDir.'/../lib/Connector/Sabre/CachingTree.php',
197
+    'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => $baseDir.'/../lib/Connector/Sabre/ChecksumList.php',
198
+    'OCA\\DAV\\Connector\\Sabre\\ChecksumUpdatePlugin' => $baseDir.'/../lib/Connector/Sabre/ChecksumUpdatePlugin.php',
199
+    'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => $baseDir.'/../lib/Connector/Sabre/CommentPropertiesPlugin.php',
200
+    'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => $baseDir.'/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php',
201
+    'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => $baseDir.'/../lib/Connector/Sabre/DavAclPlugin.php',
202
+    'OCA\\DAV\\Connector\\Sabre\\Directory' => $baseDir.'/../lib/Connector/Sabre/Directory.php',
203
+    'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => $baseDir.'/../lib/Connector/Sabre/DummyGetResponsePlugin.php',
204
+    'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => $baseDir.'/../lib/Connector/Sabre/ExceptionLoggerPlugin.php',
205
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\BadGateway' => $baseDir.'/../lib/Connector/Sabre/Exception/BadGateway.php',
206
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => $baseDir.'/../lib/Connector/Sabre/Exception/EntityTooLarge.php',
207
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => $baseDir.'/../lib/Connector/Sabre/Exception/FileLocked.php',
208
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => $baseDir.'/../lib/Connector/Sabre/Exception/Forbidden.php',
209
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => $baseDir.'/../lib/Connector/Sabre/Exception/InvalidPath.php',
210
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => $baseDir.'/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php',
211
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\TooManyRequests' => $baseDir.'/../lib/Connector/Sabre/Exception/TooManyRequests.php',
212
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => $baseDir.'/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php',
213
+    'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => $baseDir.'/../lib/Connector/Sabre/FakeLockerPlugin.php',
214
+    'OCA\\DAV\\Connector\\Sabre\\File' => $baseDir.'/../lib/Connector/Sabre/File.php',
215
+    'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => $baseDir.'/../lib/Connector/Sabre/FilesPlugin.php',
216
+    'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => $baseDir.'/../lib/Connector/Sabre/FilesReportPlugin.php',
217
+    'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => $baseDir.'/../lib/Connector/Sabre/LockPlugin.php',
218
+    'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => $baseDir.'/../lib/Connector/Sabre/MaintenancePlugin.php',
219
+    'OCA\\DAV\\Connector\\Sabre\\MtimeSanitizer' => $baseDir.'/../lib/Connector/Sabre/MtimeSanitizer.php',
220
+    'OCA\\DAV\\Connector\\Sabre\\Node' => $baseDir.'/../lib/Connector/Sabre/Node.php',
221
+    'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => $baseDir.'/../lib/Connector/Sabre/ObjectTree.php',
222
+    'OCA\\DAV\\Connector\\Sabre\\Principal' => $baseDir.'/../lib/Connector/Sabre/Principal.php',
223
+    'OCA\\DAV\\Connector\\Sabre\\PropFindMonitorPlugin' => $baseDir.'/../lib/Connector/Sabre/PropFindMonitorPlugin.php',
224
+    'OCA\\DAV\\Connector\\Sabre\\PropFindPreloadNotifyPlugin' => $baseDir.'/../lib/Connector/Sabre/PropFindPreloadNotifyPlugin.php',
225
+    'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => $baseDir.'/../lib/Connector/Sabre/PropfindCompressionPlugin.php',
226
+    'OCA\\DAV\\Connector\\Sabre\\PublicAuth' => $baseDir.'/../lib/Connector/Sabre/PublicAuth.php',
227
+    'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => $baseDir.'/../lib/Connector/Sabre/QuotaPlugin.php',
228
+    'OCA\\DAV\\Connector\\Sabre\\RequestIdHeaderPlugin' => $baseDir.'/../lib/Connector/Sabre/RequestIdHeaderPlugin.php',
229
+    'OCA\\DAV\\Connector\\Sabre\\Server' => $baseDir.'/../lib/Connector/Sabre/Server.php',
230
+    'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => $baseDir.'/../lib/Connector/Sabre/ServerFactory.php',
231
+    'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => $baseDir.'/../lib/Connector/Sabre/ShareTypeList.php',
232
+    'OCA\\DAV\\Connector\\Sabre\\ShareeList' => $baseDir.'/../lib/Connector/Sabre/ShareeList.php',
233
+    'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => $baseDir.'/../lib/Connector/Sabre/SharesPlugin.php',
234
+    'OCA\\DAV\\Connector\\Sabre\\TagList' => $baseDir.'/../lib/Connector/Sabre/TagList.php',
235
+    'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => $baseDir.'/../lib/Connector/Sabre/TagsPlugin.php',
236
+    'OCA\\DAV\\Connector\\Sabre\\ZipFolderPlugin' => $baseDir.'/../lib/Connector/Sabre/ZipFolderPlugin.php',
237
+    'OCA\\DAV\\Controller\\BirthdayCalendarController' => $baseDir.'/../lib/Controller/BirthdayCalendarController.php',
238
+    'OCA\\DAV\\Controller\\DirectController' => $baseDir.'/../lib/Controller/DirectController.php',
239
+    'OCA\\DAV\\Controller\\ExampleContentController' => $baseDir.'/../lib/Controller/ExampleContentController.php',
240
+    'OCA\\DAV\\Controller\\InvitationResponseController' => $baseDir.'/../lib/Controller/InvitationResponseController.php',
241
+    'OCA\\DAV\\Controller\\OutOfOfficeController' => $baseDir.'/../lib/Controller/OutOfOfficeController.php',
242
+    'OCA\\DAV\\Controller\\UpcomingEventsController' => $baseDir.'/../lib/Controller/UpcomingEventsController.php',
243
+    'OCA\\DAV\\DAV\\CustomPropertiesBackend' => $baseDir.'/../lib/DAV/CustomPropertiesBackend.php',
244
+    'OCA\\DAV\\DAV\\GroupPrincipalBackend' => $baseDir.'/../lib/DAV/GroupPrincipalBackend.php',
245
+    'OCA\\DAV\\DAV\\PublicAuth' => $baseDir.'/../lib/DAV/PublicAuth.php',
246
+    'OCA\\DAV\\DAV\\Sharing\\Backend' => $baseDir.'/../lib/DAV/Sharing/Backend.php',
247
+    'OCA\\DAV\\DAV\\Sharing\\IShareable' => $baseDir.'/../lib/DAV/Sharing/IShareable.php',
248
+    'OCA\\DAV\\DAV\\Sharing\\Plugin' => $baseDir.'/../lib/DAV/Sharing/Plugin.php',
249
+    'OCA\\DAV\\DAV\\Sharing\\SharingMapper' => $baseDir.'/../lib/DAV/Sharing/SharingMapper.php',
250
+    'OCA\\DAV\\DAV\\Sharing\\SharingService' => $baseDir.'/../lib/DAV/Sharing/SharingService.php',
251
+    'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => $baseDir.'/../lib/DAV/Sharing/Xml/Invite.php',
252
+    'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => $baseDir.'/../lib/DAV/Sharing/Xml/ShareRequest.php',
253
+    'OCA\\DAV\\DAV\\SystemPrincipalBackend' => $baseDir.'/../lib/DAV/SystemPrincipalBackend.php',
254
+    'OCA\\DAV\\DAV\\ViewOnlyPlugin' => $baseDir.'/../lib/DAV/ViewOnlyPlugin.php',
255
+    'OCA\\DAV\\Db\\Absence' => $baseDir.'/../lib/Db/Absence.php',
256
+    'OCA\\DAV\\Db\\AbsenceMapper' => $baseDir.'/../lib/Db/AbsenceMapper.php',
257
+    'OCA\\DAV\\Db\\Direct' => $baseDir.'/../lib/Db/Direct.php',
258
+    'OCA\\DAV\\Db\\DirectMapper' => $baseDir.'/../lib/Db/DirectMapper.php',
259
+    'OCA\\DAV\\Db\\Property' => $baseDir.'/../lib/Db/Property.php',
260
+    'OCA\\DAV\\Db\\PropertyMapper' => $baseDir.'/../lib/Db/PropertyMapper.php',
261
+    'OCA\\DAV\\Direct\\DirectFile' => $baseDir.'/../lib/Direct/DirectFile.php',
262
+    'OCA\\DAV\\Direct\\DirectHome' => $baseDir.'/../lib/Direct/DirectHome.php',
263
+    'OCA\\DAV\\Direct\\Server' => $baseDir.'/../lib/Direct/Server.php',
264
+    'OCA\\DAV\\Direct\\ServerFactory' => $baseDir.'/../lib/Direct/ServerFactory.php',
265
+    'OCA\\DAV\\Events\\AddressBookCreatedEvent' => $baseDir.'/../lib/Events/AddressBookCreatedEvent.php',
266
+    'OCA\\DAV\\Events\\AddressBookDeletedEvent' => $baseDir.'/../lib/Events/AddressBookDeletedEvent.php',
267
+    'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => $baseDir.'/../lib/Events/AddressBookShareUpdatedEvent.php',
268
+    'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => $baseDir.'/../lib/Events/AddressBookUpdatedEvent.php',
269
+    'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => $baseDir.'/../lib/Events/BeforeFileDirectDownloadedEvent.php',
270
+    'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => $baseDir.'/../lib/Events/CachedCalendarObjectCreatedEvent.php',
271
+    'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => $baseDir.'/../lib/Events/CachedCalendarObjectDeletedEvent.php',
272
+    'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => $baseDir.'/../lib/Events/CachedCalendarObjectUpdatedEvent.php',
273
+    'OCA\\DAV\\Events\\CalendarCreatedEvent' => $baseDir.'/../lib/Events/CalendarCreatedEvent.php',
274
+    'OCA\\DAV\\Events\\CalendarDeletedEvent' => $baseDir.'/../lib/Events/CalendarDeletedEvent.php',
275
+    'OCA\\DAV\\Events\\CalendarMovedToTrashEvent' => $baseDir.'/../lib/Events/CalendarMovedToTrashEvent.php',
276
+    'OCA\\DAV\\Events\\CalendarPublishedEvent' => $baseDir.'/../lib/Events/CalendarPublishedEvent.php',
277
+    'OCA\\DAV\\Events\\CalendarRestoredEvent' => $baseDir.'/../lib/Events/CalendarRestoredEvent.php',
278
+    'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => $baseDir.'/../lib/Events/CalendarShareUpdatedEvent.php',
279
+    'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => $baseDir.'/../lib/Events/CalendarUnpublishedEvent.php',
280
+    'OCA\\DAV\\Events\\CalendarUpdatedEvent' => $baseDir.'/../lib/Events/CalendarUpdatedEvent.php',
281
+    'OCA\\DAV\\Events\\CardCreatedEvent' => $baseDir.'/../lib/Events/CardCreatedEvent.php',
282
+    'OCA\\DAV\\Events\\CardDeletedEvent' => $baseDir.'/../lib/Events/CardDeletedEvent.php',
283
+    'OCA\\DAV\\Events\\CardMovedEvent' => $baseDir.'/../lib/Events/CardMovedEvent.php',
284
+    'OCA\\DAV\\Events\\CardUpdatedEvent' => $baseDir.'/../lib/Events/CardUpdatedEvent.php',
285
+    'OCA\\DAV\\Events\\SabrePluginAddEvent' => $baseDir.'/../lib/Events/SabrePluginAddEvent.php',
286
+    'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => $baseDir.'/../lib/Events/SabrePluginAuthInitEvent.php',
287
+    'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => $baseDir.'/../lib/Events/SubscriptionCreatedEvent.php',
288
+    'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => $baseDir.'/../lib/Events/SubscriptionDeletedEvent.php',
289
+    'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => $baseDir.'/../lib/Events/SubscriptionUpdatedEvent.php',
290
+    'OCA\\DAV\\Exception\\ExampleEventException' => $baseDir.'/../lib/Exception/ExampleEventException.php',
291
+    'OCA\\DAV\\Exception\\ServerMaintenanceMode' => $baseDir.'/../lib/Exception/ServerMaintenanceMode.php',
292
+    'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => $baseDir.'/../lib/Exception/UnsupportedLimitOnInitialSyncException.php',
293
+    'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => $baseDir.'/../lib/Files/BrowserErrorPagePlugin.php',
294
+    'OCA\\DAV\\Files\\FileSearchBackend' => $baseDir.'/../lib/Files/FileSearchBackend.php',
295
+    'OCA\\DAV\\Files\\FilesHome' => $baseDir.'/../lib/Files/FilesHome.php',
296
+    'OCA\\DAV\\Files\\LazySearchBackend' => $baseDir.'/../lib/Files/LazySearchBackend.php',
297
+    'OCA\\DAV\\Files\\RootCollection' => $baseDir.'/../lib/Files/RootCollection.php',
298
+    'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => $baseDir.'/../lib/Files/Sharing/FilesDropPlugin.php',
299
+    'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => $baseDir.'/../lib/Files/Sharing/PublicLinkCheckPlugin.php',
300
+    'OCA\\DAV\\Files\\Sharing\\RootCollection' => $baseDir.'/../lib/Files/Sharing/RootCollection.php',
301
+    'OCA\\DAV\\Listener\\ActivityUpdaterListener' => $baseDir.'/../lib/Listener/ActivityUpdaterListener.php',
302
+    'OCA\\DAV\\Listener\\AddMissingIndicesListener' => $baseDir.'/../lib/Listener/AddMissingIndicesListener.php',
303
+    'OCA\\DAV\\Listener\\AddressbookListener' => $baseDir.'/../lib/Listener/AddressbookListener.php',
304
+    'OCA\\DAV\\Listener\\BirthdayListener' => $baseDir.'/../lib/Listener/BirthdayListener.php',
305
+    'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => $baseDir.'/../lib/Listener/CalendarContactInteractionListener.php',
306
+    'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => $baseDir.'/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php',
307
+    'OCA\\DAV\\Listener\\CalendarObjectReminderUpdaterListener' => $baseDir.'/../lib/Listener/CalendarObjectReminderUpdaterListener.php',
308
+    'OCA\\DAV\\Listener\\CalendarPublicationListener' => $baseDir.'/../lib/Listener/CalendarPublicationListener.php',
309
+    'OCA\\DAV\\Listener\\CalendarShareUpdateListener' => $baseDir.'/../lib/Listener/CalendarShareUpdateListener.php',
310
+    'OCA\\DAV\\Listener\\CardListener' => $baseDir.'/../lib/Listener/CardListener.php',
311
+    'OCA\\DAV\\Listener\\ClearPhotoCacheListener' => $baseDir.'/../lib/Listener/ClearPhotoCacheListener.php',
312
+    'OCA\\DAV\\Listener\\DavAdminSettingsListener' => $baseDir.'/../lib/Listener/DavAdminSettingsListener.php',
313
+    'OCA\\DAV\\Listener\\OutOfOfficeListener' => $baseDir.'/../lib/Listener/OutOfOfficeListener.php',
314
+    'OCA\\DAV\\Listener\\SubscriptionListener' => $baseDir.'/../lib/Listener/SubscriptionListener.php',
315
+    'OCA\\DAV\\Listener\\TrustedServerRemovedListener' => $baseDir.'/../lib/Listener/TrustedServerRemovedListener.php',
316
+    'OCA\\DAV\\Listener\\UserEventsListener' => $baseDir.'/../lib/Listener/UserEventsListener.php',
317
+    'OCA\\DAV\\Listener\\UserPreferenceListener' => $baseDir.'/../lib/Listener/UserPreferenceListener.php',
318
+    'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => $baseDir.'/../lib/Migration/BuildCalendarSearchIndex.php',
319
+    'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => $baseDir.'/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php',
320
+    'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => $baseDir.'/../lib/Migration/BuildSocialSearchIndex.php',
321
+    'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => $baseDir.'/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php',
322
+    'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => $baseDir.'/../lib/Migration/CalDAVRemoveEmptyValue.php',
323
+    'OCA\\DAV\\Migration\\ChunkCleanup' => $baseDir.'/../lib/Migration/ChunkCleanup.php',
324
+    'OCA\\DAV\\Migration\\CreateSystemAddressBookStep' => $baseDir.'/../lib/Migration/CreateSystemAddressBookStep.php',
325
+    'OCA\\DAV\\Migration\\DeleteSchedulingObjects' => $baseDir.'/../lib/Migration/DeleteSchedulingObjects.php',
326
+    'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => $baseDir.'/../lib/Migration/FixBirthdayCalendarComponent.php',
327
+    'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => $baseDir.'/../lib/Migration/RefreshWebcalJobRegistrar.php',
328
+    'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => $baseDir.'/../lib/Migration/RegenerateBirthdayCalendars.php',
329
+    'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => $baseDir.'/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php',
330
+    'OCA\\DAV\\Migration\\RegisterUpdateCalendarResourcesRoomBackgroundJob' => $baseDir.'/../lib/Migration/RegisterUpdateCalendarResourcesRoomBackgroundJob.php',
331
+    'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => $baseDir.'/../lib/Migration/RemoveClassifiedEventActivity.php',
332
+    'OCA\\DAV\\Migration\\RemoveDeletedUsersCalendarSubscriptions' => $baseDir.'/../lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php',
333
+    'OCA\\DAV\\Migration\\RemoveObjectProperties' => $baseDir.'/../lib/Migration/RemoveObjectProperties.php',
334
+    'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => $baseDir.'/../lib/Migration/RemoveOrphanEventsAndContacts.php',
335
+    'OCA\\DAV\\Migration\\Version1004Date20170825134824' => $baseDir.'/../lib/Migration/Version1004Date20170825134824.php',
336
+    'OCA\\DAV\\Migration\\Version1004Date20170919104507' => $baseDir.'/../lib/Migration/Version1004Date20170919104507.php',
337
+    'OCA\\DAV\\Migration\\Version1004Date20170924124212' => $baseDir.'/../lib/Migration/Version1004Date20170924124212.php',
338
+    'OCA\\DAV\\Migration\\Version1004Date20170926103422' => $baseDir.'/../lib/Migration/Version1004Date20170926103422.php',
339
+    'OCA\\DAV\\Migration\\Version1005Date20180413093149' => $baseDir.'/../lib/Migration/Version1005Date20180413093149.php',
340
+    'OCA\\DAV\\Migration\\Version1005Date20180530124431' => $baseDir.'/../lib/Migration/Version1005Date20180530124431.php',
341
+    'OCA\\DAV\\Migration\\Version1006Date20180619154313' => $baseDir.'/../lib/Migration/Version1006Date20180619154313.php',
342
+    'OCA\\DAV\\Migration\\Version1006Date20180628111625' => $baseDir.'/../lib/Migration/Version1006Date20180628111625.php',
343
+    'OCA\\DAV\\Migration\\Version1008Date20181030113700' => $baseDir.'/../lib/Migration/Version1008Date20181030113700.php',
344
+    'OCA\\DAV\\Migration\\Version1008Date20181105104826' => $baseDir.'/../lib/Migration/Version1008Date20181105104826.php',
345
+    'OCA\\DAV\\Migration\\Version1008Date20181105104833' => $baseDir.'/../lib/Migration/Version1008Date20181105104833.php',
346
+    'OCA\\DAV\\Migration\\Version1008Date20181105110300' => $baseDir.'/../lib/Migration/Version1008Date20181105110300.php',
347
+    'OCA\\DAV\\Migration\\Version1008Date20181105112049' => $baseDir.'/../lib/Migration/Version1008Date20181105112049.php',
348
+    'OCA\\DAV\\Migration\\Version1008Date20181114084440' => $baseDir.'/../lib/Migration/Version1008Date20181114084440.php',
349
+    'OCA\\DAV\\Migration\\Version1011Date20190725113607' => $baseDir.'/../lib/Migration/Version1011Date20190725113607.php',
350
+    'OCA\\DAV\\Migration\\Version1011Date20190806104428' => $baseDir.'/../lib/Migration/Version1011Date20190806104428.php',
351
+    'OCA\\DAV\\Migration\\Version1012Date20190808122342' => $baseDir.'/../lib/Migration/Version1012Date20190808122342.php',
352
+    'OCA\\DAV\\Migration\\Version1016Date20201109085907' => $baseDir.'/../lib/Migration/Version1016Date20201109085907.php',
353
+    'OCA\\DAV\\Migration\\Version1017Date20210216083742' => $baseDir.'/../lib/Migration/Version1017Date20210216083742.php',
354
+    'OCA\\DAV\\Migration\\Version1018Date20210312100735' => $baseDir.'/../lib/Migration/Version1018Date20210312100735.php',
355
+    'OCA\\DAV\\Migration\\Version1024Date20211221144219' => $baseDir.'/../lib/Migration/Version1024Date20211221144219.php',
356
+    'OCA\\DAV\\Migration\\Version1025Date20240308063933' => $baseDir.'/../lib/Migration/Version1025Date20240308063933.php',
357
+    'OCA\\DAV\\Migration\\Version1027Date20230504122946' => $baseDir.'/../lib/Migration/Version1027Date20230504122946.php',
358
+    'OCA\\DAV\\Migration\\Version1029Date20221114151721' => $baseDir.'/../lib/Migration/Version1029Date20221114151721.php',
359
+    'OCA\\DAV\\Migration\\Version1029Date20231004091403' => $baseDir.'/../lib/Migration/Version1029Date20231004091403.php',
360
+    'OCA\\DAV\\Migration\\Version1030Date20240205103243' => $baseDir.'/../lib/Migration/Version1030Date20240205103243.php',
361
+    'OCA\\DAV\\Migration\\Version1031Date20240610134258' => $baseDir.'/../lib/Migration/Version1031Date20240610134258.php',
362
+    'OCA\\DAV\\Migration\\Version1034Date20250813093701' => $baseDir.'/../lib/Migration/Version1034Date20250813093701.php',
363
+    'OCA\\DAV\\Model\\ExampleEvent' => $baseDir.'/../lib/Model/ExampleEvent.php',
364
+    'OCA\\DAV\\Paginate\\LimitedCopyIterator' => $baseDir.'/../lib/Paginate/LimitedCopyIterator.php',
365
+    'OCA\\DAV\\Paginate\\PaginateCache' => $baseDir.'/../lib/Paginate/PaginateCache.php',
366
+    'OCA\\DAV\\Paginate\\PaginatePlugin' => $baseDir.'/../lib/Paginate/PaginatePlugin.php',
367
+    'OCA\\DAV\\Profiler\\ProfilerPlugin' => $baseDir.'/../lib/Profiler/ProfilerPlugin.php',
368
+    'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => $baseDir.'/../lib/Provisioning/Apple/AppleProvisioningNode.php',
369
+    'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => $baseDir.'/../lib/Provisioning/Apple/AppleProvisioningPlugin.php',
370
+    'OCA\\DAV\\ResponseDefinitions' => $baseDir.'/../lib/ResponseDefinitions.php',
371
+    'OCA\\DAV\\RootCollection' => $baseDir.'/../lib/RootCollection.php',
372
+    'OCA\\DAV\\Search\\ACalendarSearchProvider' => $baseDir.'/../lib/Search/ACalendarSearchProvider.php',
373
+    'OCA\\DAV\\Search\\ContactsSearchProvider' => $baseDir.'/../lib/Search/ContactsSearchProvider.php',
374
+    'OCA\\DAV\\Search\\EventsSearchProvider' => $baseDir.'/../lib/Search/EventsSearchProvider.php',
375
+    'OCA\\DAV\\Search\\TasksSearchProvider' => $baseDir.'/../lib/Search/TasksSearchProvider.php',
376
+    'OCA\\DAV\\Server' => $baseDir.'/../lib/Server.php',
377
+    'OCA\\DAV\\ServerFactory' => $baseDir.'/../lib/ServerFactory.php',
378
+    'OCA\\DAV\\Service\\AbsenceService' => $baseDir.'/../lib/Service/AbsenceService.php',
379
+    'OCA\\DAV\\Service\\ExampleContactService' => $baseDir.'/../lib/Service/ExampleContactService.php',
380
+    'OCA\\DAV\\Service\\ExampleEventService' => $baseDir.'/../lib/Service/ExampleEventService.php',
381
+    'OCA\\DAV\\Settings\\Admin\\SystemAddressBookSettings' => $baseDir.'/../lib/Settings/Admin/SystemAddressBookSettings.php',
382
+    'OCA\\DAV\\Settings\\AvailabilitySettings' => $baseDir.'/../lib/Settings/AvailabilitySettings.php',
383
+    'OCA\\DAV\\Settings\\CalDAVSettings' => $baseDir.'/../lib/Settings/CalDAVSettings.php',
384
+    'OCA\\DAV\\Settings\\ExampleContentSettings' => $baseDir.'/../lib/Settings/ExampleContentSettings.php',
385
+    'OCA\\DAV\\SetupChecks\\NeedsSystemAddressBookSync' => $baseDir.'/../lib/SetupChecks/NeedsSystemAddressBookSync.php',
386
+    'OCA\\DAV\\SetupChecks\\WebdavEndpoint' => $baseDir.'/../lib/SetupChecks/WebdavEndpoint.php',
387
+    'OCA\\DAV\\Storage\\PublicOwnerWrapper' => $baseDir.'/../lib/Storage/PublicOwnerWrapper.php',
388
+    'OCA\\DAV\\Storage\\PublicShareWrapper' => $baseDir.'/../lib/Storage/PublicShareWrapper.php',
389
+    'OCA\\DAV\\SystemTag\\SystemTagList' => $baseDir.'/../lib/SystemTag/SystemTagList.php',
390
+    'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => $baseDir.'/../lib/SystemTag/SystemTagMappingNode.php',
391
+    'OCA\\DAV\\SystemTag\\SystemTagNode' => $baseDir.'/../lib/SystemTag/SystemTagNode.php',
392
+    'OCA\\DAV\\SystemTag\\SystemTagObjectType' => $baseDir.'/../lib/SystemTag/SystemTagObjectType.php',
393
+    'OCA\\DAV\\SystemTag\\SystemTagPlugin' => $baseDir.'/../lib/SystemTag/SystemTagPlugin.php',
394
+    'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => $baseDir.'/../lib/SystemTag/SystemTagsByIdCollection.php',
395
+    'OCA\\DAV\\SystemTag\\SystemTagsInUseCollection' => $baseDir.'/../lib/SystemTag/SystemTagsInUseCollection.php',
396
+    'OCA\\DAV\\SystemTag\\SystemTagsObjectList' => $baseDir.'/../lib/SystemTag/SystemTagsObjectList.php',
397
+    'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => $baseDir.'/../lib/SystemTag/SystemTagsObjectMappingCollection.php',
398
+    'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => $baseDir.'/../lib/SystemTag/SystemTagsObjectTypeCollection.php',
399
+    'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => $baseDir.'/../lib/SystemTag/SystemTagsRelationsCollection.php',
400
+    'OCA\\DAV\\Traits\\PrincipalProxyTrait' => $baseDir.'/../lib/Traits/PrincipalProxyTrait.php',
401
+    'OCA\\DAV\\Upload\\AssemblyStream' => $baseDir.'/../lib/Upload/AssemblyStream.php',
402
+    'OCA\\DAV\\Upload\\ChunkingPlugin' => $baseDir.'/../lib/Upload/ChunkingPlugin.php',
403
+    'OCA\\DAV\\Upload\\ChunkingV2Plugin' => $baseDir.'/../lib/Upload/ChunkingV2Plugin.php',
404
+    'OCA\\DAV\\Upload\\CleanupService' => $baseDir.'/../lib/Upload/CleanupService.php',
405
+    'OCA\\DAV\\Upload\\FutureFile' => $baseDir.'/../lib/Upload/FutureFile.php',
406
+    'OCA\\DAV\\Upload\\PartFile' => $baseDir.'/../lib/Upload/PartFile.php',
407
+    'OCA\\DAV\\Upload\\RootCollection' => $baseDir.'/../lib/Upload/RootCollection.php',
408
+    'OCA\\DAV\\Upload\\UploadAutoMkcolPlugin' => $baseDir.'/../lib/Upload/UploadAutoMkcolPlugin.php',
409
+    'OCA\\DAV\\Upload\\UploadFile' => $baseDir.'/../lib/Upload/UploadFile.php',
410
+    'OCA\\DAV\\Upload\\UploadFolder' => $baseDir.'/../lib/Upload/UploadFolder.php',
411
+    'OCA\\DAV\\Upload\\UploadHome' => $baseDir.'/../lib/Upload/UploadHome.php',
412
+    'OCA\\DAV\\UserMigration\\CalendarMigrator' => $baseDir.'/../lib/UserMigration/CalendarMigrator.php',
413
+    'OCA\\DAV\\UserMigration\\CalendarMigratorException' => $baseDir.'/../lib/UserMigration/CalendarMigratorException.php',
414
+    'OCA\\DAV\\UserMigration\\ContactsMigrator' => $baseDir.'/../lib/UserMigration/ContactsMigrator.php',
415
+    'OCA\\DAV\\UserMigration\\ContactsMigratorException' => $baseDir.'/../lib/UserMigration/ContactsMigratorException.php',
416
+    'OCA\\DAV\\UserMigration\\InvalidAddressBookException' => $baseDir.'/../lib/UserMigration/InvalidAddressBookException.php',
417
+    'OCA\\DAV\\UserMigration\\InvalidCalendarException' => $baseDir.'/../lib/UserMigration/InvalidCalendarException.php',
418 418
 );
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Import/TextImporter.php 2 patches
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -11,146 +11,146 @@
 block discarded – undo
11 11
 
12 12
 class TextImporter {
13 13
 
14
-	public const OBJECT_PREFIX = 'BEGIN:VCALENDAR' . PHP_EOL;
15
-	public const OBJECT_SUFFIX = PHP_EOL . 'END:VCALENDAR';
16
-	private const COMPONENT_TYPES = ['VEVENT', 'VTODO', 'VJOURNAL', 'VTIMEZONE'];
14
+    public const OBJECT_PREFIX = 'BEGIN:VCALENDAR' . PHP_EOL;
15
+    public const OBJECT_SUFFIX = PHP_EOL . 'END:VCALENDAR';
16
+    private const COMPONENT_TYPES = ['VEVENT', 'VTODO', 'VJOURNAL', 'VTIMEZONE'];
17 17
 
18
-	private bool $analyzed = false;
19
-	private array $structure = ['VCALENDAR' => [], 'VEVENT' => [], 'VTODO' => [], 'VJOURNAL' => [], 'VTIMEZONE' => []];
18
+    private bool $analyzed = false;
19
+    private array $structure = ['VCALENDAR' => [], 'VEVENT' => [], 'VTODO' => [], 'VJOURNAL' => [], 'VTIMEZONE' => []];
20 20
 
21
-	/**
22
-	 * @param resource $source
23
-	 */
24
-	public function __construct(
25
-		private $source,
26
-	) {
27
-		// Ensure that source is a stream resource
28
-		if (!is_resource($source) || get_resource_type($source) !== 'stream') {
29
-			throw new Exception('Source must be a stream resource');
30
-		}
31
-	}
21
+    /**
22
+     * @param resource $source
23
+     */
24
+    public function __construct(
25
+        private $source,
26
+    ) {
27
+        // Ensure that source is a stream resource
28
+        if (!is_resource($source) || get_resource_type($source) !== 'stream') {
29
+            throw new Exception('Source must be a stream resource');
30
+        }
31
+    }
32 32
 
33
-	/**
34
-	 * Analyzes the source data and creates a structure of components
35
-	 */
36
-	private function analyze() {
37
-		$componentStart = null;
38
-		$componentEnd = null;
39
-		$componentId = null;
40
-		$componentType = null;
41
-		$tagName = null;
42
-		$tagValue = null;
33
+    /**
34
+     * Analyzes the source data and creates a structure of components
35
+     */
36
+    private function analyze() {
37
+        $componentStart = null;
38
+        $componentEnd = null;
39
+        $componentId = null;
40
+        $componentType = null;
41
+        $tagName = null;
42
+        $tagValue = null;
43 43
 
44
-		// iterate through the source data line by line
45
-		fseek($this->source, 0);
46
-		while (!feof($this->source)) {
47
-			$data = fgets($this->source);
48
-			// skip empty lines
49
-			if ($data === false || empty(trim($data))) {
50
-				continue;
51
-			}
52
-			// lines with whitespace at the beginning are continuations of the previous line
53
-			if (ctype_space($data[0]) === false) {
54
-				// detect the line TAG
55
-				// detect the first occurrence of ':' or ';'
56
-				$colonPos = strpos($data, ':');
57
-				$semicolonPos = strpos($data, ';');
58
-				if ($colonPos !== false && $semicolonPos !== false) {
59
-					$splitPosition = min($colonPos, $semicolonPos);
60
-				} elseif ($colonPos !== false) {
61
-					$splitPosition = $colonPos;
62
-				} elseif ($semicolonPos !== false) {
63
-					$splitPosition = $semicolonPos;
64
-				} else {
65
-					continue;
66
-				}
67
-				$tagName = strtoupper(trim(substr($data, 0, $splitPosition)));
68
-				$tagValue = trim(substr($data, $splitPosition + 1));
69
-				$tagContinuation = false;
70
-			} else {
71
-				$tagContinuation = true;
72
-				$tagValue .= trim($data);
73
-			}
44
+        // iterate through the source data line by line
45
+        fseek($this->source, 0);
46
+        while (!feof($this->source)) {
47
+            $data = fgets($this->source);
48
+            // skip empty lines
49
+            if ($data === false || empty(trim($data))) {
50
+                continue;
51
+            }
52
+            // lines with whitespace at the beginning are continuations of the previous line
53
+            if (ctype_space($data[0]) === false) {
54
+                // detect the line TAG
55
+                // detect the first occurrence of ':' or ';'
56
+                $colonPos = strpos($data, ':');
57
+                $semicolonPos = strpos($data, ';');
58
+                if ($colonPos !== false && $semicolonPos !== false) {
59
+                    $splitPosition = min($colonPos, $semicolonPos);
60
+                } elseif ($colonPos !== false) {
61
+                    $splitPosition = $colonPos;
62
+                } elseif ($semicolonPos !== false) {
63
+                    $splitPosition = $semicolonPos;
64
+                } else {
65
+                    continue;
66
+                }
67
+                $tagName = strtoupper(trim(substr($data, 0, $splitPosition)));
68
+                $tagValue = trim(substr($data, $splitPosition + 1));
69
+                $tagContinuation = false;
70
+            } else {
71
+                $tagContinuation = true;
72
+                $tagValue .= trim($data);
73
+            }
74 74
 
75
-			if ($tagContinuation === false) {
76
-				// check line for component start, remember the position and determine the type
77
-				if ($tagName === 'BEGIN' && in_array($tagValue, self::COMPONENT_TYPES, true)) {
78
-					$componentStart = ftell($this->source) - strlen($data);
79
-					$componentType = $tagValue;
80
-				}
81
-				// check line for component end, remember the position
82
-				if ($tagName === 'END' && $componentType === $tagValue) {
83
-					$componentEnd = ftell($this->source);
84
-				}
85
-				// check line for component id
86
-				if ($componentStart !== null && ($tagName === 'UID' || $tagName === 'TZID')) {
87
-					$componentId = $tagValue;
88
-				}
89
-			} else {
90
-				// check line for component id
91
-				if ($componentStart !== null && ($tagName === 'UID' || $tagName === 'TZID')) {
92
-					$componentId = $tagValue;
93
-				}
94
-			}
95
-			// any line(s) not inside a component are VCALENDAR properties
96
-			if ($componentStart === null) {
97
-				if ($tagName !== 'BEGIN' && $tagName !== 'END' && $tagValue === 'VCALENDAR') {
98
-					$components['VCALENDAR'][] = $data;
99
-				}
100
-			}
101
-			// if component start and end are found, add the component to the structure
102
-			if ($componentStart !== null && $componentEnd !== null) {
103
-				if ($componentId !== null) {
104
-					$this->structure[$componentType][$componentId][] = [
105
-						$componentType,
106
-						$componentId,
107
-						$componentStart,
108
-						$componentEnd
109
-					];
110
-				} else {
111
-					$this->structure[$componentType][] = [
112
-						$componentType,
113
-						$componentId,
114
-						$componentStart,
115
-						$componentEnd
116
-					];
117
-				}
118
-				$componentId = null;
119
-				$componentType = null;
120
-				$componentStart = null;
121
-				$componentEnd = null;
122
-			}
123
-		}
124
-	}
75
+            if ($tagContinuation === false) {
76
+                // check line for component start, remember the position and determine the type
77
+                if ($tagName === 'BEGIN' && in_array($tagValue, self::COMPONENT_TYPES, true)) {
78
+                    $componentStart = ftell($this->source) - strlen($data);
79
+                    $componentType = $tagValue;
80
+                }
81
+                // check line for component end, remember the position
82
+                if ($tagName === 'END' && $componentType === $tagValue) {
83
+                    $componentEnd = ftell($this->source);
84
+                }
85
+                // check line for component id
86
+                if ($componentStart !== null && ($tagName === 'UID' || $tagName === 'TZID')) {
87
+                    $componentId = $tagValue;
88
+                }
89
+            } else {
90
+                // check line for component id
91
+                if ($componentStart !== null && ($tagName === 'UID' || $tagName === 'TZID')) {
92
+                    $componentId = $tagValue;
93
+                }
94
+            }
95
+            // any line(s) not inside a component are VCALENDAR properties
96
+            if ($componentStart === null) {
97
+                if ($tagName !== 'BEGIN' && $tagName !== 'END' && $tagValue === 'VCALENDAR') {
98
+                    $components['VCALENDAR'][] = $data;
99
+                }
100
+            }
101
+            // if component start and end are found, add the component to the structure
102
+            if ($componentStart !== null && $componentEnd !== null) {
103
+                if ($componentId !== null) {
104
+                    $this->structure[$componentType][$componentId][] = [
105
+                        $componentType,
106
+                        $componentId,
107
+                        $componentStart,
108
+                        $componentEnd
109
+                    ];
110
+                } else {
111
+                    $this->structure[$componentType][] = [
112
+                        $componentType,
113
+                        $componentId,
114
+                        $componentStart,
115
+                        $componentEnd
116
+                    ];
117
+                }
118
+                $componentId = null;
119
+                $componentType = null;
120
+                $componentStart = null;
121
+                $componentEnd = null;
122
+            }
123
+        }
124
+    }
125 125
 
126
-	/**
127
-	 * Returns the analyzed structure of the source data
128
-	 * the analyzed structure is a collection of components organized by type,
129
-	 * each entry is a collection of instances
130
-	 * [
131
-	 *  'VEVENT' => [
132
-	 *    '7456f141-b478-4cb9-8efc-1427ba0d6839' => [
133
-	 *      ['VEVENT', '7456f141-b478-4cb9-8efc-1427ba0d6839', 0, 100 ],
134
-	 *      ['VEVENT', '7456f141-b478-4cb9-8efc-1427ba0d6839', 100, 200 ]
135
-	 *    ]
136
-	 *  ]
137
-	 * ]
138
-	 */
139
-	public function structure(): array {
140
-		if (!$this->analyzed) {
141
-			$this->analyze();
142
-		}
143
-		return $this->structure;
144
-	}
126
+    /**
127
+     * Returns the analyzed structure of the source data
128
+     * the analyzed structure is a collection of components organized by type,
129
+     * each entry is a collection of instances
130
+     * [
131
+     *  'VEVENT' => [
132
+     *    '7456f141-b478-4cb9-8efc-1427ba0d6839' => [
133
+     *      ['VEVENT', '7456f141-b478-4cb9-8efc-1427ba0d6839', 0, 100 ],
134
+     *      ['VEVENT', '7456f141-b478-4cb9-8efc-1427ba0d6839', 100, 200 ]
135
+     *    ]
136
+     *  ]
137
+     * ]
138
+     */
139
+    public function structure(): array {
140
+        if (!$this->analyzed) {
141
+            $this->analyze();
142
+        }
143
+        return $this->structure;
144
+    }
145 145
 
146
-	/**
147
-	 * Extracts a string chuck from the source data
148
-	 *
149
-	 * @param int $start starting byte position
150
-	 * @param int $end ending byte position
151
-	 */
152
-	public function extract(int $start, int $end): string {
153
-		fseek($this->source, $start);
154
-		return fread($this->source, $end - $start);
155
-	}
146
+    /**
147
+     * Extracts a string chuck from the source data
148
+     *
149
+     * @param int $start starting byte position
150
+     * @param int $end ending byte position
151
+     */
152
+    public function extract(int $start, int $end): string {
153
+        fseek($this->source, $start);
154
+        return fread($this->source, $end - $start);
155
+    }
156 156
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
 
12 12
 class TextImporter {
13 13
 
14
-	public const OBJECT_PREFIX = 'BEGIN:VCALENDAR' . PHP_EOL;
15
-	public const OBJECT_SUFFIX = PHP_EOL . 'END:VCALENDAR';
14
+	public const OBJECT_PREFIX = 'BEGIN:VCALENDAR'.PHP_EOL;
15
+	public const OBJECT_SUFFIX = PHP_EOL.'END:VCALENDAR';
16 16
 	private const COMPONENT_TYPES = ['VEVENT', 'VTODO', 'VJOURNAL', 'VTIMEZONE'];
17 17
 
18 18
 	private bool $analyzed = false;
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Import/XmlImporter.php 1 patch
Indentation   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -12,162 +12,162 @@
 block discarded – undo
12 12
 
13 13
 class XmlImporter {
14 14
 
15
-	public const OBJECT_PREFIX = '<?xml version="1.0" encoding="UTF-8"?><icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0"><vcalendar><components>';
16
-	public const OBJECT_SUFFIX = '</components></vcalendar></icalendar>';
17
-	private const COMPONENT_TYPES = ['VEVENT', 'VTODO', 'VJOURNAL', 'VTIMEZONE'];
15
+    public const OBJECT_PREFIX = '<?xml version="1.0" encoding="UTF-8"?><icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0"><vcalendar><components>';
16
+    public const OBJECT_SUFFIX = '</components></vcalendar></icalendar>';
17
+    private const COMPONENT_TYPES = ['VEVENT', 'VTODO', 'VJOURNAL', 'VTIMEZONE'];
18 18
 
19
-	private bool $analyzed = false;
20
-	private array $structure = ['VCALENDAR' => [], 'VEVENT' => [], 'VTODO' => [], 'VJOURNAL' => [], 'VTIMEZONE' => []];
21
-	private int $praseLevel = 0;
22
-	private array $prasePath = [];
23
-	private ?int $componentStart = null;
24
-	private ?int $componentEnd = null;
25
-	private int $componentLevel = 0;
26
-	private ?string $componentId = null;
27
-	private ?string $componentType = null;
28
-	private bool $componentIdProperty = false;
19
+    private bool $analyzed = false;
20
+    private array $structure = ['VCALENDAR' => [], 'VEVENT' => [], 'VTODO' => [], 'VJOURNAL' => [], 'VTIMEZONE' => []];
21
+    private int $praseLevel = 0;
22
+    private array $prasePath = [];
23
+    private ?int $componentStart = null;
24
+    private ?int $componentEnd = null;
25
+    private int $componentLevel = 0;
26
+    private ?string $componentId = null;
27
+    private ?string $componentType = null;
28
+    private bool $componentIdProperty = false;
29 29
 
30
-	/**
31
-	 * @param resource $source
32
-	 */
33
-	public function __construct(
34
-		private $source,
35
-	) {
36
-		// Ensure that source is a stream resource
37
-		if (!is_resource($source) || get_resource_type($source) !== 'stream') {
38
-			throw new Exception('Source must be a stream resource');
39
-		}
40
-	}
30
+    /**
31
+     * @param resource $source
32
+     */
33
+    public function __construct(
34
+        private $source,
35
+    ) {
36
+        // Ensure that source is a stream resource
37
+        if (!is_resource($source) || get_resource_type($source) !== 'stream') {
38
+            throw new Exception('Source must be a stream resource');
39
+        }
40
+    }
41 41
 
42
-	/**
43
-	 * Analyzes the source data and creates a structure of components
44
-	 */
45
-	private function analyze() {
46
-		$this->praseLevel = 0;
47
-		$this->prasePath = [];
48
-		$this->componentStart = null;
49
-		$this->componentEnd = null;
50
-		$this->componentLevel = 0;
51
-		$this->componentId = null;
52
-		$this->componentType = null;
53
-		$this->componentIdProperty = false;
54
-		// Create the parser and assign tag handlers
55
-		$parser = xml_parser_create();
56
-		xml_set_object($parser, $this);
57
-		xml_set_element_handler($parser, $this->tagStart(...), $this->tagEnd(...));
58
-		xml_set_default_handler($parser, $this->tagContents(...));
59
-		// iterate through the source data chuck by chunk to trigger the handlers
60
-		@fseek($this->source, 0);
61
-		while ($chunk = fread($this->source, 4096)) {
62
-			if (!xml_parse($parser, $chunk, feof($this->source))) {
63
-				throw new Exception(
64
-					xml_error_string(xml_get_error_code($parser))
65
-					. ' At line: '
66
-					. xml_get_current_line_number($parser)
67
-				);
68
-			}
69
-		}
70
-		//Free up the parser
71
-		xml_parser_free($parser);
72
-	}
42
+    /**
43
+     * Analyzes the source data and creates a structure of components
44
+     */
45
+    private function analyze() {
46
+        $this->praseLevel = 0;
47
+        $this->prasePath = [];
48
+        $this->componentStart = null;
49
+        $this->componentEnd = null;
50
+        $this->componentLevel = 0;
51
+        $this->componentId = null;
52
+        $this->componentType = null;
53
+        $this->componentIdProperty = false;
54
+        // Create the parser and assign tag handlers
55
+        $parser = xml_parser_create();
56
+        xml_set_object($parser, $this);
57
+        xml_set_element_handler($parser, $this->tagStart(...), $this->tagEnd(...));
58
+        xml_set_default_handler($parser, $this->tagContents(...));
59
+        // iterate through the source data chuck by chunk to trigger the handlers
60
+        @fseek($this->source, 0);
61
+        while ($chunk = fread($this->source, 4096)) {
62
+            if (!xml_parse($parser, $chunk, feof($this->source))) {
63
+                throw new Exception(
64
+                    xml_error_string(xml_get_error_code($parser))
65
+                    . ' At line: '
66
+                    . xml_get_current_line_number($parser)
67
+                );
68
+            }
69
+        }
70
+        //Free up the parser
71
+        xml_parser_free($parser);
72
+    }
73 73
 
74
-	/**
75
-	 * Handles start of tag events from the parser for all tags
76
-	 */
77
-	private function tagStart(XMLParser $parser, string $tag, array $attributes): void {
78
-		// add the tag to the path tracker and increment depth the level
79
-		$this->praseLevel++;
80
-		$this->prasePath[$this->praseLevel] = $tag;
81
-		// determine if the tag is a component type and remember the byte position
82
-		if (in_array($tag, self::COMPONENT_TYPES, true)) {
83
-			$this->componentStart = xml_get_current_byte_index($parser) - (strlen($tag) + 1);
84
-			$this->componentType = $tag;
85
-			$this->componentLevel = $this->praseLevel;
86
-		}
87
-		// determine if the tag is a sub tag of the component and an id property
88
-		if ($this->componentStart !== null
89
-			&& ($this->componentLevel + 2) === $this->praseLevel
90
-			&& ($tag === 'UID' || $tag === 'TZID')
91
-		) {
92
-			$this->componentIdProperty = true;
93
-		}
94
-	}
74
+    /**
75
+     * Handles start of tag events from the parser for all tags
76
+     */
77
+    private function tagStart(XMLParser $parser, string $tag, array $attributes): void {
78
+        // add the tag to the path tracker and increment depth the level
79
+        $this->praseLevel++;
80
+        $this->prasePath[$this->praseLevel] = $tag;
81
+        // determine if the tag is a component type and remember the byte position
82
+        if (in_array($tag, self::COMPONENT_TYPES, true)) {
83
+            $this->componentStart = xml_get_current_byte_index($parser) - (strlen($tag) + 1);
84
+            $this->componentType = $tag;
85
+            $this->componentLevel = $this->praseLevel;
86
+        }
87
+        // determine if the tag is a sub tag of the component and an id property
88
+        if ($this->componentStart !== null
89
+            && ($this->componentLevel + 2) === $this->praseLevel
90
+            && ($tag === 'UID' || $tag === 'TZID')
91
+        ) {
92
+            $this->componentIdProperty = true;
93
+        }
94
+    }
95 95
 
96
-	/**
97
-	 * Handles end of tag events from the parser for all tags
98
-	 */
99
-	private function tagEnd(XMLParser $parser, string $tag): void {
100
-		// if the end tag matched the component type or the component id property
101
-		// then add the component to the structure
102
-		if ($tag === 'UID' || $tag === 'TZID') {
103
-			$this->componentIdProperty = false;
104
-		} elseif ($this->componentType === $tag) {
105
-			$this->componentEnd = xml_get_current_byte_index($parser);
106
-			if ($this->componentId !== null) {
107
-				$this->structure[$this->componentType][$this->componentId][] = [
108
-					$this->componentType,
109
-					$this->componentId,
110
-					$this->componentStart,
111
-					$this->componentEnd,
112
-					implode('/', $this->prasePath)
113
-				];
114
-			} else {
115
-				$this->structure[$this->componentType][] = [
116
-					$this->componentType,
117
-					$this->componentId,
118
-					$this->componentStart,
119
-					$this->componentEnd,
120
-					implode('/', $this->prasePath)
121
-				];
122
-			}
123
-			$this->componentStart = null;
124
-			$this->componentEnd = null;
125
-			$this->componentId = null;
126
-			$this->componentType = null;
127
-			$this->componentIdProperty = false;
128
-		}
129
-		// remove the tag from the path tacker and depth the level
130
-		unset($this->prasePath[$this->praseLevel]);
131
-		$this->praseLevel--;
132
-	}
96
+    /**
97
+     * Handles end of tag events from the parser for all tags
98
+     */
99
+    private function tagEnd(XMLParser $parser, string $tag): void {
100
+        // if the end tag matched the component type or the component id property
101
+        // then add the component to the structure
102
+        if ($tag === 'UID' || $tag === 'TZID') {
103
+            $this->componentIdProperty = false;
104
+        } elseif ($this->componentType === $tag) {
105
+            $this->componentEnd = xml_get_current_byte_index($parser);
106
+            if ($this->componentId !== null) {
107
+                $this->structure[$this->componentType][$this->componentId][] = [
108
+                    $this->componentType,
109
+                    $this->componentId,
110
+                    $this->componentStart,
111
+                    $this->componentEnd,
112
+                    implode('/', $this->prasePath)
113
+                ];
114
+            } else {
115
+                $this->structure[$this->componentType][] = [
116
+                    $this->componentType,
117
+                    $this->componentId,
118
+                    $this->componentStart,
119
+                    $this->componentEnd,
120
+                    implode('/', $this->prasePath)
121
+                ];
122
+            }
123
+            $this->componentStart = null;
124
+            $this->componentEnd = null;
125
+            $this->componentId = null;
126
+            $this->componentType = null;
127
+            $this->componentIdProperty = false;
128
+        }
129
+        // remove the tag from the path tacker and depth the level
130
+        unset($this->prasePath[$this->praseLevel]);
131
+        $this->praseLevel--;
132
+    }
133 133
 
134
-	/**
135
-	 * Handles tag contents events from the parser for all tags
136
-	 */
137
-	private function tagContents(XMLParser $parser, string $data): void {
138
-		if ($this->componentIdProperty) {
139
-			$this->componentId = $data;
140
-		}
141
-	}
134
+    /**
135
+     * Handles tag contents events from the parser for all tags
136
+     */
137
+    private function tagContents(XMLParser $parser, string $data): void {
138
+        if ($this->componentIdProperty) {
139
+            $this->componentId = $data;
140
+        }
141
+    }
142 142
 
143
-	/**
144
-	 * Returns the analyzed structure of the source data
145
-	 * the analyzed structure is a collection of components organized by type,
146
-	 * each entry is a collection of instances
147
-	 * [
148
-	 *  'VEVENT' => [
149
-	 *    '7456f141-b478-4cb9-8efc-1427ba0d6839' => [
150
-	 *      ['VEVENT', '7456f141-b478-4cb9-8efc-1427ba0d6839', 0, 100 ],
151
-	 *      ['VEVENT', '7456f141-b478-4cb9-8efc-1427ba0d6839', 100, 200 ]
152
-	 *    ]
153
-	 *  ]
154
-	 * ]
155
-	 */
156
-	public function structure(): array {
157
-		if (!$this->analyzed) {
158
-			$this->analyze();
159
-		}
160
-		return $this->structure;
161
-	}
143
+    /**
144
+     * Returns the analyzed structure of the source data
145
+     * the analyzed structure is a collection of components organized by type,
146
+     * each entry is a collection of instances
147
+     * [
148
+     *  'VEVENT' => [
149
+     *    '7456f141-b478-4cb9-8efc-1427ba0d6839' => [
150
+     *      ['VEVENT', '7456f141-b478-4cb9-8efc-1427ba0d6839', 0, 100 ],
151
+     *      ['VEVENT', '7456f141-b478-4cb9-8efc-1427ba0d6839', 100, 200 ]
152
+     *    ]
153
+     *  ]
154
+     * ]
155
+     */
156
+    public function structure(): array {
157
+        if (!$this->analyzed) {
158
+            $this->analyze();
159
+        }
160
+        return $this->structure;
161
+    }
162 162
 
163
-	/**
164
-	 * Extracts a string chuck from the source data
165
-	 *
166
-	 * @param int $start starting byte position
167
-	 * @param int $end ending byte position
168
-	 */
169
-	public function extract(int $start, int $end): string {
170
-		fseek($this->source, $start);
171
-		return fread($this->source, $end - $start);
172
-	}
163
+    /**
164
+     * Extracts a string chuck from the source data
165
+     *
166
+     * @param int $start starting byte position
167
+     * @param int $end ending byte position
168
+     */
169
+    public function extract(int $start, int $end): string {
170
+        fseek($this->source, $start);
171
+        return fread($this->source, $end - $start);
172
+    }
173 173
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Import/ImportService.php 2 patches
Indentation   +296 added lines, -296 removed lines patch added patch discarded remove patch
@@ -23,312 +23,312 @@
 block discarded – undo
23 23
  */
24 24
 class ImportService {
25 25
 
26
-	/** @var resource */
27
-	private $source;
26
+    /** @var resource */
27
+    private $source;
28 28
 
29
-	public function __construct(
30
-		private CalDavBackend $backend,
31
-	) {
32
-	}
29
+    public function __construct(
30
+        private CalDavBackend $backend,
31
+    ) {
32
+    }
33 33
 
34
-	/**
35
-	 * Executes import with appropriate object generator based on format
36
-	 *
37
-	 * @param resource $source
38
-	 *
39
-	 * @return array<string,array<string,string|array<string>>>
40
-	 *
41
-	 * @throws \InvalidArgumentException
42
-	 */
43
-	public function import($source, CalendarImpl $calendar, CalendarImportOptions $options): array {
44
-		if (!is_resource($source)) {
45
-			throw new InvalidArgumentException('Invalid import source must be a file resource');
46
-		}
34
+    /**
35
+     * Executes import with appropriate object generator based on format
36
+     *
37
+     * @param resource $source
38
+     *
39
+     * @return array<string,array<string,string|array<string>>>
40
+     *
41
+     * @throws \InvalidArgumentException
42
+     */
43
+    public function import($source, CalendarImpl $calendar, CalendarImportOptions $options): array {
44
+        if (!is_resource($source)) {
45
+            throw new InvalidArgumentException('Invalid import source must be a file resource');
46
+        }
47 47
 
48
-		$this->source = $source;
48
+        $this->source = $source;
49 49
 
50
-		switch ($options->getFormat()) {
51
-			case 'ical':
52
-				return $this->importProcess($calendar, $options, $this->importText(...));
53
-				break;
54
-			case 'jcal':
55
-				return $this->importProcess($calendar, $options, $this->importJson(...));
56
-				break;
57
-			case 'xcal':
58
-				return $this->importProcess($calendar, $options, $this->importXml(...));
59
-				break;
60
-			default:
61
-				throw new InvalidArgumentException('Invalid import format');
62
-		}
63
-	}
50
+        switch ($options->getFormat()) {
51
+            case 'ical':
52
+                return $this->importProcess($calendar, $options, $this->importText(...));
53
+                break;
54
+            case 'jcal':
55
+                return $this->importProcess($calendar, $options, $this->importJson(...));
56
+                break;
57
+            case 'xcal':
58
+                return $this->importProcess($calendar, $options, $this->importXml(...));
59
+                break;
60
+            default:
61
+                throw new InvalidArgumentException('Invalid import format');
62
+        }
63
+    }
64 64
 
65
-	/**
66
-	 * Generates object stream from a text formatted source (ical)
67
-	 *
68
-	 * @return Generator<\Sabre\VObject\Component\VCalendar>
69
-	 */
70
-	private function importText(): Generator {
71
-		$importer = new TextImporter($this->source);
72
-		$structure = $importer->structure();
73
-		$sObjectPrefix = $importer::OBJECT_PREFIX;
74
-		$sObjectSuffix = $importer::OBJECT_SUFFIX;
75
-		// calendar properties
76
-		foreach ($structure['VCALENDAR'] as $entry) {
77
-			if (!str_ends_with($entry, "\n") || !str_ends_with($entry, "\r\n")) {
78
-				$sObjectPrefix .= PHP_EOL;
79
-			}
80
-		}
81
-		// calendar time zones
82
-		$timezones = [];
83
-		foreach ($structure['VTIMEZONE'] as $tid => $collection) {
84
-			$instance = $collection[0];
85
-			$sObjectContents = $importer->extract((int)$instance[2], (int)$instance[3]);
86
-			$vObject = Reader::read($sObjectPrefix . $sObjectContents . $sObjectSuffix);
87
-			$timezones[$tid] = clone $vObject->VTIMEZONE;
88
-		}
89
-		// calendar components
90
-		// for each component type, construct a full calendar object with all components
91
-		// that match the same UID and appropriate time zones that are used in the components
92
-		foreach (['VEVENT', 'VTODO', 'VJOURNAL'] as $type) {
93
-			foreach ($structure[$type] as $cid => $instances) {
94
-				/** @var array<int,VCalendar> $instances */
95
-				// extract all instances of component and unserialize to object
96
-				$sObjectContents = '';
97
-				foreach ($instances as $instance) {
98
-					$sObjectContents .= $importer->extract($instance[2], $instance[3]);
99
-				}
100
-				/** @var VCalendar $vObject */
101
-				$vObject = Reader::read($sObjectPrefix . $sObjectContents . $sObjectSuffix);
102
-				// add time zones to object
103
-				foreach ($this->findTimeZones($vObject) as $zone) {
104
-					if (isset($timezones[$zone])) {
105
-						$vObject->add(clone $timezones[$zone]);
106
-					}
107
-				}
108
-				yield $vObject;
109
-			}
110
-		}
111
-	}
65
+    /**
66
+     * Generates object stream from a text formatted source (ical)
67
+     *
68
+     * @return Generator<\Sabre\VObject\Component\VCalendar>
69
+     */
70
+    private function importText(): Generator {
71
+        $importer = new TextImporter($this->source);
72
+        $structure = $importer->structure();
73
+        $sObjectPrefix = $importer::OBJECT_PREFIX;
74
+        $sObjectSuffix = $importer::OBJECT_SUFFIX;
75
+        // calendar properties
76
+        foreach ($structure['VCALENDAR'] as $entry) {
77
+            if (!str_ends_with($entry, "\n") || !str_ends_with($entry, "\r\n")) {
78
+                $sObjectPrefix .= PHP_EOL;
79
+            }
80
+        }
81
+        // calendar time zones
82
+        $timezones = [];
83
+        foreach ($structure['VTIMEZONE'] as $tid => $collection) {
84
+            $instance = $collection[0];
85
+            $sObjectContents = $importer->extract((int)$instance[2], (int)$instance[3]);
86
+            $vObject = Reader::read($sObjectPrefix . $sObjectContents . $sObjectSuffix);
87
+            $timezones[$tid] = clone $vObject->VTIMEZONE;
88
+        }
89
+        // calendar components
90
+        // for each component type, construct a full calendar object with all components
91
+        // that match the same UID and appropriate time zones that are used in the components
92
+        foreach (['VEVENT', 'VTODO', 'VJOURNAL'] as $type) {
93
+            foreach ($structure[$type] as $cid => $instances) {
94
+                /** @var array<int,VCalendar> $instances */
95
+                // extract all instances of component and unserialize to object
96
+                $sObjectContents = '';
97
+                foreach ($instances as $instance) {
98
+                    $sObjectContents .= $importer->extract($instance[2], $instance[3]);
99
+                }
100
+                /** @var VCalendar $vObject */
101
+                $vObject = Reader::read($sObjectPrefix . $sObjectContents . $sObjectSuffix);
102
+                // add time zones to object
103
+                foreach ($this->findTimeZones($vObject) as $zone) {
104
+                    if (isset($timezones[$zone])) {
105
+                        $vObject->add(clone $timezones[$zone]);
106
+                    }
107
+                }
108
+                yield $vObject;
109
+            }
110
+        }
111
+    }
112 112
 
113
-	/**
114
-	 * Generates object stream from a xml formatted source (xcal)
115
-	 *
116
-	 * @return Generator<\Sabre\VObject\Component\VCalendar>
117
-	 */
118
-	private function importXml(): Generator {
119
-		$importer = new XmlImporter($this->source);
120
-		$structure = $importer->structure();
121
-		$sObjectPrefix = $importer::OBJECT_PREFIX;
122
-		$sObjectSuffix = $importer::OBJECT_SUFFIX;
123
-		// calendar time zones
124
-		$timezones = [];
125
-		foreach ($structure['VTIMEZONE'] as $tid => $collection) {
126
-			$instance = $collection[0];
127
-			$sObjectContents = $importer->extract((int)$instance[2], (int)$instance[3]);
128
-			$vObject = Reader::readXml($sObjectPrefix . $sObjectContents . $sObjectSuffix);
129
-			$timezones[$tid] = clone $vObject->VTIMEZONE;
130
-		}
131
-		// calendar components
132
-		// for each component type, construct a full calendar object with all components
133
-		// that match the same UID and appropriate time zones that are used in the components
134
-		foreach (['VEVENT', 'VTODO', 'VJOURNAL'] as $type) {
135
-			foreach ($structure[$type] as $cid => $instances) {
136
-				/** @var array<int,VCalendar> $instances */
137
-				// extract all instances of component and unserialize to object
138
-				$sObjectContents = '';
139
-				foreach ($instances as $instance) {
140
-					$sObjectContents .= $importer->extract($instance[2], $instance[3]);
141
-				}
142
-				/** @var VCalendar $vObject */
143
-				$vObject = Reader::readXml($sObjectPrefix . $sObjectContents . $sObjectSuffix);
144
-				// add time zones to object
145
-				foreach ($this->findTimeZones($vObject) as $zone) {
146
-					if (isset($timezones[$zone])) {
147
-						$vObject->add(clone $timezones[$zone]);
148
-					}
149
-				}
150
-				yield $vObject;
151
-			}
152
-		}
153
-	}
113
+    /**
114
+     * Generates object stream from a xml formatted source (xcal)
115
+     *
116
+     * @return Generator<\Sabre\VObject\Component\VCalendar>
117
+     */
118
+    private function importXml(): Generator {
119
+        $importer = new XmlImporter($this->source);
120
+        $structure = $importer->structure();
121
+        $sObjectPrefix = $importer::OBJECT_PREFIX;
122
+        $sObjectSuffix = $importer::OBJECT_SUFFIX;
123
+        // calendar time zones
124
+        $timezones = [];
125
+        foreach ($structure['VTIMEZONE'] as $tid => $collection) {
126
+            $instance = $collection[0];
127
+            $sObjectContents = $importer->extract((int)$instance[2], (int)$instance[3]);
128
+            $vObject = Reader::readXml($sObjectPrefix . $sObjectContents . $sObjectSuffix);
129
+            $timezones[$tid] = clone $vObject->VTIMEZONE;
130
+        }
131
+        // calendar components
132
+        // for each component type, construct a full calendar object with all components
133
+        // that match the same UID and appropriate time zones that are used in the components
134
+        foreach (['VEVENT', 'VTODO', 'VJOURNAL'] as $type) {
135
+            foreach ($structure[$type] as $cid => $instances) {
136
+                /** @var array<int,VCalendar> $instances */
137
+                // extract all instances of component and unserialize to object
138
+                $sObjectContents = '';
139
+                foreach ($instances as $instance) {
140
+                    $sObjectContents .= $importer->extract($instance[2], $instance[3]);
141
+                }
142
+                /** @var VCalendar $vObject */
143
+                $vObject = Reader::readXml($sObjectPrefix . $sObjectContents . $sObjectSuffix);
144
+                // add time zones to object
145
+                foreach ($this->findTimeZones($vObject) as $zone) {
146
+                    if (isset($timezones[$zone])) {
147
+                        $vObject->add(clone $timezones[$zone]);
148
+                    }
149
+                }
150
+                yield $vObject;
151
+            }
152
+        }
153
+    }
154 154
 
155
-	/**
156
-	 * Generates object stream from a json formatted source (jcal)
157
-	 *
158
-	 * @return Generator<\Sabre\VObject\Component\VCalendar>
159
-	 */
160
-	private function importJson(): Generator {
161
-		/** @var VCALENDAR $importer */
162
-		$importer = Reader::readJson($this->source);
163
-		// calendar time zones
164
-		$timezones = [];
165
-		foreach ($importer->VTIMEZONE as $timezone) {
166
-			$tzid = $timezone->TZID?->getValue();
167
-			if ($tzid !== null) {
168
-				$timezones[$tzid] = clone $timezone;
169
-			}
170
-		}
171
-		// calendar components
172
-		foreach ($importer->getBaseComponents() as $base) {
173
-			$vObject = new VCalendar;
174
-			$vObject->VERSION = clone $importer->VERSION;
175
-			$vObject->PRODID = clone $importer->PRODID;
176
-			// extract all instances of component
177
-			foreach ($importer->getByUID($base->UID->getValue()) as $instance) {
178
-				$vObject->add(clone $instance);
179
-			}
180
-			// add time zones to object
181
-			foreach ($this->findTimeZones($vObject) as $zone) {
182
-				if (isset($timezones[$zone])) {
183
-					$vObject->add(clone $timezones[$zone]);
184
-				}
185
-			}
186
-			yield $vObject;
187
-		}
188
-	}
155
+    /**
156
+     * Generates object stream from a json formatted source (jcal)
157
+     *
158
+     * @return Generator<\Sabre\VObject\Component\VCalendar>
159
+     */
160
+    private function importJson(): Generator {
161
+        /** @var VCALENDAR $importer */
162
+        $importer = Reader::readJson($this->source);
163
+        // calendar time zones
164
+        $timezones = [];
165
+        foreach ($importer->VTIMEZONE as $timezone) {
166
+            $tzid = $timezone->TZID?->getValue();
167
+            if ($tzid !== null) {
168
+                $timezones[$tzid] = clone $timezone;
169
+            }
170
+        }
171
+        // calendar components
172
+        foreach ($importer->getBaseComponents() as $base) {
173
+            $vObject = new VCalendar;
174
+            $vObject->VERSION = clone $importer->VERSION;
175
+            $vObject->PRODID = clone $importer->PRODID;
176
+            // extract all instances of component
177
+            foreach ($importer->getByUID($base->UID->getValue()) as $instance) {
178
+                $vObject->add(clone $instance);
179
+            }
180
+            // add time zones to object
181
+            foreach ($this->findTimeZones($vObject) as $zone) {
182
+                if (isset($timezones[$zone])) {
183
+                    $vObject->add(clone $timezones[$zone]);
184
+                }
185
+            }
186
+            yield $vObject;
187
+        }
188
+    }
189 189
 
190
-	/**
191
-	 * Searches through all component properties looking for defined timezones
192
-	 *
193
-	 * @return array<string>
194
-	 */
195
-	private function findTimeZones(VCalendar $vObject): array {
196
-		$timezones = [];
197
-		foreach ($vObject->getComponents() as $vComponent) {
198
-			if ($vComponent->name !== 'VTIMEZONE') {
199
-				foreach (['DTSTART', 'DTEND', 'DUE', 'RDATE', 'EXDATE'] as $property) {
200
-					if (isset($vComponent->$property?->parameters['TZID'])) {
201
-						$tid = $vComponent->$property->parameters['TZID']->getValue();
202
-						$timezones[$tid] = true;
203
-					}
204
-				}
205
-			}
206
-		}
207
-		return array_keys($timezones);
208
-	}
190
+    /**
191
+     * Searches through all component properties looking for defined timezones
192
+     *
193
+     * @return array<string>
194
+     */
195
+    private function findTimeZones(VCalendar $vObject): array {
196
+        $timezones = [];
197
+        foreach ($vObject->getComponents() as $vComponent) {
198
+            if ($vComponent->name !== 'VTIMEZONE') {
199
+                foreach (['DTSTART', 'DTEND', 'DUE', 'RDATE', 'EXDATE'] as $property) {
200
+                    if (isset($vComponent->$property?->parameters['TZID'])) {
201
+                        $tid = $vComponent->$property->parameters['TZID']->getValue();
202
+                        $timezones[$tid] = true;
203
+                    }
204
+                }
205
+            }
206
+        }
207
+        return array_keys($timezones);
208
+    }
209 209
 
210
-	/**
211
-	 * Import objects
212
-	 *
213
-	 * @since 32.0.0
214
-	 *
215
-	 * @param CalendarImportOptions $options
216
-	 * @param callable $generator<CalendarImportOptions>: Generator<\Sabre\VObject\Component\VCalendar>
217
-	 *
218
-	 * @return array<string,array<string,string|array<string>>>
219
-	 */
220
-	public function importProcess(CalendarImpl $calendar, CalendarImportOptions $options, callable $generator): array {
221
-		$calendarId = $calendar->getKey();
222
-		$calendarUri = $calendar->getUri();
223
-		$principalUri = $calendar->getPrincipalUri();
224
-		$outcome = [];
225
-		foreach ($generator() as $vObject) {
226
-			$components = $vObject->getBaseComponents();
227
-			// determine if the object has no base component types
228
-			if (count($components) === 0) {
229
-				$errorMessage = 'One or more objects discovered with no base component types';
230
-				if ($options->getErrors() === $options::ERROR_FAIL) {
231
-					throw new InvalidArgumentException('Error importing calendar data: ' . $errorMessage);
232
-				}
233
-				$outcome['nbct'] = ['outcome' => 'error', 'errors' => [$errorMessage]];
234
-				continue;
235
-			}
236
-			// determine if the object has more than one base component type
237
-			// object can have multiple base components with the same uid
238
-			// but we need to make sure they are of the same type
239
-			if (count($components) > 1) {
240
-				$type = $components[0]->name;
241
-				foreach ($components as $entry) {
242
-					if ($type !== $entry->name) {
243
-						$errorMessage = 'One or more objects discovered with multiple base component types';
244
-						if ($options->getErrors() === $options::ERROR_FAIL) {
245
-							throw new InvalidArgumentException('Error importing calendar data: ' . $errorMessage);
246
-						}
247
-						$outcome['mbct'] = ['outcome' => 'error', 'errors' => [$errorMessage]];
248
-						continue 2;
249
-					}
250
-				}
251
-			}
252
-			// determine if the object has a uid
253
-			if (!isset($components[0]->UID)) {
254
-				$errorMessage = 'One or more objects discovered without a UID';
255
-				if ($options->getErrors() === $options::ERROR_FAIL) {
256
-					throw new InvalidArgumentException('Error importing calendar data: ' . $errorMessage);
257
-				}
258
-				$outcome['noid'] = ['outcome' => 'error', 'errors' => [$errorMessage]];
259
-				continue;
260
-			}
261
-			$uid = $components[0]->UID->getValue();
262
-			// validate object
263
-			if ($options->getValidate() !== $options::VALIDATE_NONE) {
264
-				$issues = $this->componentValidate($vObject, true, 3);
265
-				if ($options->getValidate() === $options::VALIDATE_SKIP && $issues !== []) {
266
-					$outcome[$uid] = ['outcome' => 'error', 'errors' => $issues];
267
-					continue;
268
-				} elseif ($options->getValidate() === $options::VALIDATE_FAIL && $issues !== []) {
269
-					throw new InvalidArgumentException('Error importing calendar data: UID <' . $uid . '> - ' . $issues[0]);
270
-				}
271
-			}
272
-			// create or update object in the data store
273
-			$objectId = $this->backend->getCalendarObjectByUID($principalUri, $uid, $calendarUri);
274
-			$objectData = $vObject->serialize();
275
-			try {
276
-				if ($objectId === null) {
277
-					$objectId = UUIDUtil::getUUID();
278
-					$this->backend->createCalendarObject(
279
-						$calendarId,
280
-						$objectId,
281
-						$objectData
282
-					);
283
-					$outcome[$uid] = ['outcome' => 'created'];
284
-				} else {
285
-					[$cid, $oid] = explode('/', $objectId);
286
-					if ($options->getSupersede()) {
287
-						$this->backend->updateCalendarObject(
288
-							$calendarId,
289
-							$oid,
290
-							$objectData
291
-						);
292
-						$outcome[$uid] = ['outcome' => 'updated'];
293
-					} else {
294
-						$outcome[$uid] = ['outcome' => 'exists'];
295
-					}
296
-				}
297
-			} catch (Exception $e) {
298
-				$errorMessage = $e->getMessage();
299
-				if ($options->getErrors() === $options::ERROR_FAIL) {
300
-					throw new Exception('Error importing calendar data: UID <' . $uid . '> - ' . $errorMessage, 0, $e);
301
-				}
302
-				$outcome[$uid] = ['outcome' => 'error', 'errors' => [$errorMessage]];
303
-			}
304
-		}
210
+    /**
211
+     * Import objects
212
+     *
213
+     * @since 32.0.0
214
+     *
215
+     * @param CalendarImportOptions $options
216
+     * @param callable $generator<CalendarImportOptions>: Generator<\Sabre\VObject\Component\VCalendar>
217
+     *
218
+     * @return array<string,array<string,string|array<string>>>
219
+     */
220
+    public function importProcess(CalendarImpl $calendar, CalendarImportOptions $options, callable $generator): array {
221
+        $calendarId = $calendar->getKey();
222
+        $calendarUri = $calendar->getUri();
223
+        $principalUri = $calendar->getPrincipalUri();
224
+        $outcome = [];
225
+        foreach ($generator() as $vObject) {
226
+            $components = $vObject->getBaseComponents();
227
+            // determine if the object has no base component types
228
+            if (count($components) === 0) {
229
+                $errorMessage = 'One or more objects discovered with no base component types';
230
+                if ($options->getErrors() === $options::ERROR_FAIL) {
231
+                    throw new InvalidArgumentException('Error importing calendar data: ' . $errorMessage);
232
+                }
233
+                $outcome['nbct'] = ['outcome' => 'error', 'errors' => [$errorMessage]];
234
+                continue;
235
+            }
236
+            // determine if the object has more than one base component type
237
+            // object can have multiple base components with the same uid
238
+            // but we need to make sure they are of the same type
239
+            if (count($components) > 1) {
240
+                $type = $components[0]->name;
241
+                foreach ($components as $entry) {
242
+                    if ($type !== $entry->name) {
243
+                        $errorMessage = 'One or more objects discovered with multiple base component types';
244
+                        if ($options->getErrors() === $options::ERROR_FAIL) {
245
+                            throw new InvalidArgumentException('Error importing calendar data: ' . $errorMessage);
246
+                        }
247
+                        $outcome['mbct'] = ['outcome' => 'error', 'errors' => [$errorMessage]];
248
+                        continue 2;
249
+                    }
250
+                }
251
+            }
252
+            // determine if the object has a uid
253
+            if (!isset($components[0]->UID)) {
254
+                $errorMessage = 'One or more objects discovered without a UID';
255
+                if ($options->getErrors() === $options::ERROR_FAIL) {
256
+                    throw new InvalidArgumentException('Error importing calendar data: ' . $errorMessage);
257
+                }
258
+                $outcome['noid'] = ['outcome' => 'error', 'errors' => [$errorMessage]];
259
+                continue;
260
+            }
261
+            $uid = $components[0]->UID->getValue();
262
+            // validate object
263
+            if ($options->getValidate() !== $options::VALIDATE_NONE) {
264
+                $issues = $this->componentValidate($vObject, true, 3);
265
+                if ($options->getValidate() === $options::VALIDATE_SKIP && $issues !== []) {
266
+                    $outcome[$uid] = ['outcome' => 'error', 'errors' => $issues];
267
+                    continue;
268
+                } elseif ($options->getValidate() === $options::VALIDATE_FAIL && $issues !== []) {
269
+                    throw new InvalidArgumentException('Error importing calendar data: UID <' . $uid . '> - ' . $issues[0]);
270
+                }
271
+            }
272
+            // create or update object in the data store
273
+            $objectId = $this->backend->getCalendarObjectByUID($principalUri, $uid, $calendarUri);
274
+            $objectData = $vObject->serialize();
275
+            try {
276
+                if ($objectId === null) {
277
+                    $objectId = UUIDUtil::getUUID();
278
+                    $this->backend->createCalendarObject(
279
+                        $calendarId,
280
+                        $objectId,
281
+                        $objectData
282
+                    );
283
+                    $outcome[$uid] = ['outcome' => 'created'];
284
+                } else {
285
+                    [$cid, $oid] = explode('/', $objectId);
286
+                    if ($options->getSupersede()) {
287
+                        $this->backend->updateCalendarObject(
288
+                            $calendarId,
289
+                            $oid,
290
+                            $objectData
291
+                        );
292
+                        $outcome[$uid] = ['outcome' => 'updated'];
293
+                    } else {
294
+                        $outcome[$uid] = ['outcome' => 'exists'];
295
+                    }
296
+                }
297
+            } catch (Exception $e) {
298
+                $errorMessage = $e->getMessage();
299
+                if ($options->getErrors() === $options::ERROR_FAIL) {
300
+                    throw new Exception('Error importing calendar data: UID <' . $uid . '> - ' . $errorMessage, 0, $e);
301
+                }
302
+                $outcome[$uid] = ['outcome' => 'error', 'errors' => [$errorMessage]];
303
+            }
304
+        }
305 305
 
306
-		return $outcome;
307
-	}
306
+        return $outcome;
307
+    }
308 308
 
309
-	/**
310
-	 * Validate a component
311
-	 *
312
-	 * @param VCalendar $vObject
313
-	 * @param bool $repair attempt to repair the component
314
-	 * @param int $level minimum level of issues to return
315
-	 * @return list<mixed>
316
-	 */
317
-	private function componentValidate(VCalendar $vObject, bool $repair, int $level): array {
318
-		// validate component(S)
319
-		$issues = $vObject->validate(Node::PROFILE_CALDAV);
320
-		// attempt to repair
321
-		if ($repair && count($issues) > 0) {
322
-			$issues = $vObject->validate(Node::REPAIR);
323
-		}
324
-		// filter out messages based on level
325
-		$result = [];
326
-		foreach ($issues as $key => $issue) {
327
-			if (isset($issue['level']) && $issue['level'] >= $level) {
328
-				$result[] = $issue['message'];
329
-			}
330
-		}
309
+    /**
310
+     * Validate a component
311
+     *
312
+     * @param VCalendar $vObject
313
+     * @param bool $repair attempt to repair the component
314
+     * @param int $level minimum level of issues to return
315
+     * @return list<mixed>
316
+     */
317
+    private function componentValidate(VCalendar $vObject, bool $repair, int $level): array {
318
+        // validate component(S)
319
+        $issues = $vObject->validate(Node::PROFILE_CALDAV);
320
+        // attempt to repair
321
+        if ($repair && count($issues) > 0) {
322
+            $issues = $vObject->validate(Node::REPAIR);
323
+        }
324
+        // filter out messages based on level
325
+        $result = [];
326
+        foreach ($issues as $key => $issue) {
327
+            if (isset($issue['level']) && $issue['level'] >= $level) {
328
+                $result[] = $issue['message'];
329
+            }
330
+        }
331 331
 
332
-		return $result;
333
-	}
332
+        return $result;
333
+    }
334 334
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 		$timezones = [];
83 83
 		foreach ($structure['VTIMEZONE'] as $tid => $collection) {
84 84
 			$instance = $collection[0];
85
-			$sObjectContents = $importer->extract((int)$instance[2], (int)$instance[3]);
86
-			$vObject = Reader::read($sObjectPrefix . $sObjectContents . $sObjectSuffix);
85
+			$sObjectContents = $importer->extract((int) $instance[2], (int) $instance[3]);
86
+			$vObject = Reader::read($sObjectPrefix.$sObjectContents.$sObjectSuffix);
87 87
 			$timezones[$tid] = clone $vObject->VTIMEZONE;
88 88
 		}
89 89
 		// calendar components
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 					$sObjectContents .= $importer->extract($instance[2], $instance[3]);
99 99
 				}
100 100
 				/** @var VCalendar $vObject */
101
-				$vObject = Reader::read($sObjectPrefix . $sObjectContents . $sObjectSuffix);
101
+				$vObject = Reader::read($sObjectPrefix.$sObjectContents.$sObjectSuffix);
102 102
 				// add time zones to object
103 103
 				foreach ($this->findTimeZones($vObject) as $zone) {
104 104
 					if (isset($timezones[$zone])) {
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 		$timezones = [];
125 125
 		foreach ($structure['VTIMEZONE'] as $tid => $collection) {
126 126
 			$instance = $collection[0];
127
-			$sObjectContents = $importer->extract((int)$instance[2], (int)$instance[3]);
128
-			$vObject = Reader::readXml($sObjectPrefix . $sObjectContents . $sObjectSuffix);
127
+			$sObjectContents = $importer->extract((int) $instance[2], (int) $instance[3]);
128
+			$vObject = Reader::readXml($sObjectPrefix.$sObjectContents.$sObjectSuffix);
129 129
 			$timezones[$tid] = clone $vObject->VTIMEZONE;
130 130
 		}
131 131
 		// calendar components
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 					$sObjectContents .= $importer->extract($instance[2], $instance[3]);
141 141
 				}
142 142
 				/** @var VCalendar $vObject */
143
-				$vObject = Reader::readXml($sObjectPrefix . $sObjectContents . $sObjectSuffix);
143
+				$vObject = Reader::readXml($sObjectPrefix.$sObjectContents.$sObjectSuffix);
144 144
 				// add time zones to object
145 145
 				foreach ($this->findTimeZones($vObject) as $zone) {
146 146
 					if (isset($timezones[$zone])) {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			if (count($components) === 0) {
229 229
 				$errorMessage = 'One or more objects discovered with no base component types';
230 230
 				if ($options->getErrors() === $options::ERROR_FAIL) {
231
-					throw new InvalidArgumentException('Error importing calendar data: ' . $errorMessage);
231
+					throw new InvalidArgumentException('Error importing calendar data: '.$errorMessage);
232 232
 				}
233 233
 				$outcome['nbct'] = ['outcome' => 'error', 'errors' => [$errorMessage]];
234 234
 				continue;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 					if ($type !== $entry->name) {
243 243
 						$errorMessage = 'One or more objects discovered with multiple base component types';
244 244
 						if ($options->getErrors() === $options::ERROR_FAIL) {
245
-							throw new InvalidArgumentException('Error importing calendar data: ' . $errorMessage);
245
+							throw new InvalidArgumentException('Error importing calendar data: '.$errorMessage);
246 246
 						}
247 247
 						$outcome['mbct'] = ['outcome' => 'error', 'errors' => [$errorMessage]];
248 248
 						continue 2;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 			if (!isset($components[0]->UID)) {
254 254
 				$errorMessage = 'One or more objects discovered without a UID';
255 255
 				if ($options->getErrors() === $options::ERROR_FAIL) {
256
-					throw new InvalidArgumentException('Error importing calendar data: ' . $errorMessage);
256
+					throw new InvalidArgumentException('Error importing calendar data: '.$errorMessage);
257 257
 				}
258 258
 				$outcome['noid'] = ['outcome' => 'error', 'errors' => [$errorMessage]];
259 259
 				continue;
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 					$outcome[$uid] = ['outcome' => 'error', 'errors' => $issues];
267 267
 					continue;
268 268
 				} elseif ($options->getValidate() === $options::VALIDATE_FAIL && $issues !== []) {
269
-					throw new InvalidArgumentException('Error importing calendar data: UID <' . $uid . '> - ' . $issues[0]);
269
+					throw new InvalidArgumentException('Error importing calendar data: UID <'.$uid.'> - '.$issues[0]);
270 270
 				}
271 271
 			}
272 272
 			// create or update object in the data store
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			} catch (Exception $e) {
298 298
 				$errorMessage = $e->getMessage();
299 299
 				if ($options->getErrors() === $options::ERROR_FAIL) {
300
-					throw new Exception('Error importing calendar data: UID <' . $uid . '> - ' . $errorMessage, 0, $e);
300
+					throw new Exception('Error importing calendar data: UID <'.$uid.'> - '.$errorMessage, 0, $e);
301 301
 				}
302 302
 				$outcome[$uid] = ['outcome' => 'error', 'errors' => [$errorMessage]];
303 303
 			}
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/CalendarImpl.php 1 patch
Indentation   +265 added lines, -265 removed lines patch added patch discarded remove patch
@@ -32,270 +32,270 @@
 block discarded – undo
32 32
 use function Sabre\Uri\split as uriSplit;
33 33
 
34 34
 class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIsWritable, ICalendarIsShared, ICalendarExport, ICalendarIsEnabled {
35
-	public function __construct(
36
-		private Calendar $calendar,
37
-		/** @var array<string, mixed> */
38
-		private array $calendarInfo,
39
-		private CalDavBackend $backend,
40
-	) {
41
-	}
42
-
43
-	/**
44
-	 * @return string defining the technical unique key
45
-	 * @since 13.0.0
46
-	 */
47
-	public function getKey(): string {
48
-		return (string)$this->calendarInfo['id'];
49
-	}
50
-
51
-	/**
52
-	 * {@inheritDoc}
53
-	 */
54
-	public function getUri(): string {
55
-		return $this->calendarInfo['uri'];
56
-	}
57
-
58
-	/**
59
-	 * @return string the principal URI of the calendar owner
60
-	 * @since 32.0.0
61
-	 */
62
-	public function getPrincipalUri(): string {
63
-		return $this->calendarInfo['principaluri'];
64
-	}
65
-
66
-	/**
67
-	 * In comparison to getKey() this function returns a human readable (maybe translated) name
68
-	 * @since 13.0.0
69
-	 */
70
-	public function getDisplayName(): ?string {
71
-		return $this->calendarInfo['{DAV:}displayname'];
72
-	}
73
-
74
-	/**
75
-	 * Calendar color
76
-	 * @since 13.0.0
77
-	 */
78
-	public function getDisplayColor(): ?string {
79
-		return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'];
80
-	}
81
-
82
-	public function getSchedulingTransparency(): ?ScheduleCalendarTransp {
83
-		return $this->calendarInfo['{' . \OCA\DAV\CalDAV\Schedule\Plugin::NS_CALDAV . '}schedule-calendar-transp'];
84
-	}
85
-
86
-	public function getSchedulingTimezone(): ?VTimeZone {
87
-		$tzProp = '{' . \OCA\DAV\CalDAV\Schedule\Plugin::NS_CALDAV . '}calendar-timezone';
88
-		if (!isset($this->calendarInfo[$tzProp])) {
89
-			return null;
90
-		}
91
-		// This property contains a VCALENDAR with a single VTIMEZONE
92
-		/** @var string $timezoneProp */
93
-		$timezoneProp = $this->calendarInfo[$tzProp];
94
-		/** @var VCalendar $vobj */
95
-		$vobj = Reader::read($timezoneProp);
96
-		$components = $vobj->getComponents();
97
-		if (empty($components)) {
98
-			return null;
99
-		}
100
-		/** @var VTimeZone $vtimezone */
101
-		$vtimezone = $components[0];
102
-		return $vtimezone;
103
-	}
104
-
105
-	public function search(string $pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null): array {
106
-		return $this->backend->search($this->calendarInfo, $pattern,
107
-			$searchProperties, $options, $limit, $offset);
108
-	}
109
-
110
-	/**
111
-	 * @return int build up using \OCP\Constants
112
-	 * @since 13.0.0
113
-	 */
114
-	public function getPermissions(): int {
115
-		$permissions = $this->calendar->getACL();
116
-		$result = 0;
117
-		foreach ($permissions as $permission) {
118
-			if ($this->calendarInfo['principaluri'] !== $permission['principal']) {
119
-				continue;
120
-			}
121
-
122
-			switch ($permission['privilege']) {
123
-				case '{DAV:}read':
124
-					$result |= Constants::PERMISSION_READ;
125
-					break;
126
-				case '{DAV:}write':
127
-					$result |= Constants::PERMISSION_CREATE;
128
-					$result |= Constants::PERMISSION_UPDATE;
129
-					break;
130
-				case '{DAV:}all':
131
-					$result |= Constants::PERMISSION_ALL;
132
-					break;
133
-			}
134
-		}
135
-
136
-		return $result;
137
-	}
138
-
139
-	/**
140
-	 * @since 32.0.0
141
-	 */
142
-	public function isEnabled(): bool {
143
-		return $this->calendarInfo['{http://owncloud.org/ns}calendar-enabled'] ?? true;
144
-	}
145
-
146
-	/**
147
-	 * @since 31.0.0
148
-	 */
149
-	public function isWritable(): bool {
150
-		return $this->calendar->canWrite();
151
-	}
152
-
153
-	/**
154
-	 * @since 26.0.0
155
-	 */
156
-	public function isDeleted(): bool {
157
-		return $this->calendar->isDeleted();
158
-	}
159
-
160
-	/**
161
-	 * @since 31.0.0
162
-	 */
163
-	public function isShared(): bool {
164
-		return $this->calendar->isShared();
165
-	}
166
-
167
-	/**
168
-	 * @throws CalendarException
169
-	 */
170
-	private function createFromStringInServer(
171
-		string $name,
172
-		string $calendarData,
173
-		\OCA\DAV\Connector\Sabre\Server $server,
174
-	): void {
175
-		/** @var CustomPrincipalPlugin $plugin */
176
-		$plugin = $server->getPlugin('auth');
177
-		// we're working around the previous implementation
178
-		// that only allowed the public system principal to be used
179
-		// so set the custom principal here
180
-		$plugin->setCurrentPrincipal($this->calendar->getPrincipalURI());
181
-
182
-		if (empty($this->calendarInfo['uri'])) {
183
-			throw new CalendarException('Could not write to calendar as URI parameter is missing');
184
-		}
185
-
186
-		// Build full calendar path
187
-		[, $user] = uriSplit($this->calendar->getPrincipalURI());
188
-		$fullCalendarFilename = sprintf('calendars/%s/%s/%s', $user, $this->calendarInfo['uri'], $name);
189
-
190
-		// Force calendar change URI
191
-		/** @var Schedule\Plugin $schedulingPlugin */
192
-		$schedulingPlugin = $server->getPlugin('caldav-schedule');
193
-		$schedulingPlugin->setPathOfCalendarObjectChange($fullCalendarFilename);
194
-
195
-		$stream = fopen('php://memory', 'rb+');
196
-		fwrite($stream, $calendarData);
197
-		rewind($stream);
198
-		try {
199
-			$server->createFile($fullCalendarFilename, $stream);
200
-		} catch (Conflict $e) {
201
-			throw new CalendarException('Could not create new calendar event: ' . $e->getMessage(), 0, $e);
202
-		} finally {
203
-			fclose($stream);
204
-		}
205
-	}
206
-
207
-	public function createFromString(string $name, string $calendarData): void {
208
-		$server = new EmbeddedCalDavServer(false);
209
-		$this->createFromStringInServer($name, $calendarData, $server->getServer());
210
-	}
211
-
212
-	public function createFromStringMinimal(string $name, string $calendarData): void {
213
-		$server = new InvitationResponseServer(false);
214
-		$this->createFromStringInServer($name, $calendarData, $server->getServer());
215
-	}
216
-
217
-	/**
218
-	 * @throws CalendarException
219
-	 */
220
-	public function handleIMipMessage(string $name, string $calendarData): void {
221
-		$server = $this->getInvitationResponseServer();
222
-
223
-		/** @var CustomPrincipalPlugin $plugin */
224
-		$plugin = $server->getServer()->getPlugin('auth');
225
-		// we're working around the previous implementation
226
-		// that only allowed the public system principal to be used
227
-		// so set the custom principal here
228
-		$plugin->setCurrentPrincipal($this->calendar->getPrincipalURI());
229
-
230
-		if (empty($this->calendarInfo['uri'])) {
231
-			throw new CalendarException('Could not write to calendar as URI parameter is missing');
232
-		}
233
-		// Force calendar change URI
234
-		/** @var Schedule\Plugin $schedulingPlugin */
235
-		$schedulingPlugin = $server->getServer()->getPlugin('caldav-schedule');
236
-		// Let sabre handle the rest
237
-		$iTipMessage = new Message();
238
-		/** @var VCalendar $vObject */
239
-		$vObject = Reader::read($calendarData);
240
-		/** @var VEvent $vEvent */
241
-		$vEvent = $vObject->{'VEVENT'};
242
-
243
-		if ($vObject->{'METHOD'} === null) {
244
-			throw new CalendarException('No Method provided for scheduling data. Could not process message');
245
-		}
246
-
247
-		if (!isset($vEvent->{'ORGANIZER'}) || !isset($vEvent->{'ATTENDEE'})) {
248
-			throw new CalendarException('Could not process scheduling data, neccessary data missing from ICAL');
249
-		}
250
-		$organizer = $vEvent->{'ORGANIZER'}->getValue();
251
-		$attendee = $vEvent->{'ATTENDEE'}->getValue();
252
-
253
-		$iTipMessage->method = $vObject->{'METHOD'}->getValue();
254
-		if ($iTipMessage->method === 'REQUEST') {
255
-			$iTipMessage->sender = $organizer;
256
-			$iTipMessage->recipient = $attendee;
257
-		} elseif ($iTipMessage->method === 'REPLY') {
258
-			if ($server->isExternalAttendee($vEvent->{'ATTENDEE'}->getValue())) {
259
-				$iTipMessage->recipient = $organizer;
260
-			} else {
261
-				$iTipMessage->recipient = $attendee;
262
-			}
263
-			$iTipMessage->sender = $attendee;
264
-		} elseif ($iTipMessage->method === 'CANCEL') {
265
-			$iTipMessage->recipient = $attendee;
266
-			$iTipMessage->sender = $organizer;
267
-		}
268
-		$iTipMessage->uid = isset($vEvent->{'UID'}) ? $vEvent->{'UID'}->getValue() : '';
269
-		$iTipMessage->component = 'VEVENT';
270
-		$iTipMessage->sequence = isset($vEvent->{'SEQUENCE'}) ? (int)$vEvent->{'SEQUENCE'}->getValue() : 0;
271
-		$iTipMessage->message = $vObject;
272
-		$server->server->emit('schedule', [$iTipMessage]);
273
-	}
274
-
275
-	public function getInvitationResponseServer(): InvitationResponseServer {
276
-		return new InvitationResponseServer(false);
277
-	}
278
-
279
-	/**
280
-	 * Export objects
281
-	 *
282
-	 * @since 32.0.0
283
-	 *
284
-	 * @return Generator<mixed, \Sabre\VObject\Component\VCalendar, mixed, mixed>
285
-	 */
286
-	public function export(?CalendarExportOptions $options = null): Generator {
287
-		foreach (
288
-			$this->backend->exportCalendar(
289
-				$this->calendarInfo['id'],
290
-				$this->backend::CALENDAR_TYPE_CALENDAR,
291
-				$options
292
-			) as $event
293
-		) {
294
-			$vObject = Reader::read($event['calendardata']);
295
-			if ($vObject instanceof VCalendar) {
296
-				yield $vObject;
297
-			}
298
-		}
299
-	}
35
+    public function __construct(
36
+        private Calendar $calendar,
37
+        /** @var array<string, mixed> */
38
+        private array $calendarInfo,
39
+        private CalDavBackend $backend,
40
+    ) {
41
+    }
42
+
43
+    /**
44
+     * @return string defining the technical unique key
45
+     * @since 13.0.0
46
+     */
47
+    public function getKey(): string {
48
+        return (string)$this->calendarInfo['id'];
49
+    }
50
+
51
+    /**
52
+     * {@inheritDoc}
53
+     */
54
+    public function getUri(): string {
55
+        return $this->calendarInfo['uri'];
56
+    }
57
+
58
+    /**
59
+     * @return string the principal URI of the calendar owner
60
+     * @since 32.0.0
61
+     */
62
+    public function getPrincipalUri(): string {
63
+        return $this->calendarInfo['principaluri'];
64
+    }
65
+
66
+    /**
67
+     * In comparison to getKey() this function returns a human readable (maybe translated) name
68
+     * @since 13.0.0
69
+     */
70
+    public function getDisplayName(): ?string {
71
+        return $this->calendarInfo['{DAV:}displayname'];
72
+    }
73
+
74
+    /**
75
+     * Calendar color
76
+     * @since 13.0.0
77
+     */
78
+    public function getDisplayColor(): ?string {
79
+        return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'];
80
+    }
81
+
82
+    public function getSchedulingTransparency(): ?ScheduleCalendarTransp {
83
+        return $this->calendarInfo['{' . \OCA\DAV\CalDAV\Schedule\Plugin::NS_CALDAV . '}schedule-calendar-transp'];
84
+    }
85
+
86
+    public function getSchedulingTimezone(): ?VTimeZone {
87
+        $tzProp = '{' . \OCA\DAV\CalDAV\Schedule\Plugin::NS_CALDAV . '}calendar-timezone';
88
+        if (!isset($this->calendarInfo[$tzProp])) {
89
+            return null;
90
+        }
91
+        // This property contains a VCALENDAR with a single VTIMEZONE
92
+        /** @var string $timezoneProp */
93
+        $timezoneProp = $this->calendarInfo[$tzProp];
94
+        /** @var VCalendar $vobj */
95
+        $vobj = Reader::read($timezoneProp);
96
+        $components = $vobj->getComponents();
97
+        if (empty($components)) {
98
+            return null;
99
+        }
100
+        /** @var VTimeZone $vtimezone */
101
+        $vtimezone = $components[0];
102
+        return $vtimezone;
103
+    }
104
+
105
+    public function search(string $pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null): array {
106
+        return $this->backend->search($this->calendarInfo, $pattern,
107
+            $searchProperties, $options, $limit, $offset);
108
+    }
109
+
110
+    /**
111
+     * @return int build up using \OCP\Constants
112
+     * @since 13.0.0
113
+     */
114
+    public function getPermissions(): int {
115
+        $permissions = $this->calendar->getACL();
116
+        $result = 0;
117
+        foreach ($permissions as $permission) {
118
+            if ($this->calendarInfo['principaluri'] !== $permission['principal']) {
119
+                continue;
120
+            }
121
+
122
+            switch ($permission['privilege']) {
123
+                case '{DAV:}read':
124
+                    $result |= Constants::PERMISSION_READ;
125
+                    break;
126
+                case '{DAV:}write':
127
+                    $result |= Constants::PERMISSION_CREATE;
128
+                    $result |= Constants::PERMISSION_UPDATE;
129
+                    break;
130
+                case '{DAV:}all':
131
+                    $result |= Constants::PERMISSION_ALL;
132
+                    break;
133
+            }
134
+        }
135
+
136
+        return $result;
137
+    }
138
+
139
+    /**
140
+     * @since 32.0.0
141
+     */
142
+    public function isEnabled(): bool {
143
+        return $this->calendarInfo['{http://owncloud.org/ns}calendar-enabled'] ?? true;
144
+    }
145
+
146
+    /**
147
+     * @since 31.0.0
148
+     */
149
+    public function isWritable(): bool {
150
+        return $this->calendar->canWrite();
151
+    }
152
+
153
+    /**
154
+     * @since 26.0.0
155
+     */
156
+    public function isDeleted(): bool {
157
+        return $this->calendar->isDeleted();
158
+    }
159
+
160
+    /**
161
+     * @since 31.0.0
162
+     */
163
+    public function isShared(): bool {
164
+        return $this->calendar->isShared();
165
+    }
166
+
167
+    /**
168
+     * @throws CalendarException
169
+     */
170
+    private function createFromStringInServer(
171
+        string $name,
172
+        string $calendarData,
173
+        \OCA\DAV\Connector\Sabre\Server $server,
174
+    ): void {
175
+        /** @var CustomPrincipalPlugin $plugin */
176
+        $plugin = $server->getPlugin('auth');
177
+        // we're working around the previous implementation
178
+        // that only allowed the public system principal to be used
179
+        // so set the custom principal here
180
+        $plugin->setCurrentPrincipal($this->calendar->getPrincipalURI());
181
+
182
+        if (empty($this->calendarInfo['uri'])) {
183
+            throw new CalendarException('Could not write to calendar as URI parameter is missing');
184
+        }
185
+
186
+        // Build full calendar path
187
+        [, $user] = uriSplit($this->calendar->getPrincipalURI());
188
+        $fullCalendarFilename = sprintf('calendars/%s/%s/%s', $user, $this->calendarInfo['uri'], $name);
189
+
190
+        // Force calendar change URI
191
+        /** @var Schedule\Plugin $schedulingPlugin */
192
+        $schedulingPlugin = $server->getPlugin('caldav-schedule');
193
+        $schedulingPlugin->setPathOfCalendarObjectChange($fullCalendarFilename);
194
+
195
+        $stream = fopen('php://memory', 'rb+');
196
+        fwrite($stream, $calendarData);
197
+        rewind($stream);
198
+        try {
199
+            $server->createFile($fullCalendarFilename, $stream);
200
+        } catch (Conflict $e) {
201
+            throw new CalendarException('Could not create new calendar event: ' . $e->getMessage(), 0, $e);
202
+        } finally {
203
+            fclose($stream);
204
+        }
205
+    }
206
+
207
+    public function createFromString(string $name, string $calendarData): void {
208
+        $server = new EmbeddedCalDavServer(false);
209
+        $this->createFromStringInServer($name, $calendarData, $server->getServer());
210
+    }
211
+
212
+    public function createFromStringMinimal(string $name, string $calendarData): void {
213
+        $server = new InvitationResponseServer(false);
214
+        $this->createFromStringInServer($name, $calendarData, $server->getServer());
215
+    }
216
+
217
+    /**
218
+     * @throws CalendarException
219
+     */
220
+    public function handleIMipMessage(string $name, string $calendarData): void {
221
+        $server = $this->getInvitationResponseServer();
222
+
223
+        /** @var CustomPrincipalPlugin $plugin */
224
+        $plugin = $server->getServer()->getPlugin('auth');
225
+        // we're working around the previous implementation
226
+        // that only allowed the public system principal to be used
227
+        // so set the custom principal here
228
+        $plugin->setCurrentPrincipal($this->calendar->getPrincipalURI());
229
+
230
+        if (empty($this->calendarInfo['uri'])) {
231
+            throw new CalendarException('Could not write to calendar as URI parameter is missing');
232
+        }
233
+        // Force calendar change URI
234
+        /** @var Schedule\Plugin $schedulingPlugin */
235
+        $schedulingPlugin = $server->getServer()->getPlugin('caldav-schedule');
236
+        // Let sabre handle the rest
237
+        $iTipMessage = new Message();
238
+        /** @var VCalendar $vObject */
239
+        $vObject = Reader::read($calendarData);
240
+        /** @var VEvent $vEvent */
241
+        $vEvent = $vObject->{'VEVENT'};
242
+
243
+        if ($vObject->{'METHOD'} === null) {
244
+            throw new CalendarException('No Method provided for scheduling data. Could not process message');
245
+        }
246
+
247
+        if (!isset($vEvent->{'ORGANIZER'}) || !isset($vEvent->{'ATTENDEE'})) {
248
+            throw new CalendarException('Could not process scheduling data, neccessary data missing from ICAL');
249
+        }
250
+        $organizer = $vEvent->{'ORGANIZER'}->getValue();
251
+        $attendee = $vEvent->{'ATTENDEE'}->getValue();
252
+
253
+        $iTipMessage->method = $vObject->{'METHOD'}->getValue();
254
+        if ($iTipMessage->method === 'REQUEST') {
255
+            $iTipMessage->sender = $organizer;
256
+            $iTipMessage->recipient = $attendee;
257
+        } elseif ($iTipMessage->method === 'REPLY') {
258
+            if ($server->isExternalAttendee($vEvent->{'ATTENDEE'}->getValue())) {
259
+                $iTipMessage->recipient = $organizer;
260
+            } else {
261
+                $iTipMessage->recipient = $attendee;
262
+            }
263
+            $iTipMessage->sender = $attendee;
264
+        } elseif ($iTipMessage->method === 'CANCEL') {
265
+            $iTipMessage->recipient = $attendee;
266
+            $iTipMessage->sender = $organizer;
267
+        }
268
+        $iTipMessage->uid = isset($vEvent->{'UID'}) ? $vEvent->{'UID'}->getValue() : '';
269
+        $iTipMessage->component = 'VEVENT';
270
+        $iTipMessage->sequence = isset($vEvent->{'SEQUENCE'}) ? (int)$vEvent->{'SEQUENCE'}->getValue() : 0;
271
+        $iTipMessage->message = $vObject;
272
+        $server->server->emit('schedule', [$iTipMessage]);
273
+    }
274
+
275
+    public function getInvitationResponseServer(): InvitationResponseServer {
276
+        return new InvitationResponseServer(false);
277
+    }
278
+
279
+    /**
280
+     * Export objects
281
+     *
282
+     * @since 32.0.0
283
+     *
284
+     * @return Generator<mixed, \Sabre\VObject\Component\VCalendar, mixed, mixed>
285
+     */
286
+    public function export(?CalendarExportOptions $options = null): Generator {
287
+        foreach (
288
+            $this->backend->exportCalendar(
289
+                $this->calendarInfo['id'],
290
+                $this->backend::CALENDAR_TYPE_CALENDAR,
291
+                $options
292
+            ) as $event
293
+        ) {
294
+            $vObject = Reader::read($event['calendardata']);
295
+            if ($vObject instanceof VCalendar) {
296
+                yield $vObject;
297
+            }
298
+        }
299
+    }
300 300
 
301 301
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/CalDavBackend.php 1 patch
Indentation   +3586 added lines, -3586 removed lines patch added patch discarded remove patch
@@ -106,3590 +106,3590 @@
 block discarded – undo
106 106
  * }
107 107
  */
108 108
 class CalDavBackend extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport {
109
-	use TTransactional;
110
-
111
-	public const CALENDAR_TYPE_CALENDAR = 0;
112
-	public const CALENDAR_TYPE_SUBSCRIPTION = 1;
113
-
114
-	public const PERSONAL_CALENDAR_URI = 'personal';
115
-	public const PERSONAL_CALENDAR_NAME = 'Personal';
116
-
117
-	public const RESOURCE_BOOKING_CALENDAR_URI = 'calendar';
118
-	public const RESOURCE_BOOKING_CALENDAR_NAME = 'Calendar';
119
-
120
-	/**
121
-	 * We need to specify a max date, because we need to stop *somewhere*
122
-	 *
123
-	 * On 32 bit system the maximum for a signed integer is 2147483647, so
124
-	 * MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results
125
-	 * in 2038-01-19 to avoid problems when the date is converted
126
-	 * to a unix timestamp.
127
-	 */
128
-	public const MAX_DATE = '2038-01-01';
129
-
130
-	public const ACCESS_PUBLIC = 4;
131
-	public const CLASSIFICATION_PUBLIC = 0;
132
-	public const CLASSIFICATION_PRIVATE = 1;
133
-	public const CLASSIFICATION_CONFIDENTIAL = 2;
134
-
135
-	/**
136
-	 * List of CalDAV properties, and how they map to database field names and their type
137
-	 * Add your own properties by simply adding on to this array.
138
-	 *
139
-	 * @var array
140
-	 * @psalm-var array<string, string[]>
141
-	 */
142
-	public array $propertyMap = [
143
-		'{DAV:}displayname' => ['displayname', 'string'],
144
-		'{urn:ietf:params:xml:ns:caldav}calendar-description' => ['description', 'string'],
145
-		'{urn:ietf:params:xml:ns:caldav}calendar-timezone' => ['timezone', 'string'],
146
-		'{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'],
147
-		'{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'],
148
-		'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int'],
149
-	];
150
-
151
-	/**
152
-	 * List of subscription properties, and how they map to database field names.
153
-	 *
154
-	 * @var array
155
-	 */
156
-	public array $subscriptionPropertyMap = [
157
-		'{DAV:}displayname' => ['displayname', 'string'],
158
-		'{http://apple.com/ns/ical/}refreshrate' => ['refreshrate', 'string'],
159
-		'{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'],
160
-		'{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'],
161
-		'{http://calendarserver.org/ns/}subscribed-strip-todos' => ['striptodos', 'bool'],
162
-		'{http://calendarserver.org/ns/}subscribed-strip-alarms' => ['stripalarms', 'string'],
163
-		'{http://calendarserver.org/ns/}subscribed-strip-attachments' => ['stripattachments', 'string'],
164
-	];
165
-
166
-	/**
167
-	 * properties to index
168
-	 *
169
-	 * This list has to be kept in sync with ICalendarQuery::SEARCH_PROPERTY_*
170
-	 *
171
-	 * @see \OCP\Calendar\ICalendarQuery
172
-	 */
173
-	private const INDEXED_PROPERTIES = [
174
-		'CATEGORIES',
175
-		'COMMENT',
176
-		'DESCRIPTION',
177
-		'LOCATION',
178
-		'RESOURCES',
179
-		'STATUS',
180
-		'SUMMARY',
181
-		'ATTENDEE',
182
-		'CONTACT',
183
-		'ORGANIZER'
184
-	];
185
-
186
-	/** @var array parameters to index */
187
-	public static array $indexParameters = [
188
-		'ATTENDEE' => ['CN'],
189
-		'ORGANIZER' => ['CN'],
190
-	];
191
-
192
-	/**
193
-	 * @var string[] Map of uid => display name
194
-	 */
195
-	protected array $userDisplayNames;
196
-
197
-	private string $dbObjectsTable = 'calendarobjects';
198
-	private string $dbObjectPropertiesTable = 'calendarobjects_props';
199
-	private string $dbObjectInvitationsTable = 'calendar_invitations';
200
-	private array $cachedObjects = [];
201
-
202
-	public function __construct(
203
-		private IDBConnection $db,
204
-		private Principal $principalBackend,
205
-		private IUserManager $userManager,
206
-		private ISecureRandom $random,
207
-		private LoggerInterface $logger,
208
-		private IEventDispatcher $dispatcher,
209
-		private IConfig $config,
210
-		private Sharing\Backend $calendarSharingBackend,
211
-		private bool $legacyEndpoint = false,
212
-	) {
213
-	}
214
-
215
-	/**
216
-	 * Return the number of calendars owned by the given principal.
217
-	 *
218
-	 * Calendars shared with the given principal are not counted!
219
-	 *
220
-	 * By default, this excludes the automatically generated birthday calendar.
221
-	 */
222
-	public function getCalendarsForUserCount(string $principalUri, bool $excludeBirthday = true): int {
223
-		$principalUri = $this->convertPrincipal($principalUri, true);
224
-		$query = $this->db->getQueryBuilder();
225
-		$query->select($query->func()->count('*'))
226
-			->from('calendars');
227
-
228
-		if ($principalUri === '') {
229
-			$query->where($query->expr()->emptyString('principaluri'));
230
-		} else {
231
-			$query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
232
-		}
233
-
234
-		if ($excludeBirthday) {
235
-			$query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)));
236
-		}
237
-
238
-		$result = $query->executeQuery();
239
-		$column = (int)$result->fetchOne();
240
-		$result->closeCursor();
241
-		return $column;
242
-	}
243
-
244
-	/**
245
-	 * Return the number of subscriptions for a principal
246
-	 */
247
-	public function getSubscriptionsForUserCount(string $principalUri): int {
248
-		$principalUri = $this->convertPrincipal($principalUri, true);
249
-		$query = $this->db->getQueryBuilder();
250
-		$query->select($query->func()->count('*'))
251
-			->from('calendarsubscriptions');
252
-
253
-		if ($principalUri === '') {
254
-			$query->where($query->expr()->emptyString('principaluri'));
255
-		} else {
256
-			$query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
257
-		}
258
-
259
-		$result = $query->executeQuery();
260
-		$column = (int)$result->fetchOne();
261
-		$result->closeCursor();
262
-		return $column;
263
-	}
264
-
265
-	/**
266
-	 * @return array{id: int, deleted_at: int}[]
267
-	 */
268
-	public function getDeletedCalendars(int $deletedBefore): array {
269
-		$qb = $this->db->getQueryBuilder();
270
-		$qb->select(['id', 'deleted_at'])
271
-			->from('calendars')
272
-			->where($qb->expr()->isNotNull('deleted_at'))
273
-			->andWhere($qb->expr()->lt('deleted_at', $qb->createNamedParameter($deletedBefore)));
274
-		$result = $qb->executeQuery();
275
-		$calendars = [];
276
-		while (($row = $result->fetch()) !== false) {
277
-			$calendars[] = [
278
-				'id' => (int)$row['id'],
279
-				'deleted_at' => (int)$row['deleted_at'],
280
-			];
281
-		}
282
-		$result->closeCursor();
283
-		return $calendars;
284
-	}
285
-
286
-	/**
287
-	 * Returns a list of calendars for a principal.
288
-	 *
289
-	 * Every project is an array with the following keys:
290
-	 *  * id, a unique id that will be used by other functions to modify the
291
-	 *    calendar. This can be the same as the uri or a database key.
292
-	 *  * uri, which the basename of the uri with which the calendar is
293
-	 *    accessed.
294
-	 *  * principaluri. The owner of the calendar. Almost always the same as
295
-	 *    principalUri passed to this method.
296
-	 *
297
-	 * Furthermore it can contain webdav properties in clark notation. A very
298
-	 * common one is '{DAV:}displayname'.
299
-	 *
300
-	 * Many clients also require:
301
-	 * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
302
-	 * For this property, you can just return an instance of
303
-	 * Sabre\CalDAV\Property\SupportedCalendarComponentSet.
304
-	 *
305
-	 * If you return {http://sabredav.org/ns}read-only and set the value to 1,
306
-	 * ACL will automatically be put in read-only mode.
307
-	 *
308
-	 * @param string $principalUri
309
-	 * @return array
310
-	 */
311
-	public function getCalendarsForUser($principalUri) {
312
-		return $this->atomic(function () use ($principalUri) {
313
-			$principalUriOriginal = $principalUri;
314
-			$principalUri = $this->convertPrincipal($principalUri, true);
315
-			$fields = array_column($this->propertyMap, 0);
316
-			$fields[] = 'id';
317
-			$fields[] = 'uri';
318
-			$fields[] = 'synctoken';
319
-			$fields[] = 'components';
320
-			$fields[] = 'principaluri';
321
-			$fields[] = 'transparent';
322
-
323
-			// Making fields a comma-delimited list
324
-			$query = $this->db->getQueryBuilder();
325
-			$query->select($fields)
326
-				->from('calendars')
327
-				->orderBy('calendarorder', 'ASC');
328
-
329
-			if ($principalUri === '') {
330
-				$query->where($query->expr()->emptyString('principaluri'));
331
-			} else {
332
-				$query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
333
-			}
334
-
335
-			$result = $query->executeQuery();
336
-
337
-			$calendars = [];
338
-			while ($row = $result->fetch()) {
339
-				$row['principaluri'] = (string)$row['principaluri'];
340
-				$components = [];
341
-				if ($row['components']) {
342
-					$components = explode(',', $row['components']);
343
-				}
344
-
345
-				$calendar = [
346
-					'id' => $row['id'],
347
-					'uri' => $row['uri'],
348
-					'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
349
-					'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
350
-					'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
351
-					'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
352
-					'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
353
-					'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
354
-				];
355
-
356
-				$calendar = $this->rowToCalendar($row, $calendar);
357
-				$calendar = $this->addOwnerPrincipalToCalendar($calendar);
358
-				$calendar = $this->addResourceTypeToCalendar($row, $calendar);
359
-
360
-				if (!isset($calendars[$calendar['id']])) {
361
-					$calendars[$calendar['id']] = $calendar;
362
-				}
363
-			}
364
-			$result->closeCursor();
365
-
366
-			// query for shared calendars
367
-			$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
368
-			$principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal));
369
-			$principals[] = $principalUri;
370
-
371
-			$fields = array_column($this->propertyMap, 0);
372
-			$fields = array_map(function (string $field) {
373
-				return 'a.' . $field;
374
-			}, $fields);
375
-			$fields[] = 'a.id';
376
-			$fields[] = 'a.uri';
377
-			$fields[] = 'a.synctoken';
378
-			$fields[] = 'a.components';
379
-			$fields[] = 'a.principaluri';
380
-			$fields[] = 'a.transparent';
381
-			$fields[] = 's.access';
382
-
383
-			$select = $this->db->getQueryBuilder();
384
-			$subSelect = $this->db->getQueryBuilder();
385
-
386
-			$subSelect->select('resourceid')
387
-				->from('dav_shares', 'd')
388
-				->where($subSelect->expr()->eq('d.access', $select->createNamedParameter(Backend::ACCESS_UNSHARED, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT))
389
-				->andWhere($subSelect->expr()->in('d.principaluri', $select->createNamedParameter($principals, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY));
390
-
391
-			$select->select($fields)
392
-				->from('dav_shares', 's')
393
-				->join('s', 'calendars', 'a', $select->expr()->eq('s.resourceid', 'a.id', IQueryBuilder::PARAM_INT))
394
-				->where($select->expr()->in('s.principaluri', $select->createNamedParameter($principals, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY))
395
-				->andWhere($select->expr()->eq('s.type', $select->createNamedParameter('calendar', IQueryBuilder::PARAM_STR), IQueryBuilder::PARAM_STR))
396
-				->andWhere($select->expr()->notIn('a.id', $select->createFunction($subSelect->getSQL()), IQueryBuilder::PARAM_INT_ARRAY));
397
-
398
-			$results = $select->executeQuery();
399
-
400
-			$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
401
-			while ($row = $results->fetch()) {
402
-				$row['principaluri'] = (string)$row['principaluri'];
403
-				if ($row['principaluri'] === $principalUri) {
404
-					continue;
405
-				}
406
-
407
-				$readOnly = (int)$row['access'] === Backend::ACCESS_READ;
408
-				if (isset($calendars[$row['id']])) {
409
-					if ($readOnly) {
410
-						// New share can not have more permissions than the old one.
411
-						continue;
412
-					}
413
-					if (isset($calendars[$row['id']][$readOnlyPropertyName])
414
-						&& $calendars[$row['id']][$readOnlyPropertyName] === 0) {
415
-						// Old share is already read-write, no more permissions can be gained
416
-						continue;
417
-					}
418
-				}
419
-
420
-				[, $name] = Uri\split($row['principaluri']);
421
-				$uri = $row['uri'] . '_shared_by_' . $name;
422
-				$row['displayname'] = $row['displayname'] . ' (' . ($this->userManager->getDisplayName($name) ?? ($name ?? '')) . ')';
423
-				$components = [];
424
-				if ($row['components']) {
425
-					$components = explode(',', $row['components']);
426
-				}
427
-				$calendar = [
428
-					'id' => $row['id'],
429
-					'uri' => $uri,
430
-					'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
431
-					'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
432
-					'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
433
-					'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
434
-					'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
435
-					'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
436
-					$readOnlyPropertyName => $readOnly,
437
-				];
438
-
439
-				$calendar = $this->rowToCalendar($row, $calendar);
440
-				$calendar = $this->addOwnerPrincipalToCalendar($calendar);
441
-				$calendar = $this->addResourceTypeToCalendar($row, $calendar);
442
-
443
-				$calendars[$calendar['id']] = $calendar;
444
-			}
445
-			$result->closeCursor();
446
-
447
-			return array_values($calendars);
448
-		}, $this->db);
449
-	}
450
-
451
-	/**
452
-	 * @param $principalUri
453
-	 * @return array
454
-	 */
455
-	public function getUsersOwnCalendars($principalUri) {
456
-		$principalUri = $this->convertPrincipal($principalUri, true);
457
-		$fields = array_column($this->propertyMap, 0);
458
-		$fields[] = 'id';
459
-		$fields[] = 'uri';
460
-		$fields[] = 'synctoken';
461
-		$fields[] = 'components';
462
-		$fields[] = 'principaluri';
463
-		$fields[] = 'transparent';
464
-		// Making fields a comma-delimited list
465
-		$query = $this->db->getQueryBuilder();
466
-		$query->select($fields)->from('calendars')
467
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
468
-			->orderBy('calendarorder', 'ASC');
469
-		$stmt = $query->executeQuery();
470
-		$calendars = [];
471
-		while ($row = $stmt->fetch()) {
472
-			$row['principaluri'] = (string)$row['principaluri'];
473
-			$components = [];
474
-			if ($row['components']) {
475
-				$components = explode(',', $row['components']);
476
-			}
477
-			$calendar = [
478
-				'id' => $row['id'],
479
-				'uri' => $row['uri'],
480
-				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
481
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
482
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
483
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
484
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
485
-			];
486
-
487
-			$calendar = $this->rowToCalendar($row, $calendar);
488
-			$calendar = $this->addOwnerPrincipalToCalendar($calendar);
489
-			$calendar = $this->addResourceTypeToCalendar($row, $calendar);
490
-
491
-			if (!isset($calendars[$calendar['id']])) {
492
-				$calendars[$calendar['id']] = $calendar;
493
-			}
494
-		}
495
-		$stmt->closeCursor();
496
-		return array_values($calendars);
497
-	}
498
-
499
-	/**
500
-	 * @return array
501
-	 */
502
-	public function getPublicCalendars() {
503
-		$fields = array_column($this->propertyMap, 0);
504
-		$fields[] = 'a.id';
505
-		$fields[] = 'a.uri';
506
-		$fields[] = 'a.synctoken';
507
-		$fields[] = 'a.components';
508
-		$fields[] = 'a.principaluri';
509
-		$fields[] = 'a.transparent';
510
-		$fields[] = 's.access';
511
-		$fields[] = 's.publicuri';
512
-		$calendars = [];
513
-		$query = $this->db->getQueryBuilder();
514
-		$result = $query->select($fields)
515
-			->from('dav_shares', 's')
516
-			->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
517
-			->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
518
-			->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
519
-			->executeQuery();
520
-
521
-		while ($row = $result->fetch()) {
522
-			$row['principaluri'] = (string)$row['principaluri'];
523
-			[, $name] = Uri\split($row['principaluri']);
524
-			$row['displayname'] = $row['displayname'] . "($name)";
525
-			$components = [];
526
-			if ($row['components']) {
527
-				$components = explode(',', $row['components']);
528
-			}
529
-			$calendar = [
530
-				'id' => $row['id'],
531
-				'uri' => $row['publicuri'],
532
-				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
533
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
534
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
535
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
536
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
537
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
538
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => true,
539
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
540
-			];
541
-
542
-			$calendar = $this->rowToCalendar($row, $calendar);
543
-			$calendar = $this->addOwnerPrincipalToCalendar($calendar);
544
-			$calendar = $this->addResourceTypeToCalendar($row, $calendar);
545
-
546
-			if (!isset($calendars[$calendar['id']])) {
547
-				$calendars[$calendar['id']] = $calendar;
548
-			}
549
-		}
550
-		$result->closeCursor();
551
-
552
-		return array_values($calendars);
553
-	}
554
-
555
-	/**
556
-	 * @param string $uri
557
-	 * @return array
558
-	 * @throws NotFound
559
-	 */
560
-	public function getPublicCalendar($uri) {
561
-		$fields = array_column($this->propertyMap, 0);
562
-		$fields[] = 'a.id';
563
-		$fields[] = 'a.uri';
564
-		$fields[] = 'a.synctoken';
565
-		$fields[] = 'a.components';
566
-		$fields[] = 'a.principaluri';
567
-		$fields[] = 'a.transparent';
568
-		$fields[] = 's.access';
569
-		$fields[] = 's.publicuri';
570
-		$query = $this->db->getQueryBuilder();
571
-		$result = $query->select($fields)
572
-			->from('dav_shares', 's')
573
-			->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
574
-			->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
575
-			->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
576
-			->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri)))
577
-			->executeQuery();
578
-
579
-		$row = $result->fetch();
580
-
581
-		$result->closeCursor();
582
-
583
-		if ($row === false) {
584
-			throw new NotFound('Node with name \'' . $uri . '\' could not be found');
585
-		}
586
-
587
-		$row['principaluri'] = (string)$row['principaluri'];
588
-		[, $name] = Uri\split($row['principaluri']);
589
-		$row['displayname'] = $row['displayname'] . ' ' . "($name)";
590
-		$components = [];
591
-		if ($row['components']) {
592
-			$components = explode(',', $row['components']);
593
-		}
594
-		$calendar = [
595
-			'id' => $row['id'],
596
-			'uri' => $row['publicuri'],
597
-			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
598
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
599
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
600
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
601
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
602
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
603
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => true,
604
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
605
-		];
606
-
607
-		$calendar = $this->rowToCalendar($row, $calendar);
608
-		$calendar = $this->addOwnerPrincipalToCalendar($calendar);
609
-		$calendar = $this->addResourceTypeToCalendar($row, $calendar);
610
-
611
-		return $calendar;
612
-	}
613
-
614
-	/**
615
-	 * @param string $principal
616
-	 * @param string $uri
617
-	 * @return array|null
618
-	 */
619
-	public function getCalendarByUri($principal, $uri) {
620
-		$fields = array_column($this->propertyMap, 0);
621
-		$fields[] = 'id';
622
-		$fields[] = 'uri';
623
-		$fields[] = 'synctoken';
624
-		$fields[] = 'components';
625
-		$fields[] = 'principaluri';
626
-		$fields[] = 'transparent';
627
-
628
-		// Making fields a comma-delimited list
629
-		$query = $this->db->getQueryBuilder();
630
-		$query->select($fields)->from('calendars')
631
-			->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
632
-			->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal)))
633
-			->setMaxResults(1);
634
-		$stmt = $query->executeQuery();
635
-
636
-		$row = $stmt->fetch();
637
-		$stmt->closeCursor();
638
-		if ($row === false) {
639
-			return null;
640
-		}
641
-
642
-		$row['principaluri'] = (string)$row['principaluri'];
643
-		$components = [];
644
-		if ($row['components']) {
645
-			$components = explode(',', $row['components']);
646
-		}
647
-
648
-		$calendar = [
649
-			'id' => $row['id'],
650
-			'uri' => $row['uri'],
651
-			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
652
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
653
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
654
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
655
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
656
-		];
657
-
658
-		$calendar = $this->rowToCalendar($row, $calendar);
659
-		$calendar = $this->addOwnerPrincipalToCalendar($calendar);
660
-		$calendar = $this->addResourceTypeToCalendar($row, $calendar);
661
-
662
-		return $calendar;
663
-	}
664
-
665
-	/**
666
-	 * @psalm-return CalendarInfo|null
667
-	 * @return array|null
668
-	 */
669
-	public function getCalendarById(int $calendarId): ?array {
670
-		$fields = array_column($this->propertyMap, 0);
671
-		$fields[] = 'id';
672
-		$fields[] = 'uri';
673
-		$fields[] = 'synctoken';
674
-		$fields[] = 'components';
675
-		$fields[] = 'principaluri';
676
-		$fields[] = 'transparent';
677
-
678
-		// Making fields a comma-delimited list
679
-		$query = $this->db->getQueryBuilder();
680
-		$query->select($fields)->from('calendars')
681
-			->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)))
682
-			->setMaxResults(1);
683
-		$stmt = $query->executeQuery();
684
-
685
-		$row = $stmt->fetch();
686
-		$stmt->closeCursor();
687
-		if ($row === false) {
688
-			return null;
689
-		}
690
-
691
-		$row['principaluri'] = (string)$row['principaluri'];
692
-		$components = [];
693
-		if ($row['components']) {
694
-			$components = explode(',', $row['components']);
695
-		}
696
-
697
-		$calendar = [
698
-			'id' => $row['id'],
699
-			'uri' => $row['uri'],
700
-			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
701
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
702
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?? 0,
703
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
704
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
705
-		];
706
-
707
-		$calendar = $this->rowToCalendar($row, $calendar);
708
-		$calendar = $this->addOwnerPrincipalToCalendar($calendar);
709
-		$calendar = $this->addResourceTypeToCalendar($row, $calendar);
710
-
711
-		return $calendar;
712
-	}
713
-
714
-	/**
715
-	 * @param $subscriptionId
716
-	 */
717
-	public function getSubscriptionById($subscriptionId) {
718
-		$fields = array_column($this->subscriptionPropertyMap, 0);
719
-		$fields[] = 'id';
720
-		$fields[] = 'uri';
721
-		$fields[] = 'source';
722
-		$fields[] = 'synctoken';
723
-		$fields[] = 'principaluri';
724
-		$fields[] = 'lastmodified';
725
-
726
-		$query = $this->db->getQueryBuilder();
727
-		$query->select($fields)
728
-			->from('calendarsubscriptions')
729
-			->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
730
-			->orderBy('calendarorder', 'asc');
731
-		$stmt = $query->executeQuery();
732
-
733
-		$row = $stmt->fetch();
734
-		$stmt->closeCursor();
735
-		if ($row === false) {
736
-			return null;
737
-		}
738
-
739
-		$row['principaluri'] = (string)$row['principaluri'];
740
-		$subscription = [
741
-			'id' => $row['id'],
742
-			'uri' => $row['uri'],
743
-			'principaluri' => $row['principaluri'],
744
-			'source' => $row['source'],
745
-			'lastmodified' => $row['lastmodified'],
746
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
747
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
748
-		];
749
-
750
-		return $this->rowToSubscription($row, $subscription);
751
-	}
752
-
753
-	public function getSubscriptionByUri(string $principal, string $uri): ?array {
754
-		$fields = array_column($this->subscriptionPropertyMap, 0);
755
-		$fields[] = 'id';
756
-		$fields[] = 'uri';
757
-		$fields[] = 'source';
758
-		$fields[] = 'synctoken';
759
-		$fields[] = 'principaluri';
760
-		$fields[] = 'lastmodified';
761
-
762
-		$query = $this->db->getQueryBuilder();
763
-		$query->select($fields)
764
-			->from('calendarsubscriptions')
765
-			->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
766
-			->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal)))
767
-			->setMaxResults(1);
768
-		$stmt = $query->executeQuery();
769
-
770
-		$row = $stmt->fetch();
771
-		$stmt->closeCursor();
772
-		if ($row === false) {
773
-			return null;
774
-		}
775
-
776
-		$row['principaluri'] = (string)$row['principaluri'];
777
-		$subscription = [
778
-			'id' => $row['id'],
779
-			'uri' => $row['uri'],
780
-			'principaluri' => $row['principaluri'],
781
-			'source' => $row['source'],
782
-			'lastmodified' => $row['lastmodified'],
783
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
784
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
785
-		];
786
-
787
-		return $this->rowToSubscription($row, $subscription);
788
-	}
789
-
790
-	/**
791
-	 * Creates a new calendar for a principal.
792
-	 *
793
-	 * If the creation was a success, an id must be returned that can be used to reference
794
-	 * this calendar in other methods, such as updateCalendar.
795
-	 *
796
-	 * @param string $principalUri
797
-	 * @param string $calendarUri
798
-	 * @param array $properties
799
-	 * @return int
800
-	 *
801
-	 * @throws CalendarException
802
-	 */
803
-	public function createCalendar($principalUri, $calendarUri, array $properties) {
804
-		if (strlen($calendarUri) > 255) {
805
-			throw new CalendarException('URI too long. Calendar not created');
806
-		}
807
-
808
-		$values = [
809
-			'principaluri' => $this->convertPrincipal($principalUri, true),
810
-			'uri' => $calendarUri,
811
-			'synctoken' => 1,
812
-			'transparent' => 0,
813
-			'components' => 'VEVENT,VTODO,VJOURNAL',
814
-			'displayname' => $calendarUri
815
-		];
816
-
817
-		// Default value
818
-		$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
819
-		if (isset($properties[$sccs])) {
820
-			if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) {
821
-				throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
822
-			}
823
-			$values['components'] = implode(',', $properties[$sccs]->getValue());
824
-		} elseif (isset($properties['components'])) {
825
-			// Allow to provide components internally without having
826
-			// to create a SupportedCalendarComponentSet object
827
-			$values['components'] = $properties['components'];
828
-		}
829
-
830
-		$transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
831
-		if (isset($properties[$transp])) {
832
-			$values['transparent'] = (int)($properties[$transp]->getValue() === 'transparent');
833
-		}
834
-
835
-		foreach ($this->propertyMap as $xmlName => [$dbName, $type]) {
836
-			if (isset($properties[$xmlName])) {
837
-				$values[$dbName] = $properties[$xmlName];
838
-			}
839
-		}
840
-
841
-		[$calendarId, $calendarData] = $this->atomic(function () use ($values) {
842
-			$query = $this->db->getQueryBuilder();
843
-			$query->insert('calendars');
844
-			foreach ($values as $column => $value) {
845
-				$query->setValue($column, $query->createNamedParameter($value));
846
-			}
847
-			$query->executeStatement();
848
-			$calendarId = $query->getLastInsertId();
849
-
850
-			$calendarData = $this->getCalendarById($calendarId);
851
-			return [$calendarId, $calendarData];
852
-		}, $this->db);
853
-
854
-		$this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData));
855
-
856
-		return $calendarId;
857
-	}
858
-
859
-	/**
860
-	 * Updates properties for a calendar.
861
-	 *
862
-	 * The list of mutations is stored in a Sabre\DAV\PropPatch object.
863
-	 * To do the actual updates, you must tell this object which properties
864
-	 * you're going to process with the handle() method.
865
-	 *
866
-	 * Calling the handle method is like telling the PropPatch object "I
867
-	 * promise I can handle updating this property".
868
-	 *
869
-	 * Read the PropPatch documentation for more info and examples.
870
-	 *
871
-	 * @param mixed $calendarId
872
-	 * @param PropPatch $propPatch
873
-	 * @return void
874
-	 */
875
-	public function updateCalendar($calendarId, PropPatch $propPatch) {
876
-		$supportedProperties = array_keys($this->propertyMap);
877
-		$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
878
-
879
-		$propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
880
-			$newValues = [];
881
-			foreach ($mutations as $propertyName => $propertyValue) {
882
-				switch ($propertyName) {
883
-					case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp':
884
-						$fieldName = 'transparent';
885
-						$newValues[$fieldName] = (int)($propertyValue->getValue() === 'transparent');
886
-						break;
887
-					default:
888
-						$fieldName = $this->propertyMap[$propertyName][0];
889
-						$newValues[$fieldName] = $propertyValue;
890
-						break;
891
-				}
892
-			}
893
-			[$calendarData, $shares] = $this->atomic(function () use ($calendarId, $newValues) {
894
-				$query = $this->db->getQueryBuilder();
895
-				$query->update('calendars');
896
-				foreach ($newValues as $fieldName => $value) {
897
-					$query->set($fieldName, $query->createNamedParameter($value));
898
-				}
899
-				$query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
900
-				$query->executeStatement();
901
-
902
-				$this->addChanges($calendarId, [''], 2);
903
-
904
-				$calendarData = $this->getCalendarById($calendarId);
905
-				$shares = $this->getShares($calendarId);
906
-				return [$calendarData, $shares];
907
-			}, $this->db);
908
-
909
-			$this->dispatcher->dispatchTyped(new CalendarUpdatedEvent($calendarId, $calendarData, $shares, $mutations));
910
-
911
-			return true;
912
-		});
913
-	}
914
-
915
-	/**
916
-	 * Delete a calendar and all it's objects
917
-	 *
918
-	 * @param mixed $calendarId
919
-	 * @return void
920
-	 */
921
-	public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) {
922
-		$this->atomic(function () use ($calendarId, $forceDeletePermanently): void {
923
-			// The calendar is deleted right away if this is either enforced by the caller
924
-			// or the special contacts birthday calendar or when the preference of an empty
925
-			// retention (0 seconds) is set, which signals a disabled trashbin.
926
-			$calendarData = $this->getCalendarById($calendarId);
927
-			$isBirthdayCalendar = isset($calendarData['uri']) && $calendarData['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI;
928
-			$trashbinDisabled = $this->config->getAppValue(Application::APP_ID, RetentionService::RETENTION_CONFIG_KEY) === '0';
929
-			if ($forceDeletePermanently || $isBirthdayCalendar || $trashbinDisabled) {
930
-				$calendarData = $this->getCalendarById($calendarId);
931
-				$shares = $this->getShares($calendarId);
932
-
933
-				$this->purgeCalendarInvitations($calendarId);
934
-
935
-				$qbDeleteCalendarObjectProps = $this->db->getQueryBuilder();
936
-				$qbDeleteCalendarObjectProps->delete($this->dbObjectPropertiesTable)
937
-					->where($qbDeleteCalendarObjectProps->expr()->eq('calendarid', $qbDeleteCalendarObjectProps->createNamedParameter($calendarId)))
938
-					->andWhere($qbDeleteCalendarObjectProps->expr()->eq('calendartype', $qbDeleteCalendarObjectProps->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)))
939
-					->executeStatement();
940
-
941
-				$qbDeleteCalendarObjects = $this->db->getQueryBuilder();
942
-				$qbDeleteCalendarObjects->delete('calendarobjects')
943
-					->where($qbDeleteCalendarObjects->expr()->eq('calendarid', $qbDeleteCalendarObjects->createNamedParameter($calendarId)))
944
-					->andWhere($qbDeleteCalendarObjects->expr()->eq('calendartype', $qbDeleteCalendarObjects->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)))
945
-					->executeStatement();
946
-
947
-				$qbDeleteCalendarChanges = $this->db->getQueryBuilder();
948
-				$qbDeleteCalendarChanges->delete('calendarchanges')
949
-					->where($qbDeleteCalendarChanges->expr()->eq('calendarid', $qbDeleteCalendarChanges->createNamedParameter($calendarId)))
950
-					->andWhere($qbDeleteCalendarChanges->expr()->eq('calendartype', $qbDeleteCalendarChanges->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)))
951
-					->executeStatement();
952
-
953
-				$this->calendarSharingBackend->deleteAllShares($calendarId);
954
-
955
-				$qbDeleteCalendar = $this->db->getQueryBuilder();
956
-				$qbDeleteCalendar->delete('calendars')
957
-					->where($qbDeleteCalendar->expr()->eq('id', $qbDeleteCalendar->createNamedParameter($calendarId)))
958
-					->executeStatement();
959
-
960
-				// Only dispatch if we actually deleted anything
961
-				if ($calendarData) {
962
-					$this->dispatcher->dispatchTyped(new CalendarDeletedEvent($calendarId, $calendarData, $shares));
963
-				}
964
-			} else {
965
-				$qbMarkCalendarDeleted = $this->db->getQueryBuilder();
966
-				$qbMarkCalendarDeleted->update('calendars')
967
-					->set('deleted_at', $qbMarkCalendarDeleted->createNamedParameter(time()))
968
-					->where($qbMarkCalendarDeleted->expr()->eq('id', $qbMarkCalendarDeleted->createNamedParameter($calendarId)))
969
-					->executeStatement();
970
-
971
-				$calendarData = $this->getCalendarById($calendarId);
972
-				$shares = $this->getShares($calendarId);
973
-				if ($calendarData) {
974
-					$this->dispatcher->dispatchTyped(new CalendarMovedToTrashEvent(
975
-						$calendarId,
976
-						$calendarData,
977
-						$shares
978
-					));
979
-				}
980
-			}
981
-		}, $this->db);
982
-	}
983
-
984
-	public function restoreCalendar(int $id): void {
985
-		$this->atomic(function () use ($id): void {
986
-			$qb = $this->db->getQueryBuilder();
987
-			$update = $qb->update('calendars')
988
-				->set('deleted_at', $qb->createNamedParameter(null))
989
-				->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
990
-			$update->executeStatement();
991
-
992
-			$calendarData = $this->getCalendarById($id);
993
-			$shares = $this->getShares($id);
994
-			if ($calendarData === null) {
995
-				throw new RuntimeException('Calendar data that was just written can\'t be read back. Check your database configuration.');
996
-			}
997
-			$this->dispatcher->dispatchTyped(new CalendarRestoredEvent(
998
-				$id,
999
-				$calendarData,
1000
-				$shares
1001
-			));
1002
-		}, $this->db);
1003
-	}
1004
-
1005
-	/**
1006
-	 * Returns all calendar entries as a stream of data
1007
-	 *
1008
-	 * @since 32.0.0
1009
-	 *
1010
-	 * @return Generator<array>
1011
-	 */
1012
-	public function exportCalendar(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR, ?CalendarExportOptions $options = null): Generator {
1013
-		// extract options
1014
-		$rangeStart = $options?->getRangeStart();
1015
-		$rangeCount = $options?->getRangeCount();
1016
-		// construct query
1017
-		$qb = $this->db->getQueryBuilder();
1018
-		$qb->select('*')
1019
-			->from('calendarobjects')
1020
-			->where($qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)))
1021
-			->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)))
1022
-			->andWhere($qb->expr()->isNull('deleted_at'));
1023
-		if ($rangeStart !== null) {
1024
-			$qb->andWhere($qb->expr()->gt('uid', $qb->createNamedParameter($rangeStart)));
1025
-		}
1026
-		if ($rangeCount !== null) {
1027
-			$qb->setMaxResults($rangeCount);
1028
-		}
1029
-		if ($rangeStart !== null || $rangeCount !== null) {
1030
-			$qb->orderBy('uid', 'ASC');
1031
-		}
1032
-		$rs = $qb->executeQuery();
1033
-		// iterate through results
1034
-		try {
1035
-			while (($row = $rs->fetch()) !== false) {
1036
-				yield $row;
1037
-			}
1038
-		} finally {
1039
-			$rs->closeCursor();
1040
-		}
1041
-	}
1042
-
1043
-	/**
1044
-	 * Returns all calendar objects with limited metadata for a calendar
1045
-	 *
1046
-	 * Every item contains an array with the following keys:
1047
-	 *   * id - the table row id
1048
-	 *   * etag - An arbitrary string
1049
-	 *   * uri - a unique key which will be used to construct the uri. This can
1050
-	 *     be any arbitrary string.
1051
-	 *   * calendardata - The iCalendar-compatible calendar data
1052
-	 *
1053
-	 * @param mixed $calendarId
1054
-	 * @param int $calendarType
1055
-	 * @return array
1056
-	 */
1057
-	public function getLimitedCalendarObjects(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1058
-		$query = $this->db->getQueryBuilder();
1059
-		$query->select(['id','uid', 'etag', 'uri', 'calendardata'])
1060
-			->from('calendarobjects')
1061
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1062
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1063
-			->andWhere($query->expr()->isNull('deleted_at'));
1064
-		$stmt = $query->executeQuery();
1065
-
1066
-		$result = [];
1067
-		while (($row = $stmt->fetch()) !== false) {
1068
-			$result[$row['uid']] = [
1069
-				'id' => $row['id'],
1070
-				'etag' => $row['etag'],
1071
-				'uri' => $row['uri'],
1072
-				'calendardata' => $row['calendardata'],
1073
-			];
1074
-		}
1075
-		$stmt->closeCursor();
1076
-
1077
-		return $result;
1078
-	}
1079
-
1080
-	/**
1081
-	 * Delete all of an user's shares
1082
-	 *
1083
-	 * @param string $principaluri
1084
-	 * @return void
1085
-	 */
1086
-	public function deleteAllSharesByUser($principaluri) {
1087
-		$this->calendarSharingBackend->deleteAllSharesByUser($principaluri);
1088
-	}
1089
-
1090
-	/**
1091
-	 * Returns all calendar objects within a calendar.
1092
-	 *
1093
-	 * Every item contains an array with the following keys:
1094
-	 *   * calendardata - The iCalendar-compatible calendar data
1095
-	 *   * uri - a unique key which will be used to construct the uri. This can
1096
-	 *     be any arbitrary string, but making sure it ends with '.ics' is a
1097
-	 *     good idea. This is only the basename, or filename, not the full
1098
-	 *     path.
1099
-	 *   * lastmodified - a timestamp of the last modification time
1100
-	 *   * etag - An arbitrary string, surrounded by double-quotes. (e.g.:
1101
-	 *   '"abcdef"')
1102
-	 *   * size - The size of the calendar objects, in bytes.
1103
-	 *   * component - optional, a string containing the type of object, such
1104
-	 *     as 'vevent' or 'vtodo'. If specified, this will be used to populate
1105
-	 *     the Content-Type header.
1106
-	 *
1107
-	 * Note that the etag is optional, but it's highly encouraged to return for
1108
-	 * speed reasons.
1109
-	 *
1110
-	 * The calendardata is also optional. If it's not returned
1111
-	 * 'getCalendarObject' will be called later, which *is* expected to return
1112
-	 * calendardata.
1113
-	 *
1114
-	 * If neither etag or size are specified, the calendardata will be
1115
-	 * used/fetched to determine these numbers. If both are specified the
1116
-	 * amount of times this is needed is reduced by a great degree.
1117
-	 *
1118
-	 * @param mixed $calendarId
1119
-	 * @param int $calendarType
1120
-	 * @return array
1121
-	 */
1122
-	public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1123
-		$query = $this->db->getQueryBuilder();
1124
-		$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification'])
1125
-			->from('calendarobjects')
1126
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1127
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1128
-			->andWhere($query->expr()->isNull('deleted_at'));
1129
-		$stmt = $query->executeQuery();
1130
-
1131
-		$result = [];
1132
-		while (($row = $stmt->fetch()) !== false) {
1133
-			$result[] = [
1134
-				'id' => $row['id'],
1135
-				'uri' => $row['uri'],
1136
-				'lastmodified' => $row['lastmodified'],
1137
-				'etag' => '"' . $row['etag'] . '"',
1138
-				'calendarid' => $row['calendarid'],
1139
-				'size' => (int)$row['size'],
1140
-				'component' => strtolower($row['componenttype']),
1141
-				'classification' => (int)$row['classification']
1142
-			];
1143
-		}
1144
-		$stmt->closeCursor();
1145
-
1146
-		return $result;
1147
-	}
1148
-
1149
-	public function getDeletedCalendarObjects(int $deletedBefore): array {
1150
-		$query = $this->db->getQueryBuilder();
1151
-		$query->select(['co.id', 'co.uri', 'co.lastmodified', 'co.etag', 'co.calendarid', 'co.calendartype', 'co.size', 'co.componenttype', 'co.classification', 'co.deleted_at'])
1152
-			->from('calendarobjects', 'co')
1153
-			->join('co', 'calendars', 'c', $query->expr()->eq('c.id', 'co.calendarid', IQueryBuilder::PARAM_INT))
1154
-			->where($query->expr()->isNotNull('co.deleted_at'))
1155
-			->andWhere($query->expr()->lt('co.deleted_at', $query->createNamedParameter($deletedBefore)));
1156
-		$stmt = $query->executeQuery();
1157
-
1158
-		$result = [];
1159
-		while (($row = $stmt->fetch()) !== false) {
1160
-			$result[] = [
1161
-				'id' => $row['id'],
1162
-				'uri' => $row['uri'],
1163
-				'lastmodified' => $row['lastmodified'],
1164
-				'etag' => '"' . $row['etag'] . '"',
1165
-				'calendarid' => (int)$row['calendarid'],
1166
-				'calendartype' => (int)$row['calendartype'],
1167
-				'size' => (int)$row['size'],
1168
-				'component' => strtolower($row['componenttype']),
1169
-				'classification' => (int)$row['classification'],
1170
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'],
1171
-			];
1172
-		}
1173
-		$stmt->closeCursor();
1174
-
1175
-		return $result;
1176
-	}
1177
-
1178
-	/**
1179
-	 * Return all deleted calendar objects by the given principal that are not
1180
-	 * in deleted calendars.
1181
-	 *
1182
-	 * @param string $principalUri
1183
-	 * @return array
1184
-	 * @throws Exception
1185
-	 */
1186
-	public function getDeletedCalendarObjectsByPrincipal(string $principalUri): array {
1187
-		$query = $this->db->getQueryBuilder();
1188
-		$query->select(['co.id', 'co.uri', 'co.lastmodified', 'co.etag', 'co.calendarid', 'co.size', 'co.componenttype', 'co.classification', 'co.deleted_at'])
1189
-			->selectAlias('c.uri', 'calendaruri')
1190
-			->from('calendarobjects', 'co')
1191
-			->join('co', 'calendars', 'c', $query->expr()->eq('c.id', 'co.calendarid', IQueryBuilder::PARAM_INT))
1192
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
1193
-			->andWhere($query->expr()->isNotNull('co.deleted_at'))
1194
-			->andWhere($query->expr()->isNull('c.deleted_at'));
1195
-		$stmt = $query->executeQuery();
1196
-
1197
-		$result = [];
1198
-		while ($row = $stmt->fetch()) {
1199
-			$result[] = [
1200
-				'id' => $row['id'],
1201
-				'uri' => $row['uri'],
1202
-				'lastmodified' => $row['lastmodified'],
1203
-				'etag' => '"' . $row['etag'] . '"',
1204
-				'calendarid' => $row['calendarid'],
1205
-				'calendaruri' => $row['calendaruri'],
1206
-				'size' => (int)$row['size'],
1207
-				'component' => strtolower($row['componenttype']),
1208
-				'classification' => (int)$row['classification'],
1209
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'],
1210
-			];
1211
-		}
1212
-		$stmt->closeCursor();
1213
-
1214
-		return $result;
1215
-	}
1216
-
1217
-	/**
1218
-	 * Returns information from a single calendar object, based on it's object
1219
-	 * uri.
1220
-	 *
1221
-	 * The object uri is only the basename, or filename and not a full path.
1222
-	 *
1223
-	 * The returned array must have the same keys as getCalendarObjects. The
1224
-	 * 'calendardata' object is required here though, while it's not required
1225
-	 * for getCalendarObjects.
1226
-	 *
1227
-	 * This method must return null if the object did not exist.
1228
-	 *
1229
-	 * @param mixed $calendarId
1230
-	 * @param string $objectUri
1231
-	 * @param int $calendarType
1232
-	 * @return array|null
1233
-	 */
1234
-	public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1235
-		$key = $calendarId . '::' . $objectUri . '::' . $calendarType;
1236
-		if (isset($this->cachedObjects[$key])) {
1237
-			return $this->cachedObjects[$key];
1238
-		}
1239
-		$query = $this->db->getQueryBuilder();
1240
-		$query->select(['id', 'uri', 'uid', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification', 'deleted_at'])
1241
-			->from('calendarobjects')
1242
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1243
-			->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
1244
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
1245
-		$stmt = $query->executeQuery();
1246
-		$row = $stmt->fetch();
1247
-		$stmt->closeCursor();
1248
-
1249
-		if (!$row) {
1250
-			return null;
1251
-		}
1252
-
1253
-		$object = $this->rowToCalendarObject($row);
1254
-		$this->cachedObjects[$key] = $object;
1255
-		return $object;
1256
-	}
1257
-
1258
-	private function rowToCalendarObject(array $row): array {
1259
-		return [
1260
-			'id' => $row['id'],
1261
-			'uri' => $row['uri'],
1262
-			'uid' => $row['uid'],
1263
-			'lastmodified' => $row['lastmodified'],
1264
-			'etag' => '"' . $row['etag'] . '"',
1265
-			'calendarid' => $row['calendarid'],
1266
-			'size' => (int)$row['size'],
1267
-			'calendardata' => $this->readBlob($row['calendardata']),
1268
-			'component' => strtolower($row['componenttype']),
1269
-			'classification' => (int)$row['classification'],
1270
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'],
1271
-		];
1272
-	}
1273
-
1274
-	/**
1275
-	 * Returns a list of calendar objects.
1276
-	 *
1277
-	 * This method should work identical to getCalendarObject, but instead
1278
-	 * return all the calendar objects in the list as an array.
1279
-	 *
1280
-	 * If the backend supports this, it may allow for some speed-ups.
1281
-	 *
1282
-	 * @param mixed $calendarId
1283
-	 * @param string[] $uris
1284
-	 * @param int $calendarType
1285
-	 * @return array
1286
-	 */
1287
-	public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1288
-		if (empty($uris)) {
1289
-			return [];
1290
-		}
1291
-
1292
-		$chunks = array_chunk($uris, 100);
1293
-		$objects = [];
1294
-
1295
-		$query = $this->db->getQueryBuilder();
1296
-		$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
1297
-			->from('calendarobjects')
1298
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1299
-			->andWhere($query->expr()->in('uri', $query->createParameter('uri')))
1300
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1301
-			->andWhere($query->expr()->isNull('deleted_at'));
1302
-
1303
-		foreach ($chunks as $uris) {
1304
-			$query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY);
1305
-			$result = $query->executeQuery();
1306
-
1307
-			while ($row = $result->fetch()) {
1308
-				$objects[] = [
1309
-					'id' => $row['id'],
1310
-					'uri' => $row['uri'],
1311
-					'lastmodified' => $row['lastmodified'],
1312
-					'etag' => '"' . $row['etag'] . '"',
1313
-					'calendarid' => $row['calendarid'],
1314
-					'size' => (int)$row['size'],
1315
-					'calendardata' => $this->readBlob($row['calendardata']),
1316
-					'component' => strtolower($row['componenttype']),
1317
-					'classification' => (int)$row['classification']
1318
-				];
1319
-			}
1320
-			$result->closeCursor();
1321
-		}
1322
-
1323
-		return $objects;
1324
-	}
1325
-
1326
-	/**
1327
-	 * Creates a new calendar object.
1328
-	 *
1329
-	 * The object uri is only the basename, or filename and not a full path.
1330
-	 *
1331
-	 * It is possible return an etag from this function, which will be used in
1332
-	 * the response to this PUT request. Note that the ETag must be surrounded
1333
-	 * by double-quotes.
1334
-	 *
1335
-	 * However, you should only really return this ETag if you don't mangle the
1336
-	 * calendar-data. If the result of a subsequent GET to this object is not
1337
-	 * the exact same as this request body, you should omit the ETag.
1338
-	 *
1339
-	 * @param mixed $calendarId
1340
-	 * @param string $objectUri
1341
-	 * @param string $calendarData
1342
-	 * @param int $calendarType
1343
-	 * @return string
1344
-	 */
1345
-	public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1346
-		$this->cachedObjects = [];
1347
-		$extraData = $this->getDenormalizedData($calendarData);
1348
-
1349
-		return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) {
1350
-			// Try to detect duplicates
1351
-			$qb = $this->db->getQueryBuilder();
1352
-			$qb->select($qb->func()->count('*'))
1353
-				->from('calendarobjects')
1354
-				->where($qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)))
1355
-				->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($extraData['uid'])))
1356
-				->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)))
1357
-				->andWhere($qb->expr()->isNull('deleted_at'));
1358
-			$result = $qb->executeQuery();
1359
-			$count = (int)$result->fetchOne();
1360
-			$result->closeCursor();
1361
-
1362
-			if ($count !== 0) {
1363
-				throw new BadRequest('Calendar object with uid already exists in this calendar collection.');
1364
-			}
1365
-			// For a more specific error message we also try to explicitly look up the UID but as a deleted entry
1366
-			$qbDel = $this->db->getQueryBuilder();
1367
-			$qbDel->select('*')
1368
-				->from('calendarobjects')
1369
-				->where($qbDel->expr()->eq('calendarid', $qbDel->createNamedParameter($calendarId)))
1370
-				->andWhere($qbDel->expr()->eq('uid', $qbDel->createNamedParameter($extraData['uid'])))
1371
-				->andWhere($qbDel->expr()->eq('calendartype', $qbDel->createNamedParameter($calendarType)))
1372
-				->andWhere($qbDel->expr()->isNotNull('deleted_at'));
1373
-			$result = $qbDel->executeQuery();
1374
-			$found = $result->fetch();
1375
-			$result->closeCursor();
1376
-			if ($found !== false) {
1377
-				// the object existed previously but has been deleted
1378
-				// remove the trashbin entry and continue as if it was a new object
1379
-				$this->deleteCalendarObject($calendarId, $found['uri']);
1380
-			}
1381
-
1382
-			$query = $this->db->getQueryBuilder();
1383
-			$query->insert('calendarobjects')
1384
-				->values([
1385
-					'calendarid' => $query->createNamedParameter($calendarId),
1386
-					'uri' => $query->createNamedParameter($objectUri),
1387
-					'calendardata' => $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB),
1388
-					'lastmodified' => $query->createNamedParameter(time()),
1389
-					'etag' => $query->createNamedParameter($extraData['etag']),
1390
-					'size' => $query->createNamedParameter($extraData['size']),
1391
-					'componenttype' => $query->createNamedParameter($extraData['componentType']),
1392
-					'firstoccurence' => $query->createNamedParameter($extraData['firstOccurence']),
1393
-					'lastoccurence' => $query->createNamedParameter($extraData['lastOccurence']),
1394
-					'classification' => $query->createNamedParameter($extraData['classification']),
1395
-					'uid' => $query->createNamedParameter($extraData['uid']),
1396
-					'calendartype' => $query->createNamedParameter($calendarType),
1397
-				])
1398
-				->executeStatement();
1399
-
1400
-			$this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
1401
-			$this->addChanges($calendarId, [$objectUri], 1, $calendarType);
1402
-
1403
-			$objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1404
-			assert($objectRow !== null);
1405
-
1406
-			if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1407
-				$calendarRow = $this->getCalendarById($calendarId);
1408
-				$shares = $this->getShares($calendarId);
1409
-
1410
-				$this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent($calendarId, $calendarRow, $shares, $objectRow));
1411
-			} else {
1412
-				$subscriptionRow = $this->getSubscriptionById($calendarId);
1413
-
1414
-				$this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent($calendarId, $subscriptionRow, [], $objectRow));
1415
-			}
1416
-
1417
-			return '"' . $extraData['etag'] . '"';
1418
-		}, $this->db);
1419
-	}
1420
-
1421
-	/**
1422
-	 * Updates an existing calendarobject, based on it's uri.
1423
-	 *
1424
-	 * The object uri is only the basename, or filename and not a full path.
1425
-	 *
1426
-	 * It is possible return an etag from this function, which will be used in
1427
-	 * the response to this PUT request. Note that the ETag must be surrounded
1428
-	 * by double-quotes.
1429
-	 *
1430
-	 * However, you should only really return this ETag if you don't mangle the
1431
-	 * calendar-data. If the result of a subsequent GET to this object is not
1432
-	 * the exact same as this request body, you should omit the ETag.
1433
-	 *
1434
-	 * @param mixed $calendarId
1435
-	 * @param string $objectUri
1436
-	 * @param string $calendarData
1437
-	 * @param int $calendarType
1438
-	 * @return string
1439
-	 */
1440
-	public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1441
-		$this->cachedObjects = [];
1442
-		$extraData = $this->getDenormalizedData($calendarData);
1443
-
1444
-		return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) {
1445
-			$query = $this->db->getQueryBuilder();
1446
-			$query->update('calendarobjects')
1447
-				->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB))
1448
-				->set('lastmodified', $query->createNamedParameter(time()))
1449
-				->set('etag', $query->createNamedParameter($extraData['etag']))
1450
-				->set('size', $query->createNamedParameter($extraData['size']))
1451
-				->set('componenttype', $query->createNamedParameter($extraData['componentType']))
1452
-				->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence']))
1453
-				->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence']))
1454
-				->set('classification', $query->createNamedParameter($extraData['classification']))
1455
-				->set('uid', $query->createNamedParameter($extraData['uid']))
1456
-				->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1457
-				->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
1458
-				->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1459
-				->executeStatement();
1460
-
1461
-			$this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
1462
-			$this->addChanges($calendarId, [$objectUri], 2, $calendarType);
1463
-
1464
-			$objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1465
-			if (is_array($objectRow)) {
1466
-				if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1467
-					$calendarRow = $this->getCalendarById($calendarId);
1468
-					$shares = $this->getShares($calendarId);
1469
-
1470
-					$this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent($calendarId, $calendarRow, $shares, $objectRow));
1471
-				} else {
1472
-					$subscriptionRow = $this->getSubscriptionById($calendarId);
1473
-
1474
-					$this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent($calendarId, $subscriptionRow, [], $objectRow));
1475
-				}
1476
-			}
1477
-
1478
-			return '"' . $extraData['etag'] . '"';
1479
-		}, $this->db);
1480
-	}
1481
-
1482
-	/**
1483
-	 * Moves a calendar object from calendar to calendar.
1484
-	 *
1485
-	 * @param string $sourcePrincipalUri
1486
-	 * @param int $sourceObjectId
1487
-	 * @param string $targetPrincipalUri
1488
-	 * @param int $targetCalendarId
1489
-	 * @param string $tragetObjectUri
1490
-	 * @param int $calendarType
1491
-	 * @return bool
1492
-	 * @throws Exception
1493
-	 */
1494
-	public function moveCalendarObject(string $sourcePrincipalUri, int $sourceObjectId, string $targetPrincipalUri, int $targetCalendarId, string $tragetObjectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR): bool {
1495
-		$this->cachedObjects = [];
1496
-		return $this->atomic(function () use ($sourcePrincipalUri, $sourceObjectId, $targetPrincipalUri, $targetCalendarId, $tragetObjectUri, $calendarType) {
1497
-			$object = $this->getCalendarObjectById($sourcePrincipalUri, $sourceObjectId);
1498
-			if (empty($object)) {
1499
-				return false;
1500
-			}
1501
-
1502
-			$sourceCalendarId = $object['calendarid'];
1503
-			$sourceObjectUri = $object['uri'];
1504
-
1505
-			$query = $this->db->getQueryBuilder();
1506
-			$query->update('calendarobjects')
1507
-				->set('calendarid', $query->createNamedParameter($targetCalendarId, IQueryBuilder::PARAM_INT))
1508
-				->set('uri', $query->createNamedParameter($tragetObjectUri, IQueryBuilder::PARAM_STR))
1509
-				->where($query->expr()->eq('id', $query->createNamedParameter($sourceObjectId, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT))
1510
-				->executeStatement();
1511
-
1512
-			$this->purgeProperties($sourceCalendarId, $sourceObjectId);
1513
-			$this->updateProperties($targetCalendarId, $tragetObjectUri, $object['calendardata'], $calendarType);
1514
-
1515
-			$this->addChanges($sourceCalendarId, [$sourceObjectUri], 3, $calendarType);
1516
-			$this->addChanges($targetCalendarId, [$tragetObjectUri], 1, $calendarType);
1517
-
1518
-			$object = $this->getCalendarObjectById($targetPrincipalUri, $sourceObjectId);
1519
-			// Calendar Object wasn't found - possibly because it was deleted in the meantime by a different client
1520
-			if (empty($object)) {
1521
-				return false;
1522
-			}
1523
-
1524
-			$targetCalendarRow = $this->getCalendarById($targetCalendarId);
1525
-			// the calendar this event is being moved to does not exist any longer
1526
-			if (empty($targetCalendarRow)) {
1527
-				return false;
1528
-			}
1529
-
1530
-			if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1531
-				$sourceShares = $this->getShares($sourceCalendarId);
1532
-				$targetShares = $this->getShares($targetCalendarId);
1533
-				$sourceCalendarRow = $this->getCalendarById($sourceCalendarId);
1534
-				$this->dispatcher->dispatchTyped(new CalendarObjectMovedEvent($sourceCalendarId, $sourceCalendarRow, $targetCalendarId, $targetCalendarRow, $sourceShares, $targetShares, $object));
1535
-			}
1536
-			return true;
1537
-		}, $this->db);
1538
-	}
1539
-
1540
-	/**
1541
-	 * Deletes an existing calendar object.
1542
-	 *
1543
-	 * The object uri is only the basename, or filename and not a full path.
1544
-	 *
1545
-	 * @param mixed $calendarId
1546
-	 * @param string $objectUri
1547
-	 * @param int $calendarType
1548
-	 * @param bool $forceDeletePermanently
1549
-	 * @return void
1550
-	 */
1551
-	public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) {
1552
-		$this->cachedObjects = [];
1553
-		$this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void {
1554
-			$data = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1555
-
1556
-			if ($data === null) {
1557
-				// Nothing to delete
1558
-				return;
1559
-			}
1560
-
1561
-			if ($forceDeletePermanently || $this->config->getAppValue(Application::APP_ID, RetentionService::RETENTION_CONFIG_KEY) === '0') {
1562
-				$stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `uri` = ? AND `calendartype` = ?');
1563
-				$stmt->execute([$calendarId, $objectUri, $calendarType]);
1564
-
1565
-				$this->purgeProperties($calendarId, $data['id']);
1566
-
1567
-				$this->purgeObjectInvitations($data['uid']);
1568
-
1569
-				if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1570
-					$calendarRow = $this->getCalendarById($calendarId);
1571
-					$shares = $this->getShares($calendarId);
1572
-
1573
-					$this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent($calendarId, $calendarRow, $shares, $data));
1574
-				} else {
1575
-					$subscriptionRow = $this->getSubscriptionById($calendarId);
1576
-
1577
-					$this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent($calendarId, $subscriptionRow, [], $data));
1578
-				}
1579
-			} else {
1580
-				$pathInfo = pathinfo($data['uri']);
1581
-				if (!empty($pathInfo['extension'])) {
1582
-					// Append a suffix to "free" the old URI for recreation
1583
-					$newUri = sprintf(
1584
-						'%s-deleted.%s',
1585
-						$pathInfo['filename'],
1586
-						$pathInfo['extension']
1587
-					);
1588
-				} else {
1589
-					$newUri = sprintf(
1590
-						'%s-deleted',
1591
-						$pathInfo['filename']
1592
-					);
1593
-				}
1594
-
1595
-				// Try to detect conflicts before the DB does
1596
-				// As unlikely as it seems, this can happen when the user imports, then deletes, imports and deletes again
1597
-				$newObject = $this->getCalendarObject($calendarId, $newUri, $calendarType);
1598
-				if ($newObject !== null) {
1599
-					throw new Forbidden("A calendar object with URI $newUri already exists in calendar $calendarId, therefore this object can't be moved into the trashbin");
1600
-				}
1601
-
1602
-				$qb = $this->db->getQueryBuilder();
1603
-				$markObjectDeletedQuery = $qb->update('calendarobjects')
1604
-					->set('deleted_at', $qb->createNamedParameter(time(), IQueryBuilder::PARAM_INT))
1605
-					->set('uri', $qb->createNamedParameter($newUri))
1606
-					->where(
1607
-						$qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)),
1608
-						$qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT),
1609
-						$qb->expr()->eq('uri', $qb->createNamedParameter($objectUri))
1610
-					);
1611
-				$markObjectDeletedQuery->executeStatement();
1612
-
1613
-				$calendarData = $this->getCalendarById($calendarId);
1614
-				if ($calendarData !== null) {
1615
-					$this->dispatcher->dispatchTyped(
1616
-						new CalendarObjectMovedToTrashEvent(
1617
-							$calendarId,
1618
-							$calendarData,
1619
-							$this->getShares($calendarId),
1620
-							$data
1621
-						)
1622
-					);
1623
-				}
1624
-			}
1625
-
1626
-			$this->addChanges($calendarId, [$objectUri], 3, $calendarType);
1627
-		}, $this->db);
1628
-	}
1629
-
1630
-	/**
1631
-	 * @param mixed $objectData
1632
-	 *
1633
-	 * @throws Forbidden
1634
-	 */
1635
-	public function restoreCalendarObject(array $objectData): void {
1636
-		$this->cachedObjects = [];
1637
-		$this->atomic(function () use ($objectData): void {
1638
-			$id = (int)$objectData['id'];
1639
-			$restoreUri = str_replace('-deleted.ics', '.ics', $objectData['uri']);
1640
-			$targetObject = $this->getCalendarObject(
1641
-				$objectData['calendarid'],
1642
-				$restoreUri
1643
-			);
1644
-			if ($targetObject !== null) {
1645
-				throw new Forbidden("Can not restore calendar $id because a calendar object with the URI $restoreUri already exists");
1646
-			}
1647
-
1648
-			$qb = $this->db->getQueryBuilder();
1649
-			$update = $qb->update('calendarobjects')
1650
-				->set('uri', $qb->createNamedParameter($restoreUri))
1651
-				->set('deleted_at', $qb->createNamedParameter(null))
1652
-				->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
1653
-			$update->executeStatement();
1654
-
1655
-			// Make sure this change is tracked in the changes table
1656
-			$qb2 = $this->db->getQueryBuilder();
1657
-			$selectObject = $qb2->select('calendardata', 'uri', 'calendarid', 'calendartype')
1658
-				->selectAlias('componenttype', 'component')
1659
-				->from('calendarobjects')
1660
-				->where($qb2->expr()->eq('id', $qb2->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
1661
-			$result = $selectObject->executeQuery();
1662
-			$row = $result->fetch();
1663
-			$result->closeCursor();
1664
-			if ($row === false) {
1665
-				// Welp, this should possibly not have happened, but let's ignore
1666
-				return;
1667
-			}
1668
-			$this->addChanges($row['calendarid'], [$row['uri']], 1, (int)$row['calendartype']);
1669
-
1670
-			$calendarRow = $this->getCalendarById((int)$row['calendarid']);
1671
-			if ($calendarRow === null) {
1672
-				throw new RuntimeException('Calendar object data that was just written can\'t be read back. Check your database configuration.');
1673
-			}
1674
-			$this->dispatcher->dispatchTyped(
1675
-				new CalendarObjectRestoredEvent(
1676
-					(int)$objectData['calendarid'],
1677
-					$calendarRow,
1678
-					$this->getShares((int)$row['calendarid']),
1679
-					$row
1680
-				)
1681
-			);
1682
-		}, $this->db);
1683
-	}
1684
-
1685
-	/**
1686
-	 * Performs a calendar-query on the contents of this calendar.
1687
-	 *
1688
-	 * The calendar-query is defined in RFC4791 : CalDAV. Using the
1689
-	 * calendar-query it is possible for a client to request a specific set of
1690
-	 * object, based on contents of iCalendar properties, date-ranges and
1691
-	 * iCalendar component types (VTODO, VEVENT).
1692
-	 *
1693
-	 * This method should just return a list of (relative) urls that match this
1694
-	 * query.
1695
-	 *
1696
-	 * The list of filters are specified as an array. The exact array is
1697
-	 * documented by Sabre\CalDAV\CalendarQueryParser.
1698
-	 *
1699
-	 * Note that it is extremely likely that getCalendarObject for every path
1700
-	 * returned from this method will be called almost immediately after. You
1701
-	 * may want to anticipate this to speed up these requests.
1702
-	 *
1703
-	 * This method provides a default implementation, which parses *all* the
1704
-	 * iCalendar objects in the specified calendar.
1705
-	 *
1706
-	 * This default may well be good enough for personal use, and calendars
1707
-	 * that aren't very large. But if you anticipate high usage, big calendars
1708
-	 * or high loads, you are strongly advised to optimize certain paths.
1709
-	 *
1710
-	 * The best way to do so is override this method and to optimize
1711
-	 * specifically for 'common filters'.
1712
-	 *
1713
-	 * Requests that are extremely common are:
1714
-	 *   * requests for just VEVENTS
1715
-	 *   * requests for just VTODO
1716
-	 *   * requests with a time-range-filter on either VEVENT or VTODO.
1717
-	 *
1718
-	 * ..and combinations of these requests. It may not be worth it to try to
1719
-	 * handle every possible situation and just rely on the (relatively
1720
-	 * easy to use) CalendarQueryValidator to handle the rest.
1721
-	 *
1722
-	 * Note that especially time-range-filters may be difficult to parse. A
1723
-	 * time-range filter specified on a VEVENT must for instance also handle
1724
-	 * recurrence rules correctly.
1725
-	 * A good example of how to interpret all these filters can also simply
1726
-	 * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct
1727
-	 * as possible, so it gives you a good idea on what type of stuff you need
1728
-	 * to think of.
1729
-	 *
1730
-	 * @param mixed $calendarId
1731
-	 * @param array $filters
1732
-	 * @param int $calendarType
1733
-	 * @return array
1734
-	 */
1735
-	public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1736
-		$componentType = null;
1737
-		$requirePostFilter = true;
1738
-		$timeRange = null;
1739
-
1740
-		// if no filters were specified, we don't need to filter after a query
1741
-		if (!$filters['prop-filters'] && !$filters['comp-filters']) {
1742
-			$requirePostFilter = false;
1743
-		}
1744
-
1745
-		// Figuring out if there's a component filter
1746
-		if (count($filters['comp-filters']) > 0 && !$filters['comp-filters'][0]['is-not-defined']) {
1747
-			$componentType = $filters['comp-filters'][0]['name'];
1748
-
1749
-			// Checking if we need post-filters
1750
-			if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['time-range'] && !$filters['comp-filters'][0]['prop-filters']) {
1751
-				$requirePostFilter = false;
1752
-			}
1753
-			// There was a time-range filter
1754
-			if ($componentType === 'VEVENT' && isset($filters['comp-filters'][0]['time-range']) && is_array($filters['comp-filters'][0]['time-range'])) {
1755
-				$timeRange = $filters['comp-filters'][0]['time-range'];
1756
-
1757
-				// If start time OR the end time is not specified, we can do a
1758
-				// 100% accurate mysql query.
1759
-				if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && (!$timeRange['start'] || !$timeRange['end'])) {
1760
-					$requirePostFilter = false;
1761
-				}
1762
-			}
1763
-		}
1764
-		$query = $this->db->getQueryBuilder();
1765
-		$query->select(['id', 'uri', 'uid', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification', 'deleted_at'])
1766
-			->from('calendarobjects')
1767
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1768
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1769
-			->andWhere($query->expr()->isNull('deleted_at'));
1770
-
1771
-		if ($componentType) {
1772
-			$query->andWhere($query->expr()->eq('componenttype', $query->createNamedParameter($componentType)));
1773
-		}
1774
-
1775
-		if ($timeRange && $timeRange['start']) {
1776
-			$query->andWhere($query->expr()->gt('lastoccurence', $query->createNamedParameter($timeRange['start']->getTimeStamp())));
1777
-		}
1778
-		if ($timeRange && $timeRange['end']) {
1779
-			$query->andWhere($query->expr()->lt('firstoccurence', $query->createNamedParameter($timeRange['end']->getTimeStamp())));
1780
-		}
1781
-
1782
-		$stmt = $query->executeQuery();
1783
-
1784
-		$result = [];
1785
-		while ($row = $stmt->fetch()) {
1786
-			// if we leave it as a blob we can't read it both from the post filter and the rowToCalendarObject
1787
-			if (isset($row['calendardata'])) {
1788
-				$row['calendardata'] = $this->readBlob($row['calendardata']);
1789
-			}
1790
-
1791
-			if ($requirePostFilter) {
1792
-				// validateFilterForObject will parse the calendar data
1793
-				// catch parsing errors
1794
-				try {
1795
-					$matches = $this->validateFilterForObject($row, $filters);
1796
-				} catch (ParseException $ex) {
1797
-					$this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [
1798
-						'app' => 'dav',
1799
-						'exception' => $ex,
1800
-					]);
1801
-					continue;
1802
-				} catch (InvalidDataException $ex) {
1803
-					$this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [
1804
-						'app' => 'dav',
1805
-						'exception' => $ex,
1806
-					]);
1807
-					continue;
1808
-				} catch (MaxInstancesExceededException $ex) {
1809
-					$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'], [
1810
-						'app' => 'dav',
1811
-						'exception' => $ex,
1812
-					]);
1813
-					continue;
1814
-				}
1815
-
1816
-				if (!$matches) {
1817
-					continue;
1818
-				}
1819
-			}
1820
-			$result[] = $row['uri'];
1821
-			$key = $calendarId . '::' . $row['uri'] . '::' . $calendarType;
1822
-			$this->cachedObjects[$key] = $this->rowToCalendarObject($row);
1823
-		}
1824
-
1825
-		return $result;
1826
-	}
1827
-
1828
-	/**
1829
-	 * custom Nextcloud search extension for CalDAV
1830
-	 *
1831
-	 * TODO - this should optionally cover cached calendar objects as well
1832
-	 *
1833
-	 * @param string $principalUri
1834
-	 * @param array $filters
1835
-	 * @param integer|null $limit
1836
-	 * @param integer|null $offset
1837
-	 * @return array
1838
-	 */
1839
-	public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) {
1840
-		return $this->atomic(function () use ($principalUri, $filters, $limit, $offset) {
1841
-			$calendars = $this->getCalendarsForUser($principalUri);
1842
-			$ownCalendars = [];
1843
-			$sharedCalendars = [];
1844
-
1845
-			$uriMapper = [];
1846
-
1847
-			foreach ($calendars as $calendar) {
1848
-				if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) {
1849
-					$ownCalendars[] = $calendar['id'];
1850
-				} else {
1851
-					$sharedCalendars[] = $calendar['id'];
1852
-				}
1853
-				$uriMapper[$calendar['id']] = $calendar['uri'];
1854
-			}
1855
-			if (count($ownCalendars) === 0 && count($sharedCalendars) === 0) {
1856
-				return [];
1857
-			}
1858
-
1859
-			$query = $this->db->getQueryBuilder();
1860
-			// Calendar id expressions
1861
-			$calendarExpressions = [];
1862
-			foreach ($ownCalendars as $id) {
1863
-				$calendarExpressions[] = $query->expr()->andX(
1864
-					$query->expr()->eq('c.calendarid',
1865
-						$query->createNamedParameter($id)),
1866
-					$query->expr()->eq('c.calendartype',
1867
-						$query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1868
-			}
1869
-			foreach ($sharedCalendars as $id) {
1870
-				$calendarExpressions[] = $query->expr()->andX(
1871
-					$query->expr()->eq('c.calendarid',
1872
-						$query->createNamedParameter($id)),
1873
-					$query->expr()->eq('c.classification',
1874
-						$query->createNamedParameter(self::CLASSIFICATION_PUBLIC)),
1875
-					$query->expr()->eq('c.calendartype',
1876
-						$query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1877
-			}
1878
-
1879
-			if (count($calendarExpressions) === 1) {
1880
-				$calExpr = $calendarExpressions[0];
1881
-			} else {
1882
-				$calExpr = call_user_func_array([$query->expr(), 'orX'], $calendarExpressions);
1883
-			}
1884
-
1885
-			// Component expressions
1886
-			$compExpressions = [];
1887
-			foreach ($filters['comps'] as $comp) {
1888
-				$compExpressions[] = $query->expr()
1889
-					->eq('c.componenttype', $query->createNamedParameter($comp));
1890
-			}
1891
-
1892
-			if (count($compExpressions) === 1) {
1893
-				$compExpr = $compExpressions[0];
1894
-			} else {
1895
-				$compExpr = call_user_func_array([$query->expr(), 'orX'], $compExpressions);
1896
-			}
1897
-
1898
-			if (!isset($filters['props'])) {
1899
-				$filters['props'] = [];
1900
-			}
1901
-			if (!isset($filters['params'])) {
1902
-				$filters['params'] = [];
1903
-			}
1904
-
1905
-			$propParamExpressions = [];
1906
-			foreach ($filters['props'] as $prop) {
1907
-				$propParamExpressions[] = $query->expr()->andX(
1908
-					$query->expr()->eq('i.name', $query->createNamedParameter($prop)),
1909
-					$query->expr()->isNull('i.parameter')
1910
-				);
1911
-			}
1912
-			foreach ($filters['params'] as $param) {
1913
-				$propParamExpressions[] = $query->expr()->andX(
1914
-					$query->expr()->eq('i.name', $query->createNamedParameter($param['property'])),
1915
-					$query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter']))
1916
-				);
1917
-			}
1918
-
1919
-			if (count($propParamExpressions) === 1) {
1920
-				$propParamExpr = $propParamExpressions[0];
1921
-			} else {
1922
-				$propParamExpr = call_user_func_array([$query->expr(), 'orX'], $propParamExpressions);
1923
-			}
1924
-
1925
-			$query->select(['c.calendarid', 'c.uri'])
1926
-				->from($this->dbObjectPropertiesTable, 'i')
1927
-				->join('i', 'calendarobjects', 'c', $query->expr()->eq('i.objectid', 'c.id'))
1928
-				->where($calExpr)
1929
-				->andWhere($compExpr)
1930
-				->andWhere($propParamExpr)
1931
-				->andWhere($query->expr()->iLike('i.value',
1932
-					$query->createNamedParameter('%' . $this->db->escapeLikeParameter($filters['search-term']) . '%')))
1933
-				->andWhere($query->expr()->isNull('deleted_at'));
1934
-
1935
-			if ($offset) {
1936
-				$query->setFirstResult($offset);
1937
-			}
1938
-			if ($limit) {
1939
-				$query->setMaxResults($limit);
1940
-			}
1941
-
1942
-			$stmt = $query->executeQuery();
1943
-
1944
-			$result = [];
1945
-			while ($row = $stmt->fetch()) {
1946
-				$path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
1947
-				if (!in_array($path, $result)) {
1948
-					$result[] = $path;
1949
-				}
1950
-			}
1951
-
1952
-			return $result;
1953
-		}, $this->db);
1954
-	}
1955
-
1956
-	/**
1957
-	 * used for Nextcloud's calendar API
1958
-	 *
1959
-	 * @param array $calendarInfo
1960
-	 * @param string $pattern
1961
-	 * @param array $searchProperties
1962
-	 * @param array $options
1963
-	 * @param integer|null $limit
1964
-	 * @param integer|null $offset
1965
-	 *
1966
-	 * @return array
1967
-	 */
1968
-	public function search(
1969
-		array $calendarInfo,
1970
-		$pattern,
1971
-		array $searchProperties,
1972
-		array $options,
1973
-		$limit,
1974
-		$offset,
1975
-	) {
1976
-		$outerQuery = $this->db->getQueryBuilder();
1977
-		$innerQuery = $this->db->getQueryBuilder();
1978
-
1979
-		if (isset($calendarInfo['source'])) {
1980
-			$calendarType = self::CALENDAR_TYPE_SUBSCRIPTION;
1981
-		} else {
1982
-			$calendarType = self::CALENDAR_TYPE_CALENDAR;
1983
-		}
1984
-
1985
-		$innerQuery->selectDistinct('op.objectid')
1986
-			->from($this->dbObjectPropertiesTable, 'op')
1987
-			->andWhere($innerQuery->expr()->eq('op.calendarid',
1988
-				$outerQuery->createNamedParameter($calendarInfo['id'])))
1989
-			->andWhere($innerQuery->expr()->eq('op.calendartype',
1990
-				$outerQuery->createNamedParameter($calendarType)));
1991
-
1992
-		$outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
1993
-			->from('calendarobjects', 'c')
1994
-			->where($outerQuery->expr()->isNull('deleted_at'));
1995
-
1996
-		// only return public items for shared calendars for now
1997
-		if (isset($calendarInfo['{http://owncloud.org/ns}owner-principal']) === false || $calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) {
1998
-			$outerQuery->andWhere($outerQuery->expr()->eq('c.classification',
1999
-				$outerQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
2000
-		}
2001
-
2002
-		if (!empty($searchProperties)) {
2003
-			$or = [];
2004
-			foreach ($searchProperties as $searchProperty) {
2005
-				$or[] = $innerQuery->expr()->eq('op.name',
2006
-					$outerQuery->createNamedParameter($searchProperty));
2007
-			}
2008
-			$innerQuery->andWhere($innerQuery->expr()->orX(...$or));
2009
-		}
2010
-
2011
-		if ($pattern !== '') {
2012
-			$innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
2013
-				$outerQuery->createNamedParameter('%'
2014
-					. $this->db->escapeLikeParameter($pattern) . '%')));
2015
-		}
2016
-
2017
-		$start = null;
2018
-		$end = null;
2019
-
2020
-		$hasLimit = is_int($limit);
2021
-		$hasTimeRange = false;
2022
-
2023
-		if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTimeInterface) {
2024
-			/** @var DateTimeInterface $start */
2025
-			$start = $options['timerange']['start'];
2026
-			$outerQuery->andWhere(
2027
-				$outerQuery->expr()->gt(
2028
-					'lastoccurence',
2029
-					$outerQuery->createNamedParameter($start->getTimestamp())
2030
-				)
2031
-			);
2032
-			$hasTimeRange = true;
2033
-		}
2034
-
2035
-		if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTimeInterface) {
2036
-			/** @var DateTimeInterface $end */
2037
-			$end = $options['timerange']['end'];
2038
-			$outerQuery->andWhere(
2039
-				$outerQuery->expr()->lt(
2040
-					'firstoccurence',
2041
-					$outerQuery->createNamedParameter($end->getTimestamp())
2042
-				)
2043
-			);
2044
-			$hasTimeRange = true;
2045
-		}
2046
-
2047
-		if (isset($options['uid'])) {
2048
-			$outerQuery->andWhere($outerQuery->expr()->eq('uid', $outerQuery->createNamedParameter($options['uid'])));
2049
-		}
2050
-
2051
-		if (!empty($options['types'])) {
2052
-			$or = [];
2053
-			foreach ($options['types'] as $type) {
2054
-				$or[] = $outerQuery->expr()->eq('componenttype',
2055
-					$outerQuery->createNamedParameter($type));
2056
-			}
2057
-			$outerQuery->andWhere($outerQuery->expr()->orX(...$or));
2058
-		}
2059
-
2060
-		$outerQuery->andWhere($outerQuery->expr()->in('c.id', $outerQuery->createFunction($innerQuery->getSQL())));
2061
-
2062
-		// Without explicit order by its undefined in which order the SQL server returns the events.
2063
-		// For the pagination with hasLimit and hasTimeRange, a stable ordering is helpful.
2064
-		$outerQuery->addOrderBy('id');
2065
-
2066
-		$offset = (int)$offset;
2067
-		$outerQuery->setFirstResult($offset);
2068
-
2069
-		$calendarObjects = [];
2070
-
2071
-		if ($hasLimit && $hasTimeRange) {
2072
-			/**
2073
-			 * Event recurrences are evaluated at runtime because the database only knows the first and last occurrence.
2074
-			 *
2075
-			 * Given, a user created 8 events with a yearly reoccurrence and two for events tomorrow.
2076
-			 * The upcoming event widget asks the CalDAV backend for 7 events within the next 14 days.
2077
-			 *
2078
-			 * If limit 7 is applied to the SQL query, we find the 7 events with a yearly reoccurrence
2079
-			 * and discard the events after evaluating the reoccurrence rules because they are not due within
2080
-			 * the next 14 days and end up with an empty result even if there are two events to show.
2081
-			 *
2082
-			 * The workaround for search requests with a limit and time range is asking for more row than requested
2083
-			 * and retrying if we have not reached the limit.
2084
-			 *
2085
-			 * 25 rows and 3 retries is entirely arbitrary.
2086
-			 */
2087
-			$maxResults = (int)max($limit, 25);
2088
-			$outerQuery->setMaxResults($maxResults);
2089
-
2090
-			for ($attempt = $objectsCount = 0; $attempt < 3 && $objectsCount < $limit; $attempt++) {
2091
-				$objectsCount = array_push($calendarObjects, ...$this->searchCalendarObjects($outerQuery, $start, $end));
2092
-				$outerQuery->setFirstResult($offset += $maxResults);
2093
-			}
2094
-
2095
-			$calendarObjects = array_slice($calendarObjects, 0, $limit, false);
2096
-		} else {
2097
-			$outerQuery->setMaxResults($limit);
2098
-			$calendarObjects = $this->searchCalendarObjects($outerQuery, $start, $end);
2099
-		}
2100
-
2101
-		$calendarObjects = array_map(function ($o) use ($options) {
2102
-			$calendarData = Reader::read($o['calendardata']);
2103
-
2104
-			// Expand recurrences if an explicit time range is requested
2105
-			if ($calendarData instanceof VCalendar
2106
-				&& isset($options['timerange']['start'], $options['timerange']['end'])) {
2107
-				$calendarData = $calendarData->expand(
2108
-					$options['timerange']['start'],
2109
-					$options['timerange']['end'],
2110
-				);
2111
-			}
2112
-
2113
-			$comps = $calendarData->getComponents();
2114
-			$objects = [];
2115
-			$timezones = [];
2116
-			foreach ($comps as $comp) {
2117
-				if ($comp instanceof VTimeZone) {
2118
-					$timezones[] = $comp;
2119
-				} else {
2120
-					$objects[] = $comp;
2121
-				}
2122
-			}
2123
-
2124
-			return [
2125
-				'id' => $o['id'],
2126
-				'type' => $o['componenttype'],
2127
-				'uid' => $o['uid'],
2128
-				'uri' => $o['uri'],
2129
-				'objects' => array_map(function ($c) {
2130
-					return $this->transformSearchData($c);
2131
-				}, $objects),
2132
-				'timezones' => array_map(function ($c) {
2133
-					return $this->transformSearchData($c);
2134
-				}, $timezones),
2135
-			];
2136
-		}, $calendarObjects);
2137
-
2138
-		usort($calendarObjects, function (array $a, array $b) {
2139
-			/** @var DateTimeImmutable $startA */
2140
-			$startA = $a['objects'][0]['DTSTART'][0] ?? new DateTimeImmutable(self::MAX_DATE);
2141
-			/** @var DateTimeImmutable $startB */
2142
-			$startB = $b['objects'][0]['DTSTART'][0] ?? new DateTimeImmutable(self::MAX_DATE);
2143
-
2144
-			return $startA->getTimestamp() <=> $startB->getTimestamp();
2145
-		});
2146
-
2147
-		return $calendarObjects;
2148
-	}
2149
-
2150
-	private function searchCalendarObjects(IQueryBuilder $query, ?DateTimeInterface $start, ?DateTimeInterface $end): array {
2151
-		$calendarObjects = [];
2152
-		$filterByTimeRange = ($start instanceof DateTimeInterface) || ($end instanceof DateTimeInterface);
2153
-
2154
-		$result = $query->executeQuery();
2155
-
2156
-		while (($row = $result->fetch()) !== false) {
2157
-			if ($filterByTimeRange === false) {
2158
-				// No filter required
2159
-				$calendarObjects[] = $row;
2160
-				continue;
2161
-			}
2162
-
2163
-			try {
2164
-				$isValid = $this->validateFilterForObject($row, [
2165
-					'name' => 'VCALENDAR',
2166
-					'comp-filters' => [
2167
-						[
2168
-							'name' => 'VEVENT',
2169
-							'comp-filters' => [],
2170
-							'prop-filters' => [],
2171
-							'is-not-defined' => false,
2172
-							'time-range' => [
2173
-								'start' => $start,
2174
-								'end' => $end,
2175
-							],
2176
-						],
2177
-					],
2178
-					'prop-filters' => [],
2179
-					'is-not-defined' => false,
2180
-					'time-range' => null,
2181
-				]);
2182
-			} catch (MaxInstancesExceededException $ex) {
2183
-				$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'], [
2184
-					'app' => 'dav',
2185
-					'exception' => $ex,
2186
-				]);
2187
-				continue;
2188
-			}
2189
-
2190
-			if (is_resource($row['calendardata'])) {
2191
-				// Put the stream back to the beginning so it can be read another time
2192
-				rewind($row['calendardata']);
2193
-			}
2194
-
2195
-			if ($isValid) {
2196
-				$calendarObjects[] = $row;
2197
-			}
2198
-		}
2199
-
2200
-		$result->closeCursor();
2201
-
2202
-		return $calendarObjects;
2203
-	}
2204
-
2205
-	/**
2206
-	 * @param Component $comp
2207
-	 * @return array
2208
-	 */
2209
-	private function transformSearchData(Component $comp) {
2210
-		$data = [];
2211
-		/** @var Component[] $subComponents */
2212
-		$subComponents = $comp->getComponents();
2213
-		/** @var Property[] $properties */
2214
-		$properties = array_filter($comp->children(), function ($c) {
2215
-			return $c instanceof Property;
2216
-		});
2217
-		$validationRules = $comp->getValidationRules();
2218
-
2219
-		foreach ($subComponents as $subComponent) {
2220
-			$name = $subComponent->name;
2221
-			if (!isset($data[$name])) {
2222
-				$data[$name] = [];
2223
-			}
2224
-			$data[$name][] = $this->transformSearchData($subComponent);
2225
-		}
2226
-
2227
-		foreach ($properties as $property) {
2228
-			$name = $property->name;
2229
-			if (!isset($validationRules[$name])) {
2230
-				$validationRules[$name] = '*';
2231
-			}
2232
-
2233
-			$rule = $validationRules[$property->name];
2234
-			if ($rule === '+' || $rule === '*') { // multiple
2235
-				if (!isset($data[$name])) {
2236
-					$data[$name] = [];
2237
-				}
2238
-
2239
-				$data[$name][] = $this->transformSearchProperty($property);
2240
-			} else { // once
2241
-				$data[$name] = $this->transformSearchProperty($property);
2242
-			}
2243
-		}
2244
-
2245
-		return $data;
2246
-	}
2247
-
2248
-	/**
2249
-	 * @param Property $prop
2250
-	 * @return array
2251
-	 */
2252
-	private function transformSearchProperty(Property $prop) {
2253
-		// No need to check Date, as it extends DateTime
2254
-		if ($prop instanceof Property\ICalendar\DateTime) {
2255
-			$value = $prop->getDateTime();
2256
-		} else {
2257
-			$value = $prop->getValue();
2258
-		}
2259
-
2260
-		return [
2261
-			$value,
2262
-			$prop->parameters()
2263
-		];
2264
-	}
2265
-
2266
-	/**
2267
-	 * @param string $principalUri
2268
-	 * @param string $pattern
2269
-	 * @param array $componentTypes
2270
-	 * @param array $searchProperties
2271
-	 * @param array $searchParameters
2272
-	 * @param array $options
2273
-	 * @return array
2274
-	 */
2275
-	public function searchPrincipalUri(string $principalUri,
2276
-		string $pattern,
2277
-		array $componentTypes,
2278
-		array $searchProperties,
2279
-		array $searchParameters,
2280
-		array $options = [],
2281
-	): array {
2282
-		return $this->atomic(function () use ($principalUri, $pattern, $componentTypes, $searchProperties, $searchParameters, $options) {
2283
-			$escapePattern = !\array_key_exists('escape_like_param', $options) || $options['escape_like_param'] !== false;
2284
-
2285
-			$calendarObjectIdQuery = $this->db->getQueryBuilder();
2286
-			$calendarOr = [];
2287
-			$searchOr = [];
2288
-
2289
-			// Fetch calendars and subscription
2290
-			$calendars = $this->getCalendarsForUser($principalUri);
2291
-			$subscriptions = $this->getSubscriptionsForUser($principalUri);
2292
-			foreach ($calendars as $calendar) {
2293
-				$calendarAnd = $calendarObjectIdQuery->expr()->andX(
2294
-					$calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])),
2295
-					$calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)),
2296
-				);
2297
-
2298
-				// If it's shared, limit search to public events
2299
-				if (isset($calendar['{http://owncloud.org/ns}owner-principal'])
2300
-					&& $calendar['principaluri'] !== $calendar['{http://owncloud.org/ns}owner-principal']) {
2301
-					$calendarAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
2302
-				}
2303
-
2304
-				$calendarOr[] = $calendarAnd;
2305
-			}
2306
-			foreach ($subscriptions as $subscription) {
2307
-				$subscriptionAnd = $calendarObjectIdQuery->expr()->andX(
2308
-					$calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])),
2309
-					$calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)),
2310
-				);
2311
-
2312
-				// If it's shared, limit search to public events
2313
-				if (isset($subscription['{http://owncloud.org/ns}owner-principal'])
2314
-					&& $subscription['principaluri'] !== $subscription['{http://owncloud.org/ns}owner-principal']) {
2315
-					$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
2316
-				}
2317
-
2318
-				$calendarOr[] = $subscriptionAnd;
2319
-			}
2320
-
2321
-			foreach ($searchProperties as $property) {
2322
-				$propertyAnd = $calendarObjectIdQuery->expr()->andX(
2323
-					$calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR)),
2324
-					$calendarObjectIdQuery->expr()->isNull('cob.parameter'),
2325
-				);
2326
-
2327
-				$searchOr[] = $propertyAnd;
2328
-			}
2329
-			foreach ($searchParameters as $property => $parameter) {
2330
-				$parameterAnd = $calendarObjectIdQuery->expr()->andX(
2331
-					$calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR)),
2332
-					$calendarObjectIdQuery->expr()->eq('cob.parameter', $calendarObjectIdQuery->createNamedParameter($parameter, IQueryBuilder::PARAM_STR_ARRAY)),
2333
-				);
2334
-
2335
-				$searchOr[] = $parameterAnd;
2336
-			}
2337
-
2338
-			if (empty($calendarOr)) {
2339
-				return [];
2340
-			}
2341
-			if (empty($searchOr)) {
2342
-				return [];
2343
-			}
2344
-
2345
-			$calendarObjectIdQuery->selectDistinct('cob.objectid')
2346
-				->from($this->dbObjectPropertiesTable, 'cob')
2347
-				->leftJoin('cob', 'calendarobjects', 'co', $calendarObjectIdQuery->expr()->eq('co.id', 'cob.objectid'))
2348
-				->andWhere($calendarObjectIdQuery->expr()->in('co.componenttype', $calendarObjectIdQuery->createNamedParameter($componentTypes, IQueryBuilder::PARAM_STR_ARRAY)))
2349
-				->andWhere($calendarObjectIdQuery->expr()->orX(...$calendarOr))
2350
-				->andWhere($calendarObjectIdQuery->expr()->orX(...$searchOr))
2351
-				->andWhere($calendarObjectIdQuery->expr()->isNull('deleted_at'));
2352
-
2353
-			if ($pattern !== '') {
2354
-				if (!$escapePattern) {
2355
-					$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern)));
2356
-				} else {
2357
-					$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
2358
-				}
2359
-			}
2360
-
2361
-			if (isset($options['limit'])) {
2362
-				$calendarObjectIdQuery->setMaxResults($options['limit']);
2363
-			}
2364
-			if (isset($options['offset'])) {
2365
-				$calendarObjectIdQuery->setFirstResult($options['offset']);
2366
-			}
2367
-			if (isset($options['timerange'])) {
2368
-				if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTimeInterface) {
2369
-					$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->gt(
2370
-						'lastoccurence',
2371
-						$calendarObjectIdQuery->createNamedParameter($options['timerange']['start']->getTimeStamp()),
2372
-					));
2373
-				}
2374
-				if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTimeInterface) {
2375
-					$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->lt(
2376
-						'firstoccurence',
2377
-						$calendarObjectIdQuery->createNamedParameter($options['timerange']['end']->getTimeStamp()),
2378
-					));
2379
-				}
2380
-			}
2381
-
2382
-			$result = $calendarObjectIdQuery->executeQuery();
2383
-			$matches = [];
2384
-			while (($row = $result->fetch()) !== false) {
2385
-				$matches[] = (int)$row['objectid'];
2386
-			}
2387
-			$result->closeCursor();
2388
-
2389
-			$query = $this->db->getQueryBuilder();
2390
-			$query->select('calendardata', 'uri', 'calendarid', 'calendartype')
2391
-				->from('calendarobjects')
2392
-				->where($query->expr()->in('id', $query->createNamedParameter($matches, IQueryBuilder::PARAM_INT_ARRAY)));
2393
-
2394
-			$result = $query->executeQuery();
2395
-			$calendarObjects = [];
2396
-			while (($array = $result->fetch()) !== false) {
2397
-				$array['calendarid'] = (int)$array['calendarid'];
2398
-				$array['calendartype'] = (int)$array['calendartype'];
2399
-				$array['calendardata'] = $this->readBlob($array['calendardata']);
2400
-
2401
-				$calendarObjects[] = $array;
2402
-			}
2403
-			$result->closeCursor();
2404
-			return $calendarObjects;
2405
-		}, $this->db);
2406
-	}
2407
-
2408
-	/**
2409
-	 * Searches through all of a users calendars and calendar objects to find
2410
-	 * an object with a specific UID.
2411
-	 *
2412
-	 * This method should return the path to this object, relative to the
2413
-	 * calendar home, so this path usually only contains two parts:
2414
-	 *
2415
-	 * calendarpath/objectpath.ics
2416
-	 *
2417
-	 * If the uid is not found, return null.
2418
-	 *
2419
-	 * This method should only consider * objects that the principal owns, so
2420
-	 * any calendars owned by other principals that also appear in this
2421
-	 * collection should be ignored.
2422
-	 *
2423
-	 * @param string $principalUri
2424
-	 * @param string $uid
2425
-	 * @return string|null
2426
-	 */
2427
-	public function getCalendarObjectByUID($principalUri, $uid, $calendarUri = null) {
2428
-		$query = $this->db->getQueryBuilder();
2429
-		$query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi')
2430
-			->from('calendarobjects', 'co')
2431
-			->leftJoin('co', 'calendars', 'c', $query->expr()->eq('co.calendarid', 'c.id'))
2432
-			->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri)))
2433
-			->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid)))
2434
-			->andWhere($query->expr()->isNull('co.deleted_at'));
2435
-
2436
-		if ($calendarUri !== null) {
2437
-			$query->andWhere($query->expr()->eq('c.uri', $query->createNamedParameter($calendarUri)));
2438
-		}
2439
-
2440
-		$stmt = $query->executeQuery();
2441
-		$row = $stmt->fetch();
2442
-		$stmt->closeCursor();
2443
-		if ($row) {
2444
-			return $row['calendaruri'] . '/' . $row['objecturi'];
2445
-		}
2446
-
2447
-		return null;
2448
-	}
2449
-
2450
-	public function getCalendarObjectById(string $principalUri, int $id): ?array {
2451
-		$query = $this->db->getQueryBuilder();
2452
-		$query->select(['co.id', 'co.uri', 'co.lastmodified', 'co.etag', 'co.calendarid', 'co.size', 'co.calendardata', 'co.componenttype', 'co.classification', 'co.deleted_at'])
2453
-			->selectAlias('c.uri', 'calendaruri')
2454
-			->from('calendarobjects', 'co')
2455
-			->join('co', 'calendars', 'c', $query->expr()->eq('c.id', 'co.calendarid', IQueryBuilder::PARAM_INT))
2456
-			->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri)))
2457
-			->andWhere($query->expr()->eq('co.id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
2458
-		$stmt = $query->executeQuery();
2459
-		$row = $stmt->fetch();
2460
-		$stmt->closeCursor();
2461
-
2462
-		if (!$row) {
2463
-			return null;
2464
-		}
2465
-
2466
-		return [
2467
-			'id' => $row['id'],
2468
-			'uri' => $row['uri'],
2469
-			'lastmodified' => $row['lastmodified'],
2470
-			'etag' => '"' . $row['etag'] . '"',
2471
-			'calendarid' => $row['calendarid'],
2472
-			'calendaruri' => $row['calendaruri'],
2473
-			'size' => (int)$row['size'],
2474
-			'calendardata' => $this->readBlob($row['calendardata']),
2475
-			'component' => strtolower($row['componenttype']),
2476
-			'classification' => (int)$row['classification'],
2477
-			'deleted_at' => isset($row['deleted_at']) ? ((int)$row['deleted_at']) : null,
2478
-		];
2479
-	}
2480
-
2481
-	/**
2482
-	 * The getChanges method returns all the changes that have happened, since
2483
-	 * the specified syncToken in the specified calendar.
2484
-	 *
2485
-	 * This function should return an array, such as the following:
2486
-	 *
2487
-	 * [
2488
-	 *   'syncToken' => 'The current synctoken',
2489
-	 *   'added'   => [
2490
-	 *      'new.txt',
2491
-	 *   ],
2492
-	 *   'modified'   => [
2493
-	 *      'modified.txt',
2494
-	 *   ],
2495
-	 *   'deleted' => [
2496
-	 *      'foo.php.bak',
2497
-	 *      'old.txt'
2498
-	 *   ]
2499
-	 * );
2500
-	 *
2501
-	 * The returned syncToken property should reflect the *current* syncToken
2502
-	 * of the calendar, as reported in the {http://sabredav.org/ns}sync-token
2503
-	 * property This is * needed here too, to ensure the operation is atomic.
2504
-	 *
2505
-	 * If the $syncToken argument is specified as null, this is an initial
2506
-	 * sync, and all members should be reported.
2507
-	 *
2508
-	 * The modified property is an array of nodenames that have changed since
2509
-	 * the last token.
2510
-	 *
2511
-	 * The deleted property is an array with nodenames, that have been deleted
2512
-	 * from collection.
2513
-	 *
2514
-	 * The $syncLevel argument is basically the 'depth' of the report. If it's
2515
-	 * 1, you only have to report changes that happened only directly in
2516
-	 * immediate descendants. If it's 2, it should also include changes from
2517
-	 * the nodes below the child collections. (grandchildren)
2518
-	 *
2519
-	 * The $limit argument allows a client to specify how many results should
2520
-	 * be returned at most. If the limit is not specified, it should be treated
2521
-	 * as infinite.
2522
-	 *
2523
-	 * If the limit (infinite or not) is higher than you're willing to return,
2524
-	 * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception.
2525
-	 *
2526
-	 * If the syncToken is expired (due to data cleanup) or unknown, you must
2527
-	 * return null.
2528
-	 *
2529
-	 * The limit is 'suggestive'. You are free to ignore it.
2530
-	 *
2531
-	 * @param string $calendarId
2532
-	 * @param string $syncToken
2533
-	 * @param int $syncLevel
2534
-	 * @param int|null $limit
2535
-	 * @param int $calendarType
2536
-	 * @return ?array
2537
-	 */
2538
-	public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2539
-		$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
2540
-
2541
-		return $this->atomic(function () use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType, $table) {
2542
-			// Current synctoken
2543
-			$qb = $this->db->getQueryBuilder();
2544
-			$qb->select('synctoken')
2545
-				->from($table)
2546
-				->where(
2547
-					$qb->expr()->eq('id', $qb->createNamedParameter($calendarId))
2548
-				);
2549
-			$stmt = $qb->executeQuery();
2550
-			$currentToken = $stmt->fetchOne();
2551
-			$initialSync = !is_numeric($syncToken);
2552
-
2553
-			if ($currentToken === false) {
2554
-				return null;
2555
-			}
2556
-
2557
-			// evaluate if this is a initial sync and construct appropriate command
2558
-			if ($initialSync) {
2559
-				$qb = $this->db->getQueryBuilder();
2560
-				$qb->select('uri')
2561
-					->from('calendarobjects')
2562
-					->where($qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)))
2563
-					->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)))
2564
-					->andWhere($qb->expr()->isNull('deleted_at'));
2565
-			} else {
2566
-				$qb = $this->db->getQueryBuilder();
2567
-				$qb->select('uri', $qb->func()->max('operation'))
2568
-					->from('calendarchanges')
2569
-					->where($qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)))
2570
-					->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)))
2571
-					->andWhere($qb->expr()->gte('synctoken', $qb->createNamedParameter($syncToken)))
2572
-					->andWhere($qb->expr()->lt('synctoken', $qb->createNamedParameter($currentToken)))
2573
-					->groupBy('uri');
2574
-			}
2575
-			// evaluate if limit exists
2576
-			if (is_numeric($limit)) {
2577
-				$qb->setMaxResults($limit);
2578
-			}
2579
-			// execute command
2580
-			$stmt = $qb->executeQuery();
2581
-			// build results
2582
-			$result = ['syncToken' => $currentToken, 'added' => [], 'modified' => [], 'deleted' => []];
2583
-			// retrieve results
2584
-			if ($initialSync) {
2585
-				$result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
2586
-			} else {
2587
-				// \PDO::FETCH_NUM is needed due to the inconsistent field names
2588
-				// produced by doctrine for MAX() with different databases
2589
-				while ($entry = $stmt->fetch(\PDO::FETCH_NUM)) {
2590
-					// assign uri (column 0) to appropriate mutation based on operation (column 1)
2591
-					// forced (int) is needed as doctrine with OCI returns the operation field as string not integer
2592
-					match ((int)$entry[1]) {
2593
-						1 => $result['added'][] = $entry[0],
2594
-						2 => $result['modified'][] = $entry[0],
2595
-						3 => $result['deleted'][] = $entry[0],
2596
-						default => $this->logger->debug('Unknown calendar change operation detected')
2597
-					};
2598
-				}
2599
-			}
2600
-			$stmt->closeCursor();
2601
-
2602
-			return $result;
2603
-		}, $this->db);
2604
-	}
2605
-
2606
-	/**
2607
-	 * Returns a list of subscriptions for a principal.
2608
-	 *
2609
-	 * Every subscription is an array with the following keys:
2610
-	 *  * id, a unique id that will be used by other functions to modify the
2611
-	 *    subscription. This can be the same as the uri or a database key.
2612
-	 *  * uri. This is just the 'base uri' or 'filename' of the subscription.
2613
-	 *  * principaluri. The owner of the subscription. Almost always the same as
2614
-	 *    principalUri passed to this method.
2615
-	 *
2616
-	 * Furthermore, all the subscription info must be returned too:
2617
-	 *
2618
-	 * 1. {DAV:}displayname
2619
-	 * 2. {http://apple.com/ns/ical/}refreshrate
2620
-	 * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos
2621
-	 *    should not be stripped).
2622
-	 * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms
2623
-	 *    should not be stripped).
2624
-	 * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if
2625
-	 *    attachments should not be stripped).
2626
-	 * 6. {http://calendarserver.org/ns/}source (Must be a
2627
-	 *     Sabre\DAV\Property\Href).
2628
-	 * 7. {http://apple.com/ns/ical/}calendar-color
2629
-	 * 8. {http://apple.com/ns/ical/}calendar-order
2630
-	 * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
2631
-	 *    (should just be an instance of
2632
-	 *    Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of
2633
-	 *    default components).
2634
-	 *
2635
-	 * @param string $principalUri
2636
-	 * @return array
2637
-	 */
2638
-	public function getSubscriptionsForUser($principalUri) {
2639
-		$fields = array_column($this->subscriptionPropertyMap, 0);
2640
-		$fields[] = 'id';
2641
-		$fields[] = 'uri';
2642
-		$fields[] = 'source';
2643
-		$fields[] = 'principaluri';
2644
-		$fields[] = 'lastmodified';
2645
-		$fields[] = 'synctoken';
2646
-
2647
-		$query = $this->db->getQueryBuilder();
2648
-		$query->select($fields)
2649
-			->from('calendarsubscriptions')
2650
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2651
-			->orderBy('calendarorder', 'asc');
2652
-		$stmt = $query->executeQuery();
2653
-
2654
-		$subscriptions = [];
2655
-		while ($row = $stmt->fetch()) {
2656
-			$subscription = [
2657
-				'id' => $row['id'],
2658
-				'uri' => $row['uri'],
2659
-				'principaluri' => $row['principaluri'],
2660
-				'source' => $row['source'],
2661
-				'lastmodified' => $row['lastmodified'],
2662
-
2663
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
2664
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
2665
-			];
2666
-
2667
-			$subscriptions[] = $this->rowToSubscription($row, $subscription);
2668
-		}
2669
-
2670
-		return $subscriptions;
2671
-	}
2672
-
2673
-	/**
2674
-	 * Creates a new subscription for a principal.
2675
-	 *
2676
-	 * If the creation was a success, an id must be returned that can be used to reference
2677
-	 * this subscription in other methods, such as updateSubscription.
2678
-	 *
2679
-	 * @param string $principalUri
2680
-	 * @param string $uri
2681
-	 * @param array $properties
2682
-	 * @return mixed
2683
-	 */
2684
-	public function createSubscription($principalUri, $uri, array $properties) {
2685
-		if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
2686
-			throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
2687
-		}
2688
-
2689
-		$values = [
2690
-			'principaluri' => $principalUri,
2691
-			'uri' => $uri,
2692
-			'source' => $properties['{http://calendarserver.org/ns/}source']->getHref(),
2693
-			'lastmodified' => time(),
2694
-		];
2695
-
2696
-		$propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
2697
-
2698
-		foreach ($this->subscriptionPropertyMap as $xmlName => [$dbName, $type]) {
2699
-			if (array_key_exists($xmlName, $properties)) {
2700
-				$values[$dbName] = $properties[$xmlName];
2701
-				if (in_array($dbName, $propertiesBoolean)) {
2702
-					$values[$dbName] = true;
2703
-				}
2704
-			}
2705
-		}
2706
-
2707
-		[$subscriptionId, $subscriptionRow] = $this->atomic(function () use ($values) {
2708
-			$valuesToInsert = [];
2709
-			$query = $this->db->getQueryBuilder();
2710
-			foreach (array_keys($values) as $name) {
2711
-				$valuesToInsert[$name] = $query->createNamedParameter($values[$name]);
2712
-			}
2713
-			$query->insert('calendarsubscriptions')
2714
-				->values($valuesToInsert)
2715
-				->executeStatement();
2716
-
2717
-			$subscriptionId = $query->getLastInsertId();
2718
-
2719
-			$subscriptionRow = $this->getSubscriptionById($subscriptionId);
2720
-			return [$subscriptionId, $subscriptionRow];
2721
-		}, $this->db);
2722
-
2723
-		$this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent($subscriptionId, $subscriptionRow));
2724
-
2725
-		return $subscriptionId;
2726
-	}
2727
-
2728
-	/**
2729
-	 * Updates a subscription
2730
-	 *
2731
-	 * The list of mutations is stored in a Sabre\DAV\PropPatch object.
2732
-	 * To do the actual updates, you must tell this object which properties
2733
-	 * you're going to process with the handle() method.
2734
-	 *
2735
-	 * Calling the handle method is like telling the PropPatch object "I
2736
-	 * promise I can handle updating this property".
2737
-	 *
2738
-	 * Read the PropPatch documentation for more info and examples.
2739
-	 *
2740
-	 * @param mixed $subscriptionId
2741
-	 * @param PropPatch $propPatch
2742
-	 * @return void
2743
-	 */
2744
-	public function updateSubscription($subscriptionId, PropPatch $propPatch) {
2745
-		$supportedProperties = array_keys($this->subscriptionPropertyMap);
2746
-		$supportedProperties[] = '{http://calendarserver.org/ns/}source';
2747
-
2748
-		$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
2749
-			$newValues = [];
2750
-
2751
-			foreach ($mutations as $propertyName => $propertyValue) {
2752
-				if ($propertyName === '{http://calendarserver.org/ns/}source') {
2753
-					$newValues['source'] = $propertyValue->getHref();
2754
-				} else {
2755
-					$fieldName = $this->subscriptionPropertyMap[$propertyName][0];
2756
-					$newValues[$fieldName] = $propertyValue;
2757
-				}
2758
-			}
2759
-
2760
-			$subscriptionRow = $this->atomic(function () use ($subscriptionId, $newValues) {
2761
-				$query = $this->db->getQueryBuilder();
2762
-				$query->update('calendarsubscriptions')
2763
-					->set('lastmodified', $query->createNamedParameter(time()));
2764
-				foreach ($newValues as $fieldName => $value) {
2765
-					$query->set($fieldName, $query->createNamedParameter($value));
2766
-				}
2767
-				$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
2768
-					->executeStatement();
2769
-
2770
-				return $this->getSubscriptionById($subscriptionId);
2771
-			}, $this->db);
2772
-
2773
-			$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations));
2774
-
2775
-			return true;
2776
-		});
2777
-	}
2778
-
2779
-	/**
2780
-	 * Deletes a subscription.
2781
-	 *
2782
-	 * @param mixed $subscriptionId
2783
-	 * @return void
2784
-	 */
2785
-	public function deleteSubscription($subscriptionId) {
2786
-		$this->atomic(function () use ($subscriptionId): void {
2787
-			$subscriptionRow = $this->getSubscriptionById($subscriptionId);
2788
-
2789
-			$query = $this->db->getQueryBuilder();
2790
-			$query->delete('calendarsubscriptions')
2791
-				->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
2792
-				->executeStatement();
2793
-
2794
-			$query = $this->db->getQueryBuilder();
2795
-			$query->delete('calendarobjects')
2796
-				->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2797
-				->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2798
-				->executeStatement();
2799
-
2800
-			$query->delete('calendarchanges')
2801
-				->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2802
-				->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2803
-				->executeStatement();
2804
-
2805
-			$query->delete($this->dbObjectPropertiesTable)
2806
-				->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2807
-				->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2808
-				->executeStatement();
2809
-
2810
-			if ($subscriptionRow) {
2811
-				$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, []));
2812
-			}
2813
-		}, $this->db);
2814
-	}
2815
-
2816
-	/**
2817
-	 * Returns a single scheduling object for the inbox collection.
2818
-	 *
2819
-	 * The returned array should contain the following elements:
2820
-	 *   * uri - A unique basename for the object. This will be used to
2821
-	 *           construct a full uri.
2822
-	 *   * calendardata - The iCalendar object
2823
-	 *   * lastmodified - The last modification date. Can be an int for a unix
2824
-	 *                    timestamp, or a PHP DateTime object.
2825
-	 *   * etag - A unique token that must change if the object changed.
2826
-	 *   * size - The size of the object, in bytes.
2827
-	 *
2828
-	 * @param string $principalUri
2829
-	 * @param string $objectUri
2830
-	 * @return array
2831
-	 */
2832
-	public function getSchedulingObject($principalUri, $objectUri) {
2833
-		$query = $this->db->getQueryBuilder();
2834
-		$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
2835
-			->from('schedulingobjects')
2836
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2837
-			->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
2838
-			->executeQuery();
2839
-
2840
-		$row = $stmt->fetch();
2841
-
2842
-		if (!$row) {
2843
-			return null;
2844
-		}
2845
-
2846
-		return [
2847
-			'uri' => $row['uri'],
2848
-			'calendardata' => $row['calendardata'],
2849
-			'lastmodified' => $row['lastmodified'],
2850
-			'etag' => '"' . $row['etag'] . '"',
2851
-			'size' => (int)$row['size'],
2852
-		];
2853
-	}
2854
-
2855
-	/**
2856
-	 * Returns all scheduling objects for the inbox collection.
2857
-	 *
2858
-	 * These objects should be returned as an array. Every item in the array
2859
-	 * should follow the same structure as returned from getSchedulingObject.
2860
-	 *
2861
-	 * The main difference is that 'calendardata' is optional.
2862
-	 *
2863
-	 * @param string $principalUri
2864
-	 * @return array
2865
-	 */
2866
-	public function getSchedulingObjects($principalUri) {
2867
-		$query = $this->db->getQueryBuilder();
2868
-		$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
2869
-			->from('schedulingobjects')
2870
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2871
-			->executeQuery();
2872
-
2873
-		$results = [];
2874
-		while (($row = $stmt->fetch()) !== false) {
2875
-			$results[] = [
2876
-				'calendardata' => $row['calendardata'],
2877
-				'uri' => $row['uri'],
2878
-				'lastmodified' => $row['lastmodified'],
2879
-				'etag' => '"' . $row['etag'] . '"',
2880
-				'size' => (int)$row['size'],
2881
-			];
2882
-		}
2883
-		$stmt->closeCursor();
2884
-
2885
-		return $results;
2886
-	}
2887
-
2888
-	/**
2889
-	 * Deletes a scheduling object from the inbox collection.
2890
-	 *
2891
-	 * @param string $principalUri
2892
-	 * @param string $objectUri
2893
-	 * @return void
2894
-	 */
2895
-	public function deleteSchedulingObject($principalUri, $objectUri) {
2896
-		$this->cachedObjects = [];
2897
-		$query = $this->db->getQueryBuilder();
2898
-		$query->delete('schedulingobjects')
2899
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2900
-			->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
2901
-			->executeStatement();
2902
-	}
2903
-
2904
-	/**
2905
-	 * Deletes all scheduling objects last modified before $modifiedBefore from the inbox collection.
2906
-	 *
2907
-	 * @param int $modifiedBefore
2908
-	 * @param int $limit
2909
-	 * @return void
2910
-	 */
2911
-	public function deleteOutdatedSchedulingObjects(int $modifiedBefore, int $limit): void {
2912
-		$query = $this->db->getQueryBuilder();
2913
-		$query->select('id')
2914
-			->from('schedulingobjects')
2915
-			->where($query->expr()->lt('lastmodified', $query->createNamedParameter($modifiedBefore)))
2916
-			->setMaxResults($limit);
2917
-		$result = $query->executeQuery();
2918
-		$count = $result->rowCount();
2919
-		if ($count === 0) {
2920
-			return;
2921
-		}
2922
-		$ids = array_map(static function (array $id) {
2923
-			return (int)$id[0];
2924
-		}, $result->fetchAll(\PDO::FETCH_NUM));
2925
-		$result->closeCursor();
2926
-
2927
-		$numDeleted = 0;
2928
-		$deleteQuery = $this->db->getQueryBuilder();
2929
-		$deleteQuery->delete('schedulingobjects')
2930
-			->where($deleteQuery->expr()->in('id', $deleteQuery->createParameter('ids'), IQueryBuilder::PARAM_INT_ARRAY));
2931
-		foreach (array_chunk($ids, 1000) as $chunk) {
2932
-			$deleteQuery->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY);
2933
-			$numDeleted += $deleteQuery->executeStatement();
2934
-		}
2935
-
2936
-		if ($numDeleted === $limit) {
2937
-			$this->logger->info("Deleted $limit scheduling objects, continuing with next batch");
2938
-			$this->deleteOutdatedSchedulingObjects($modifiedBefore, $limit);
2939
-		}
2940
-	}
2941
-
2942
-	/**
2943
-	 * Creates a new scheduling object. This should land in a users' inbox.
2944
-	 *
2945
-	 * @param string $principalUri
2946
-	 * @param string $objectUri
2947
-	 * @param string $objectData
2948
-	 * @return void
2949
-	 */
2950
-	public function createSchedulingObject($principalUri, $objectUri, $objectData) {
2951
-		$this->cachedObjects = [];
2952
-		$query = $this->db->getQueryBuilder();
2953
-		$query->insert('schedulingobjects')
2954
-			->values([
2955
-				'principaluri' => $query->createNamedParameter($principalUri),
2956
-				'calendardata' => $query->createNamedParameter($objectData, IQueryBuilder::PARAM_LOB),
2957
-				'uri' => $query->createNamedParameter($objectUri),
2958
-				'lastmodified' => $query->createNamedParameter(time()),
2959
-				'etag' => $query->createNamedParameter(md5($objectData)),
2960
-				'size' => $query->createNamedParameter(strlen($objectData))
2961
-			])
2962
-			->executeStatement();
2963
-	}
2964
-
2965
-	/**
2966
-	 * Adds a change record to the calendarchanges table.
2967
-	 *
2968
-	 * @param mixed $calendarId
2969
-	 * @param string[] $objectUris
2970
-	 * @param int $operation 1 = add, 2 = modify, 3 = delete.
2971
-	 * @param int $calendarType
2972
-	 * @return void
2973
-	 */
2974
-	protected function addChanges(int $calendarId, array $objectUris, int $operation, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void {
2975
-		$this->cachedObjects = [];
2976
-		$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
2977
-
2978
-		$this->atomic(function () use ($calendarId, $objectUris, $operation, $calendarType, $table): void {
2979
-			$query = $this->db->getQueryBuilder();
2980
-			$query->select('synctoken')
2981
-				->from($table)
2982
-				->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
2983
-			$result = $query->executeQuery();
2984
-			$syncToken = (int)$result->fetchOne();
2985
-			$result->closeCursor();
2986
-
2987
-			$query = $this->db->getQueryBuilder();
2988
-			$query->insert('calendarchanges')
2989
-				->values([
2990
-					'uri' => $query->createParameter('uri'),
2991
-					'synctoken' => $query->createNamedParameter($syncToken),
2992
-					'calendarid' => $query->createNamedParameter($calendarId),
2993
-					'operation' => $query->createNamedParameter($operation),
2994
-					'calendartype' => $query->createNamedParameter($calendarType),
2995
-					'created_at' => $query->createNamedParameter(time()),
2996
-				]);
2997
-			foreach ($objectUris as $uri) {
2998
-				$query->setParameter('uri', $uri);
2999
-				$query->executeStatement();
3000
-			}
3001
-
3002
-			$query = $this->db->getQueryBuilder();
3003
-			$query->update($table)
3004
-				->set('synctoken', $query->createNamedParameter($syncToken + 1, IQueryBuilder::PARAM_INT))
3005
-				->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)))
3006
-				->executeStatement();
3007
-		}, $this->db);
3008
-	}
3009
-
3010
-	public function restoreChanges(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void {
3011
-		$this->cachedObjects = [];
3012
-
3013
-		$this->atomic(function () use ($calendarId, $calendarType): void {
3014
-			$qbAdded = $this->db->getQueryBuilder();
3015
-			$qbAdded->select('uri')
3016
-				->from('calendarobjects')
3017
-				->where(
3018
-					$qbAdded->expr()->andX(
3019
-						$qbAdded->expr()->eq('calendarid', $qbAdded->createNamedParameter($calendarId)),
3020
-						$qbAdded->expr()->eq('calendartype', $qbAdded->createNamedParameter($calendarType)),
3021
-						$qbAdded->expr()->isNull('deleted_at'),
3022
-					)
3023
-				);
3024
-			$resultAdded = $qbAdded->executeQuery();
3025
-			$addedUris = $resultAdded->fetchAll(\PDO::FETCH_COLUMN);
3026
-			$resultAdded->closeCursor();
3027
-			// Track everything as changed
3028
-			// Tracking the creation is not necessary because \OCA\DAV\CalDAV\CalDavBackend::getChangesForCalendar
3029
-			// only returns the last change per object.
3030
-			$this->addChanges($calendarId, $addedUris, 2, $calendarType);
3031
-
3032
-			$qbDeleted = $this->db->getQueryBuilder();
3033
-			$qbDeleted->select('uri')
3034
-				->from('calendarobjects')
3035
-				->where(
3036
-					$qbDeleted->expr()->andX(
3037
-						$qbDeleted->expr()->eq('calendarid', $qbDeleted->createNamedParameter($calendarId)),
3038
-						$qbDeleted->expr()->eq('calendartype', $qbDeleted->createNamedParameter($calendarType)),
3039
-						$qbDeleted->expr()->isNotNull('deleted_at'),
3040
-					)
3041
-				);
3042
-			$resultDeleted = $qbDeleted->executeQuery();
3043
-			$deletedUris = array_map(function (string $uri) {
3044
-				return str_replace('-deleted.ics', '.ics', $uri);
3045
-			}, $resultDeleted->fetchAll(\PDO::FETCH_COLUMN));
3046
-			$resultDeleted->closeCursor();
3047
-			$this->addChanges($calendarId, $deletedUris, 3, $calendarType);
3048
-		}, $this->db);
3049
-	}
3050
-
3051
-	/**
3052
-	 * Parses some information from calendar objects, used for optimized
3053
-	 * calendar-queries.
3054
-	 *
3055
-	 * Returns an array with the following keys:
3056
-	 *   * etag - An md5 checksum of the object without the quotes.
3057
-	 *   * size - Size of the object in bytes
3058
-	 *   * componentType - VEVENT, VTODO or VJOURNAL
3059
-	 *   * firstOccurence
3060
-	 *   * lastOccurence
3061
-	 *   * uid - value of the UID property
3062
-	 *
3063
-	 * @param string $calendarData
3064
-	 * @return array
3065
-	 */
3066
-	public function getDenormalizedData(string $calendarData): array {
3067
-		$vObject = Reader::read($calendarData);
3068
-		$vEvents = [];
3069
-		$componentType = null;
3070
-		$component = null;
3071
-		$firstOccurrence = null;
3072
-		$lastOccurrence = null;
3073
-		$uid = null;
3074
-		$classification = self::CLASSIFICATION_PUBLIC;
3075
-		$hasDTSTART = false;
3076
-		foreach ($vObject->getComponents() as $component) {
3077
-			if ($component->name !== 'VTIMEZONE') {
3078
-				// Finding all VEVENTs, and track them
3079
-				if ($component->name === 'VEVENT') {
3080
-					$vEvents[] = $component;
3081
-					if ($component->DTSTART) {
3082
-						$hasDTSTART = true;
3083
-					}
3084
-				}
3085
-				// Track first component type and uid
3086
-				if ($uid === null) {
3087
-					$componentType = $component->name;
3088
-					$uid = (string)$component->UID;
3089
-				}
3090
-			}
3091
-		}
3092
-		if (!$componentType) {
3093
-			throw new BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');
3094
-		}
3095
-
3096
-		if ($hasDTSTART) {
3097
-			$component = $vEvents[0];
3098
-
3099
-			// Finding the last occurrence is a bit harder
3100
-			if (!isset($component->RRULE) && count($vEvents) === 1) {
3101
-				$firstOccurrence = $component->DTSTART->getDateTime()->getTimeStamp();
3102
-				if (isset($component->DTEND)) {
3103
-					$lastOccurrence = $component->DTEND->getDateTime()->getTimeStamp();
3104
-				} elseif (isset($component->DURATION)) {
3105
-					$endDate = clone $component->DTSTART->getDateTime();
3106
-					$endDate->add(DateTimeParser::parse($component->DURATION->getValue()));
3107
-					$lastOccurrence = $endDate->getTimeStamp();
3108
-				} elseif (!$component->DTSTART->hasTime()) {
3109
-					$endDate = clone $component->DTSTART->getDateTime();
3110
-					$endDate->modify('+1 day');
3111
-					$lastOccurrence = $endDate->getTimeStamp();
3112
-				} else {
3113
-					$lastOccurrence = $firstOccurrence;
3114
-				}
3115
-			} else {
3116
-				try {
3117
-					$it = new EventIterator($vEvents);
3118
-				} catch (NoInstancesException $e) {
3119
-					$this->logger->debug('Caught no instance exception for calendar data. This usually indicates invalid calendar data.', [
3120
-						'app' => 'dav',
3121
-						'exception' => $e,
3122
-					]);
3123
-					throw new Forbidden($e->getMessage());
3124
-				}
3125
-				$maxDate = new DateTime(self::MAX_DATE);
3126
-				$firstOccurrence = $it->getDtStart()->getTimestamp();
3127
-				if ($it->isInfinite()) {
3128
-					$lastOccurrence = $maxDate->getTimestamp();
3129
-				} else {
3130
-					$end = $it->getDtEnd();
3131
-					while ($it->valid() && $end < $maxDate) {
3132
-						$end = $it->getDtEnd();
3133
-						$it->next();
3134
-					}
3135
-					$lastOccurrence = $end->getTimestamp();
3136
-				}
3137
-			}
3138
-		}
3139
-
3140
-		if ($component->CLASS) {
3141
-			$classification = CalDavBackend::CLASSIFICATION_PRIVATE;
3142
-			switch ($component->CLASS->getValue()) {
3143
-				case 'PUBLIC':
3144
-					$classification = CalDavBackend::CLASSIFICATION_PUBLIC;
3145
-					break;
3146
-				case 'CONFIDENTIAL':
3147
-					$classification = CalDavBackend::CLASSIFICATION_CONFIDENTIAL;
3148
-					break;
3149
-			}
3150
-		}
3151
-		return [
3152
-			'etag' => md5($calendarData),
3153
-			'size' => strlen($calendarData),
3154
-			'componentType' => $componentType,
3155
-			'firstOccurence' => is_null($firstOccurrence) ? null : max(0, $firstOccurrence),
3156
-			'lastOccurence' => is_null($lastOccurrence) ? null : max(0, $lastOccurrence),
3157
-			'uid' => $uid,
3158
-			'classification' => $classification
3159
-		];
3160
-	}
3161
-
3162
-	/**
3163
-	 * @param $cardData
3164
-	 * @return bool|string
3165
-	 */
3166
-	private function readBlob($cardData) {
3167
-		if (is_resource($cardData)) {
3168
-			return stream_get_contents($cardData);
3169
-		}
3170
-
3171
-		return $cardData;
3172
-	}
3173
-
3174
-	/**
3175
-	 * @param list<array{href: string, commonName: string, readOnly: bool}> $add
3176
-	 * @param list<string> $remove
3177
-	 */
3178
-	public function updateShares(IShareable $shareable, array $add, array $remove): void {
3179
-		$this->atomic(function () use ($shareable, $add, $remove): void {
3180
-			$calendarId = $shareable->getResourceId();
3181
-			$calendarRow = $this->getCalendarById($calendarId);
3182
-			if ($calendarRow === null) {
3183
-				throw new \RuntimeException('Trying to update shares for non-existing calendar: ' . $calendarId);
3184
-			}
3185
-			$oldShares = $this->getShares($calendarId);
3186
-
3187
-			$this->calendarSharingBackend->updateShares($shareable, $add, $remove, $oldShares);
3188
-
3189
-			$this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent($calendarId, $calendarRow, $oldShares, $add, $remove));
3190
-		}, $this->db);
3191
-	}
3192
-
3193
-	/**
3194
-	 * @return list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}>
3195
-	 */
3196
-	public function getShares(int $resourceId): array {
3197
-		return $this->calendarSharingBackend->getShares($resourceId);
3198
-	}
3199
-
3200
-	public function preloadShares(array $resourceIds): void {
3201
-		$this->calendarSharingBackend->preloadShares($resourceIds);
3202
-	}
3203
-
3204
-	/**
3205
-	 * @param boolean $value
3206
-	 * @param Calendar $calendar
3207
-	 * @return string|null
3208
-	 */
3209
-	public function setPublishStatus($value, $calendar) {
3210
-		return $this->atomic(function () use ($value, $calendar) {
3211
-			$calendarId = $calendar->getResourceId();
3212
-			$calendarData = $this->getCalendarById($calendarId);
3213
-
3214
-			$query = $this->db->getQueryBuilder();
3215
-			if ($value) {
3216
-				$publicUri = $this->random->generate(16, ISecureRandom::CHAR_HUMAN_READABLE);
3217
-				$query->insert('dav_shares')
3218
-					->values([
3219
-						'principaluri' => $query->createNamedParameter($calendar->getPrincipalURI()),
3220
-						'type' => $query->createNamedParameter('calendar'),
3221
-						'access' => $query->createNamedParameter(self::ACCESS_PUBLIC),
3222
-						'resourceid' => $query->createNamedParameter($calendar->getResourceId()),
3223
-						'publicuri' => $query->createNamedParameter($publicUri)
3224
-					]);
3225
-				$query->executeStatement();
3226
-
3227
-				$this->dispatcher->dispatchTyped(new CalendarPublishedEvent($calendarId, $calendarData, $publicUri));
3228
-				return $publicUri;
3229
-			}
3230
-			$query->delete('dav_shares')
3231
-				->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
3232
-				->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)));
3233
-			$query->executeStatement();
3234
-
3235
-			$this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent($calendarId, $calendarData));
3236
-			return null;
3237
-		}, $this->db);
3238
-	}
3239
-
3240
-	/**
3241
-	 * @param Calendar $calendar
3242
-	 * @return mixed
3243
-	 */
3244
-	public function getPublishStatus($calendar) {
3245
-		$query = $this->db->getQueryBuilder();
3246
-		$result = $query->select('publicuri')
3247
-			->from('dav_shares')
3248
-			->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
3249
-			->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
3250
-			->executeQuery();
3251
-
3252
-		$row = $result->fetch();
3253
-		$result->closeCursor();
3254
-		return $row ? reset($row) : false;
3255
-	}
3256
-
3257
-	/**
3258
-	 * @param int $resourceId
3259
-	 * @param list<array{privilege: string, principal: string, protected: bool}> $acl
3260
-	 * @return list<array{privilege: string, principal: string, protected: bool}>
3261
-	 */
3262
-	public function applyShareAcl(int $resourceId, array $acl): array {
3263
-		$shares = $this->calendarSharingBackend->getShares($resourceId);
3264
-		return $this->calendarSharingBackend->applyShareAcl($shares, $acl);
3265
-	}
3266
-
3267
-	/**
3268
-	 * update properties table
3269
-	 *
3270
-	 * @param int $calendarId
3271
-	 * @param string $objectUri
3272
-	 * @param string $calendarData
3273
-	 * @param int $calendarType
3274
-	 */
3275
-	public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
3276
-		$this->cachedObjects = [];
3277
-		$this->atomic(function () use ($calendarId, $objectUri, $calendarData, $calendarType): void {
3278
-			$objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType);
3279
-
3280
-			try {
3281
-				$vCalendar = $this->readCalendarData($calendarData);
3282
-			} catch (\Exception $ex) {
3283
-				return;
3284
-			}
3285
-
3286
-			$this->purgeProperties($calendarId, $objectId);
3287
-
3288
-			$query = $this->db->getQueryBuilder();
3289
-			$query->insert($this->dbObjectPropertiesTable)
3290
-				->values(
3291
-					[
3292
-						'calendarid' => $query->createNamedParameter($calendarId),
3293
-						'calendartype' => $query->createNamedParameter($calendarType),
3294
-						'objectid' => $query->createNamedParameter($objectId),
3295
-						'name' => $query->createParameter('name'),
3296
-						'parameter' => $query->createParameter('parameter'),
3297
-						'value' => $query->createParameter('value'),
3298
-					]
3299
-				);
3300
-
3301
-			$indexComponents = ['VEVENT', 'VJOURNAL', 'VTODO'];
3302
-			foreach ($vCalendar->getComponents() as $component) {
3303
-				if (!in_array($component->name, $indexComponents)) {
3304
-					continue;
3305
-				}
3306
-
3307
-				foreach ($component->children() as $property) {
3308
-					if (in_array($property->name, self::INDEXED_PROPERTIES, true)) {
3309
-						$value = $property->getValue();
3310
-						// is this a shitty db?
3311
-						if (!$this->db->supports4ByteText()) {
3312
-							$value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value);
3313
-						}
3314
-						$value = mb_strcut($value, 0, 254);
3315
-
3316
-						$query->setParameter('name', $property->name);
3317
-						$query->setParameter('parameter', null);
3318
-						$query->setParameter('value', mb_strcut($value, 0, 254));
3319
-						$query->executeStatement();
3320
-					}
3321
-
3322
-					if (array_key_exists($property->name, self::$indexParameters)) {
3323
-						$parameters = $property->parameters();
3324
-						$indexedParametersForProperty = self::$indexParameters[$property->name];
3325
-
3326
-						foreach ($parameters as $key => $value) {
3327
-							if (in_array($key, $indexedParametersForProperty)) {
3328
-								// is this a shitty db?
3329
-								if ($this->db->supports4ByteText()) {
3330
-									$value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value);
3331
-								}
3332
-
3333
-								$query->setParameter('name', $property->name);
3334
-								$query->setParameter('parameter', mb_strcut($key, 0, 254));
3335
-								$query->setParameter('value', mb_strcut($value, 0, 254));
3336
-								$query->executeStatement();
3337
-							}
3338
-						}
3339
-					}
3340
-				}
3341
-			}
3342
-		}, $this->db);
3343
-	}
3344
-
3345
-	/**
3346
-	 * deletes all birthday calendars
3347
-	 */
3348
-	public function deleteAllBirthdayCalendars() {
3349
-		$this->atomic(function (): void {
3350
-			$query = $this->db->getQueryBuilder();
3351
-			$result = $query->select(['id'])->from('calendars')
3352
-				->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
3353
-				->executeQuery();
3354
-
3355
-			while (($row = $result->fetch()) !== false) {
3356
-				$this->deleteCalendar(
3357
-					$row['id'],
3358
-					true // No data to keep in the trashbin, if the user re-enables then we regenerate
3359
-				);
3360
-			}
3361
-			$result->closeCursor();
3362
-		}, $this->db);
3363
-	}
3364
-
3365
-	/**
3366
-	 * @param $subscriptionId
3367
-	 */
3368
-	public function purgeAllCachedEventsForSubscription($subscriptionId) {
3369
-		$this->atomic(function () use ($subscriptionId): void {
3370
-			$query = $this->db->getQueryBuilder();
3371
-			$query->select('uri')
3372
-				->from('calendarobjects')
3373
-				->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3374
-				->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)));
3375
-			$stmt = $query->executeQuery();
3376
-
3377
-			$uris = [];
3378
-			while (($row = $stmt->fetch()) !== false) {
3379
-				$uris[] = $row['uri'];
3380
-			}
3381
-			$stmt->closeCursor();
3382
-
3383
-			$query = $this->db->getQueryBuilder();
3384
-			$query->delete('calendarobjects')
3385
-				->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3386
-				->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3387
-				->executeStatement();
3388
-
3389
-			$query = $this->db->getQueryBuilder();
3390
-			$query->delete('calendarchanges')
3391
-				->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3392
-				->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3393
-				->executeStatement();
3394
-
3395
-			$query = $this->db->getQueryBuilder();
3396
-			$query->delete($this->dbObjectPropertiesTable)
3397
-				->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3398
-				->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3399
-				->executeStatement();
3400
-
3401
-			$this->addChanges($subscriptionId, $uris, 3, self::CALENDAR_TYPE_SUBSCRIPTION);
3402
-		}, $this->db);
3403
-	}
3404
-
3405
-	/**
3406
-	 * @param int $subscriptionId
3407
-	 * @param array<int> $calendarObjectIds
3408
-	 * @param array<string> $calendarObjectUris
3409
-	 */
3410
-	public function purgeCachedEventsForSubscription(int $subscriptionId, array $calendarObjectIds, array $calendarObjectUris): void {
3411
-		if (empty($calendarObjectUris)) {
3412
-			return;
3413
-		}
3414
-
3415
-		$this->atomic(function () use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void {
3416
-			foreach (array_chunk($calendarObjectIds, 1000) as $chunk) {
3417
-				$query = $this->db->getQueryBuilder();
3418
-				$query->delete($this->dbObjectPropertiesTable)
3419
-					->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3420
-					->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3421
-					->andWhere($query->expr()->in('id', $query->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY), IQueryBuilder::PARAM_INT_ARRAY))
3422
-					->executeStatement();
3423
-
3424
-				$query = $this->db->getQueryBuilder();
3425
-				$query->delete('calendarobjects')
3426
-					->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3427
-					->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3428
-					->andWhere($query->expr()->in('id', $query->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY), IQueryBuilder::PARAM_INT_ARRAY))
3429
-					->executeStatement();
3430
-			}
3431
-
3432
-			foreach (array_chunk($calendarObjectUris, 1000) as $chunk) {
3433
-				$query = $this->db->getQueryBuilder();
3434
-				$query->delete('calendarchanges')
3435
-					->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3436
-					->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3437
-					->andWhere($query->expr()->in('uri', $query->createNamedParameter($chunk, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY))
3438
-					->executeStatement();
3439
-			}
3440
-			$this->addChanges($subscriptionId, $calendarObjectUris, 3, self::CALENDAR_TYPE_SUBSCRIPTION);
3441
-		}, $this->db);
3442
-	}
3443
-
3444
-	/**
3445
-	 * Move a calendar from one user to another
3446
-	 *
3447
-	 * @param string $uriName
3448
-	 * @param string $uriOrigin
3449
-	 * @param string $uriDestination
3450
-	 * @param string $newUriName (optional) the new uriName
3451
-	 */
3452
-	public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName = null) {
3453
-		$query = $this->db->getQueryBuilder();
3454
-		$query->update('calendars')
3455
-			->set('principaluri', $query->createNamedParameter($uriDestination))
3456
-			->set('uri', $query->createNamedParameter($newUriName ?: $uriName))
3457
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($uriOrigin)))
3458
-			->andWhere($query->expr()->eq('uri', $query->createNamedParameter($uriName)))
3459
-			->executeStatement();
3460
-	}
3461
-
3462
-	/**
3463
-	 * read VCalendar data into a VCalendar object
3464
-	 *
3465
-	 * @param string $objectData
3466
-	 * @return VCalendar
3467
-	 */
3468
-	protected function readCalendarData($objectData) {
3469
-		return Reader::read($objectData);
3470
-	}
3471
-
3472
-	/**
3473
-	 * delete all properties from a given calendar object
3474
-	 *
3475
-	 * @param int $calendarId
3476
-	 * @param int $objectId
3477
-	 */
3478
-	protected function purgeProperties($calendarId, $objectId) {
3479
-		$this->cachedObjects = [];
3480
-		$query = $this->db->getQueryBuilder();
3481
-		$query->delete($this->dbObjectPropertiesTable)
3482
-			->where($query->expr()->eq('objectid', $query->createNamedParameter($objectId)))
3483
-			->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)));
3484
-		$query->executeStatement();
3485
-	}
3486
-
3487
-	/**
3488
-	 * get ID from a given calendar object
3489
-	 *
3490
-	 * @param int $calendarId
3491
-	 * @param string $uri
3492
-	 * @param int $calendarType
3493
-	 * @return int
3494
-	 */
3495
-	protected function getCalendarObjectId($calendarId, $uri, $calendarType):int {
3496
-		$query = $this->db->getQueryBuilder();
3497
-		$query->select('id')
3498
-			->from('calendarobjects')
3499
-			->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
3500
-			->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
3501
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
3502
-
3503
-		$result = $query->executeQuery();
3504
-		$objectIds = $result->fetch();
3505
-		$result->closeCursor();
3506
-
3507
-		if (!isset($objectIds['id'])) {
3508
-			throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
3509
-		}
3510
-
3511
-		return (int)$objectIds['id'];
3512
-	}
3513
-
3514
-	/**
3515
-	 * @throws \InvalidArgumentException
3516
-	 */
3517
-	public function pruneOutdatedSyncTokens(int $keep, int $retention): int {
3518
-		if ($keep < 0) {
3519
-			throw new \InvalidArgumentException();
3520
-		}
3521
-
3522
-		$query = $this->db->getQueryBuilder();
3523
-		$query->select($query->func()->max('id'))
3524
-			->from('calendarchanges');
3525
-
3526
-		$result = $query->executeQuery();
3527
-		$maxId = (int)$result->fetchOne();
3528
-		$result->closeCursor();
3529
-		if (!$maxId || $maxId < $keep) {
3530
-			return 0;
3531
-		}
3532
-
3533
-		$query = $this->db->getQueryBuilder();
3534
-		$query->delete('calendarchanges')
3535
-			->where(
3536
-				$query->expr()->lte('id', $query->createNamedParameter($maxId - $keep, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT),
3537
-				$query->expr()->lte('created_at', $query->createNamedParameter($retention)),
3538
-			);
3539
-		return $query->executeStatement();
3540
-	}
3541
-
3542
-	/**
3543
-	 * return legacy endpoint principal name to new principal name
3544
-	 *
3545
-	 * @param $principalUri
3546
-	 * @param $toV2
3547
-	 * @return string
3548
-	 */
3549
-	private function convertPrincipal($principalUri, $toV2) {
3550
-		if ($this->principalBackend->getPrincipalPrefix() === 'principals') {
3551
-			[, $name] = Uri\split($principalUri);
3552
-			if ($toV2 === true) {
3553
-				return "principals/users/$name";
3554
-			}
3555
-			return "principals/$name";
3556
-		}
3557
-		return $principalUri;
3558
-	}
3559
-
3560
-	/**
3561
-	 * adds information about an owner to the calendar data
3562
-	 *
3563
-	 */
3564
-	private function addOwnerPrincipalToCalendar(array $calendarInfo): array {
3565
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
3566
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
3567
-		if (isset($calendarInfo[$ownerPrincipalKey])) {
3568
-			$uri = $calendarInfo[$ownerPrincipalKey];
3569
-		} else {
3570
-			$uri = $calendarInfo['principaluri'];
3571
-		}
3572
-
3573
-		$principalInformation = $this->principalBackend->getPrincipalByPath($uri);
3574
-		if (isset($principalInformation['{DAV:}displayname'])) {
3575
-			$calendarInfo[$displaynameKey] = $principalInformation['{DAV:}displayname'];
3576
-		}
3577
-		return $calendarInfo;
3578
-	}
3579
-
3580
-	private function addResourceTypeToCalendar(array $row, array $calendar): array {
3581
-		if (isset($row['deleted_at'])) {
3582
-			// Columns is set and not null -> this is a deleted calendar
3583
-			// we send a custom resourcetype to hide the deleted calendar
3584
-			// from ordinary DAV clients, but the Calendar app will know
3585
-			// how to handle this special resource.
3586
-			$calendar['{DAV:}resourcetype'] = new DAV\Xml\Property\ResourceType([
3587
-				'{DAV:}collection',
3588
-				sprintf('{%s}deleted-calendar', \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD),
3589
-			]);
3590
-		}
3591
-		return $calendar;
3592
-	}
3593
-
3594
-	/**
3595
-	 * Amend the calendar info with database row data
3596
-	 *
3597
-	 * @param array $row
3598
-	 * @param array $calendar
3599
-	 *
3600
-	 * @return array
3601
-	 */
3602
-	private function rowToCalendar($row, array $calendar): array {
3603
-		foreach ($this->propertyMap as $xmlName => [$dbName, $type]) {
3604
-			$value = $row[$dbName];
3605
-			if ($value !== null) {
3606
-				settype($value, $type);
3607
-			}
3608
-			$calendar[$xmlName] = $value;
3609
-		}
3610
-		return $calendar;
3611
-	}
3612
-
3613
-	/**
3614
-	 * Amend the subscription info with database row data
3615
-	 *
3616
-	 * @param array $row
3617
-	 * @param array $subscription
3618
-	 *
3619
-	 * @return array
3620
-	 */
3621
-	private function rowToSubscription($row, array $subscription): array {
3622
-		foreach ($this->subscriptionPropertyMap as $xmlName => [$dbName, $type]) {
3623
-			$value = $row[$dbName];
3624
-			if ($value !== null) {
3625
-				settype($value, $type);
3626
-			}
3627
-			$subscription[$xmlName] = $value;
3628
-		}
3629
-		return $subscription;
3630
-	}
3631
-
3632
-	/**
3633
-	 * delete all invitations from a given calendar
3634
-	 *
3635
-	 * @since 31.0.0
3636
-	 *
3637
-	 * @param int $calendarId
3638
-	 *
3639
-	 * @return void
3640
-	 */
3641
-	protected function purgeCalendarInvitations(int $calendarId): void {
3642
-		// select all calendar object uid's
3643
-		$cmd = $this->db->getQueryBuilder();
3644
-		$cmd->select('uid')
3645
-			->from($this->dbObjectsTable)
3646
-			->where($cmd->expr()->eq('calendarid', $cmd->createNamedParameter($calendarId)));
3647
-		$allIds = $cmd->executeQuery()->fetchAll(\PDO::FETCH_COLUMN);
3648
-		// delete all links that match object uid's
3649
-		$cmd = $this->db->getQueryBuilder();
3650
-		$cmd->delete($this->dbObjectInvitationsTable)
3651
-			->where($cmd->expr()->in('uid', $cmd->createParameter('uids'), IQueryBuilder::PARAM_STR_ARRAY));
3652
-		foreach (array_chunk($allIds, 1000) as $chunkIds) {
3653
-			$cmd->setParameter('uids', $chunkIds, IQueryBuilder::PARAM_STR_ARRAY);
3654
-			$cmd->executeStatement();
3655
-		}
3656
-	}
3657
-
3658
-	/**
3659
-	 * Delete all invitations from a given calendar event
3660
-	 *
3661
-	 * @since 31.0.0
3662
-	 *
3663
-	 * @param string $eventId UID of the event
3664
-	 *
3665
-	 * @return void
3666
-	 */
3667
-	protected function purgeObjectInvitations(string $eventId): void {
3668
-		$cmd = $this->db->getQueryBuilder();
3669
-		$cmd->delete($this->dbObjectInvitationsTable)
3670
-			->where($cmd->expr()->eq('uid', $cmd->createNamedParameter($eventId, IQueryBuilder::PARAM_STR), IQueryBuilder::PARAM_STR));
3671
-		$cmd->executeStatement();
3672
-	}
3673
-
3674
-	public function unshare(IShareable $shareable, string $principal): void {
3675
-		$this->atomic(function () use ($shareable, $principal): void {
3676
-			$calendarData = $this->getCalendarById($shareable->getResourceId());
3677
-			if ($calendarData === null) {
3678
-				throw new \RuntimeException('Trying to update shares for non-existing calendar: ' . $shareable->getResourceId());
3679
-			}
3680
-
3681
-			$oldShares = $this->getShares($shareable->getResourceId());
3682
-			$unshare = $this->calendarSharingBackend->unshare($shareable, $principal);
3683
-
3684
-			if ($unshare) {
3685
-				$this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent(
3686
-					$shareable->getResourceId(),
3687
-					$calendarData,
3688
-					$oldShares,
3689
-					[],
3690
-					[$principal]
3691
-				));
3692
-			}
3693
-		}, $this->db);
3694
-	}
109
+    use TTransactional;
110
+
111
+    public const CALENDAR_TYPE_CALENDAR = 0;
112
+    public const CALENDAR_TYPE_SUBSCRIPTION = 1;
113
+
114
+    public const PERSONAL_CALENDAR_URI = 'personal';
115
+    public const PERSONAL_CALENDAR_NAME = 'Personal';
116
+
117
+    public const RESOURCE_BOOKING_CALENDAR_URI = 'calendar';
118
+    public const RESOURCE_BOOKING_CALENDAR_NAME = 'Calendar';
119
+
120
+    /**
121
+     * We need to specify a max date, because we need to stop *somewhere*
122
+     *
123
+     * On 32 bit system the maximum for a signed integer is 2147483647, so
124
+     * MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results
125
+     * in 2038-01-19 to avoid problems when the date is converted
126
+     * to a unix timestamp.
127
+     */
128
+    public const MAX_DATE = '2038-01-01';
129
+
130
+    public const ACCESS_PUBLIC = 4;
131
+    public const CLASSIFICATION_PUBLIC = 0;
132
+    public const CLASSIFICATION_PRIVATE = 1;
133
+    public const CLASSIFICATION_CONFIDENTIAL = 2;
134
+
135
+    /**
136
+     * List of CalDAV properties, and how they map to database field names and their type
137
+     * Add your own properties by simply adding on to this array.
138
+     *
139
+     * @var array
140
+     * @psalm-var array<string, string[]>
141
+     */
142
+    public array $propertyMap = [
143
+        '{DAV:}displayname' => ['displayname', 'string'],
144
+        '{urn:ietf:params:xml:ns:caldav}calendar-description' => ['description', 'string'],
145
+        '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => ['timezone', 'string'],
146
+        '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'],
147
+        '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'],
148
+        '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int'],
149
+    ];
150
+
151
+    /**
152
+     * List of subscription properties, and how they map to database field names.
153
+     *
154
+     * @var array
155
+     */
156
+    public array $subscriptionPropertyMap = [
157
+        '{DAV:}displayname' => ['displayname', 'string'],
158
+        '{http://apple.com/ns/ical/}refreshrate' => ['refreshrate', 'string'],
159
+        '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'],
160
+        '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'],
161
+        '{http://calendarserver.org/ns/}subscribed-strip-todos' => ['striptodos', 'bool'],
162
+        '{http://calendarserver.org/ns/}subscribed-strip-alarms' => ['stripalarms', 'string'],
163
+        '{http://calendarserver.org/ns/}subscribed-strip-attachments' => ['stripattachments', 'string'],
164
+    ];
165
+
166
+    /**
167
+     * properties to index
168
+     *
169
+     * This list has to be kept in sync with ICalendarQuery::SEARCH_PROPERTY_*
170
+     *
171
+     * @see \OCP\Calendar\ICalendarQuery
172
+     */
173
+    private const INDEXED_PROPERTIES = [
174
+        'CATEGORIES',
175
+        'COMMENT',
176
+        'DESCRIPTION',
177
+        'LOCATION',
178
+        'RESOURCES',
179
+        'STATUS',
180
+        'SUMMARY',
181
+        'ATTENDEE',
182
+        'CONTACT',
183
+        'ORGANIZER'
184
+    ];
185
+
186
+    /** @var array parameters to index */
187
+    public static array $indexParameters = [
188
+        'ATTENDEE' => ['CN'],
189
+        'ORGANIZER' => ['CN'],
190
+    ];
191
+
192
+    /**
193
+     * @var string[] Map of uid => display name
194
+     */
195
+    protected array $userDisplayNames;
196
+
197
+    private string $dbObjectsTable = 'calendarobjects';
198
+    private string $dbObjectPropertiesTable = 'calendarobjects_props';
199
+    private string $dbObjectInvitationsTable = 'calendar_invitations';
200
+    private array $cachedObjects = [];
201
+
202
+    public function __construct(
203
+        private IDBConnection $db,
204
+        private Principal $principalBackend,
205
+        private IUserManager $userManager,
206
+        private ISecureRandom $random,
207
+        private LoggerInterface $logger,
208
+        private IEventDispatcher $dispatcher,
209
+        private IConfig $config,
210
+        private Sharing\Backend $calendarSharingBackend,
211
+        private bool $legacyEndpoint = false,
212
+    ) {
213
+    }
214
+
215
+    /**
216
+     * Return the number of calendars owned by the given principal.
217
+     *
218
+     * Calendars shared with the given principal are not counted!
219
+     *
220
+     * By default, this excludes the automatically generated birthday calendar.
221
+     */
222
+    public function getCalendarsForUserCount(string $principalUri, bool $excludeBirthday = true): int {
223
+        $principalUri = $this->convertPrincipal($principalUri, true);
224
+        $query = $this->db->getQueryBuilder();
225
+        $query->select($query->func()->count('*'))
226
+            ->from('calendars');
227
+
228
+        if ($principalUri === '') {
229
+            $query->where($query->expr()->emptyString('principaluri'));
230
+        } else {
231
+            $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
232
+        }
233
+
234
+        if ($excludeBirthday) {
235
+            $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)));
236
+        }
237
+
238
+        $result = $query->executeQuery();
239
+        $column = (int)$result->fetchOne();
240
+        $result->closeCursor();
241
+        return $column;
242
+    }
243
+
244
+    /**
245
+     * Return the number of subscriptions for a principal
246
+     */
247
+    public function getSubscriptionsForUserCount(string $principalUri): int {
248
+        $principalUri = $this->convertPrincipal($principalUri, true);
249
+        $query = $this->db->getQueryBuilder();
250
+        $query->select($query->func()->count('*'))
251
+            ->from('calendarsubscriptions');
252
+
253
+        if ($principalUri === '') {
254
+            $query->where($query->expr()->emptyString('principaluri'));
255
+        } else {
256
+            $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
257
+        }
258
+
259
+        $result = $query->executeQuery();
260
+        $column = (int)$result->fetchOne();
261
+        $result->closeCursor();
262
+        return $column;
263
+    }
264
+
265
+    /**
266
+     * @return array{id: int, deleted_at: int}[]
267
+     */
268
+    public function getDeletedCalendars(int $deletedBefore): array {
269
+        $qb = $this->db->getQueryBuilder();
270
+        $qb->select(['id', 'deleted_at'])
271
+            ->from('calendars')
272
+            ->where($qb->expr()->isNotNull('deleted_at'))
273
+            ->andWhere($qb->expr()->lt('deleted_at', $qb->createNamedParameter($deletedBefore)));
274
+        $result = $qb->executeQuery();
275
+        $calendars = [];
276
+        while (($row = $result->fetch()) !== false) {
277
+            $calendars[] = [
278
+                'id' => (int)$row['id'],
279
+                'deleted_at' => (int)$row['deleted_at'],
280
+            ];
281
+        }
282
+        $result->closeCursor();
283
+        return $calendars;
284
+    }
285
+
286
+    /**
287
+     * Returns a list of calendars for a principal.
288
+     *
289
+     * Every project is an array with the following keys:
290
+     *  * id, a unique id that will be used by other functions to modify the
291
+     *    calendar. This can be the same as the uri or a database key.
292
+     *  * uri, which the basename of the uri with which the calendar is
293
+     *    accessed.
294
+     *  * principaluri. The owner of the calendar. Almost always the same as
295
+     *    principalUri passed to this method.
296
+     *
297
+     * Furthermore it can contain webdav properties in clark notation. A very
298
+     * common one is '{DAV:}displayname'.
299
+     *
300
+     * Many clients also require:
301
+     * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
302
+     * For this property, you can just return an instance of
303
+     * Sabre\CalDAV\Property\SupportedCalendarComponentSet.
304
+     *
305
+     * If you return {http://sabredav.org/ns}read-only and set the value to 1,
306
+     * ACL will automatically be put in read-only mode.
307
+     *
308
+     * @param string $principalUri
309
+     * @return array
310
+     */
311
+    public function getCalendarsForUser($principalUri) {
312
+        return $this->atomic(function () use ($principalUri) {
313
+            $principalUriOriginal = $principalUri;
314
+            $principalUri = $this->convertPrincipal($principalUri, true);
315
+            $fields = array_column($this->propertyMap, 0);
316
+            $fields[] = 'id';
317
+            $fields[] = 'uri';
318
+            $fields[] = 'synctoken';
319
+            $fields[] = 'components';
320
+            $fields[] = 'principaluri';
321
+            $fields[] = 'transparent';
322
+
323
+            // Making fields a comma-delimited list
324
+            $query = $this->db->getQueryBuilder();
325
+            $query->select($fields)
326
+                ->from('calendars')
327
+                ->orderBy('calendarorder', 'ASC');
328
+
329
+            if ($principalUri === '') {
330
+                $query->where($query->expr()->emptyString('principaluri'));
331
+            } else {
332
+                $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
333
+            }
334
+
335
+            $result = $query->executeQuery();
336
+
337
+            $calendars = [];
338
+            while ($row = $result->fetch()) {
339
+                $row['principaluri'] = (string)$row['principaluri'];
340
+                $components = [];
341
+                if ($row['components']) {
342
+                    $components = explode(',', $row['components']);
343
+                }
344
+
345
+                $calendar = [
346
+                    'id' => $row['id'],
347
+                    'uri' => $row['uri'],
348
+                    'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
349
+                    '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
350
+                    '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
351
+                    '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
352
+                    '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
353
+                    '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
354
+                ];
355
+
356
+                $calendar = $this->rowToCalendar($row, $calendar);
357
+                $calendar = $this->addOwnerPrincipalToCalendar($calendar);
358
+                $calendar = $this->addResourceTypeToCalendar($row, $calendar);
359
+
360
+                if (!isset($calendars[$calendar['id']])) {
361
+                    $calendars[$calendar['id']] = $calendar;
362
+                }
363
+            }
364
+            $result->closeCursor();
365
+
366
+            // query for shared calendars
367
+            $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
368
+            $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal));
369
+            $principals[] = $principalUri;
370
+
371
+            $fields = array_column($this->propertyMap, 0);
372
+            $fields = array_map(function (string $field) {
373
+                return 'a.' . $field;
374
+            }, $fields);
375
+            $fields[] = 'a.id';
376
+            $fields[] = 'a.uri';
377
+            $fields[] = 'a.synctoken';
378
+            $fields[] = 'a.components';
379
+            $fields[] = 'a.principaluri';
380
+            $fields[] = 'a.transparent';
381
+            $fields[] = 's.access';
382
+
383
+            $select = $this->db->getQueryBuilder();
384
+            $subSelect = $this->db->getQueryBuilder();
385
+
386
+            $subSelect->select('resourceid')
387
+                ->from('dav_shares', 'd')
388
+                ->where($subSelect->expr()->eq('d.access', $select->createNamedParameter(Backend::ACCESS_UNSHARED, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT))
389
+                ->andWhere($subSelect->expr()->in('d.principaluri', $select->createNamedParameter($principals, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY));
390
+
391
+            $select->select($fields)
392
+                ->from('dav_shares', 's')
393
+                ->join('s', 'calendars', 'a', $select->expr()->eq('s.resourceid', 'a.id', IQueryBuilder::PARAM_INT))
394
+                ->where($select->expr()->in('s.principaluri', $select->createNamedParameter($principals, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY))
395
+                ->andWhere($select->expr()->eq('s.type', $select->createNamedParameter('calendar', IQueryBuilder::PARAM_STR), IQueryBuilder::PARAM_STR))
396
+                ->andWhere($select->expr()->notIn('a.id', $select->createFunction($subSelect->getSQL()), IQueryBuilder::PARAM_INT_ARRAY));
397
+
398
+            $results = $select->executeQuery();
399
+
400
+            $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
401
+            while ($row = $results->fetch()) {
402
+                $row['principaluri'] = (string)$row['principaluri'];
403
+                if ($row['principaluri'] === $principalUri) {
404
+                    continue;
405
+                }
406
+
407
+                $readOnly = (int)$row['access'] === Backend::ACCESS_READ;
408
+                if (isset($calendars[$row['id']])) {
409
+                    if ($readOnly) {
410
+                        // New share can not have more permissions than the old one.
411
+                        continue;
412
+                    }
413
+                    if (isset($calendars[$row['id']][$readOnlyPropertyName])
414
+                        && $calendars[$row['id']][$readOnlyPropertyName] === 0) {
415
+                        // Old share is already read-write, no more permissions can be gained
416
+                        continue;
417
+                    }
418
+                }
419
+
420
+                [, $name] = Uri\split($row['principaluri']);
421
+                $uri = $row['uri'] . '_shared_by_' . $name;
422
+                $row['displayname'] = $row['displayname'] . ' (' . ($this->userManager->getDisplayName($name) ?? ($name ?? '')) . ')';
423
+                $components = [];
424
+                if ($row['components']) {
425
+                    $components = explode(',', $row['components']);
426
+                }
427
+                $calendar = [
428
+                    'id' => $row['id'],
429
+                    'uri' => $uri,
430
+                    'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
431
+                    '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
432
+                    '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
433
+                    '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
434
+                    '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
435
+                    '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
436
+                    $readOnlyPropertyName => $readOnly,
437
+                ];
438
+
439
+                $calendar = $this->rowToCalendar($row, $calendar);
440
+                $calendar = $this->addOwnerPrincipalToCalendar($calendar);
441
+                $calendar = $this->addResourceTypeToCalendar($row, $calendar);
442
+
443
+                $calendars[$calendar['id']] = $calendar;
444
+            }
445
+            $result->closeCursor();
446
+
447
+            return array_values($calendars);
448
+        }, $this->db);
449
+    }
450
+
451
+    /**
452
+     * @param $principalUri
453
+     * @return array
454
+     */
455
+    public function getUsersOwnCalendars($principalUri) {
456
+        $principalUri = $this->convertPrincipal($principalUri, true);
457
+        $fields = array_column($this->propertyMap, 0);
458
+        $fields[] = 'id';
459
+        $fields[] = 'uri';
460
+        $fields[] = 'synctoken';
461
+        $fields[] = 'components';
462
+        $fields[] = 'principaluri';
463
+        $fields[] = 'transparent';
464
+        // Making fields a comma-delimited list
465
+        $query = $this->db->getQueryBuilder();
466
+        $query->select($fields)->from('calendars')
467
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
468
+            ->orderBy('calendarorder', 'ASC');
469
+        $stmt = $query->executeQuery();
470
+        $calendars = [];
471
+        while ($row = $stmt->fetch()) {
472
+            $row['principaluri'] = (string)$row['principaluri'];
473
+            $components = [];
474
+            if ($row['components']) {
475
+                $components = explode(',', $row['components']);
476
+            }
477
+            $calendar = [
478
+                'id' => $row['id'],
479
+                'uri' => $row['uri'],
480
+                'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
481
+                '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
482
+                '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
483
+                '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
484
+                '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
485
+            ];
486
+
487
+            $calendar = $this->rowToCalendar($row, $calendar);
488
+            $calendar = $this->addOwnerPrincipalToCalendar($calendar);
489
+            $calendar = $this->addResourceTypeToCalendar($row, $calendar);
490
+
491
+            if (!isset($calendars[$calendar['id']])) {
492
+                $calendars[$calendar['id']] = $calendar;
493
+            }
494
+        }
495
+        $stmt->closeCursor();
496
+        return array_values($calendars);
497
+    }
498
+
499
+    /**
500
+     * @return array
501
+     */
502
+    public function getPublicCalendars() {
503
+        $fields = array_column($this->propertyMap, 0);
504
+        $fields[] = 'a.id';
505
+        $fields[] = 'a.uri';
506
+        $fields[] = 'a.synctoken';
507
+        $fields[] = 'a.components';
508
+        $fields[] = 'a.principaluri';
509
+        $fields[] = 'a.transparent';
510
+        $fields[] = 's.access';
511
+        $fields[] = 's.publicuri';
512
+        $calendars = [];
513
+        $query = $this->db->getQueryBuilder();
514
+        $result = $query->select($fields)
515
+            ->from('dav_shares', 's')
516
+            ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
517
+            ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
518
+            ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
519
+            ->executeQuery();
520
+
521
+        while ($row = $result->fetch()) {
522
+            $row['principaluri'] = (string)$row['principaluri'];
523
+            [, $name] = Uri\split($row['principaluri']);
524
+            $row['displayname'] = $row['displayname'] . "($name)";
525
+            $components = [];
526
+            if ($row['components']) {
527
+                $components = explode(',', $row['components']);
528
+            }
529
+            $calendar = [
530
+                'id' => $row['id'],
531
+                'uri' => $row['publicuri'],
532
+                'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
533
+                '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
534
+                '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
535
+                '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
536
+                '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
537
+                '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
538
+                '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => true,
539
+                '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
540
+            ];
541
+
542
+            $calendar = $this->rowToCalendar($row, $calendar);
543
+            $calendar = $this->addOwnerPrincipalToCalendar($calendar);
544
+            $calendar = $this->addResourceTypeToCalendar($row, $calendar);
545
+
546
+            if (!isset($calendars[$calendar['id']])) {
547
+                $calendars[$calendar['id']] = $calendar;
548
+            }
549
+        }
550
+        $result->closeCursor();
551
+
552
+        return array_values($calendars);
553
+    }
554
+
555
+    /**
556
+     * @param string $uri
557
+     * @return array
558
+     * @throws NotFound
559
+     */
560
+    public function getPublicCalendar($uri) {
561
+        $fields = array_column($this->propertyMap, 0);
562
+        $fields[] = 'a.id';
563
+        $fields[] = 'a.uri';
564
+        $fields[] = 'a.synctoken';
565
+        $fields[] = 'a.components';
566
+        $fields[] = 'a.principaluri';
567
+        $fields[] = 'a.transparent';
568
+        $fields[] = 's.access';
569
+        $fields[] = 's.publicuri';
570
+        $query = $this->db->getQueryBuilder();
571
+        $result = $query->select($fields)
572
+            ->from('dav_shares', 's')
573
+            ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
574
+            ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
575
+            ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
576
+            ->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri)))
577
+            ->executeQuery();
578
+
579
+        $row = $result->fetch();
580
+
581
+        $result->closeCursor();
582
+
583
+        if ($row === false) {
584
+            throw new NotFound('Node with name \'' . $uri . '\' could not be found');
585
+        }
586
+
587
+        $row['principaluri'] = (string)$row['principaluri'];
588
+        [, $name] = Uri\split($row['principaluri']);
589
+        $row['displayname'] = $row['displayname'] . ' ' . "($name)";
590
+        $components = [];
591
+        if ($row['components']) {
592
+            $components = explode(',', $row['components']);
593
+        }
594
+        $calendar = [
595
+            'id' => $row['id'],
596
+            'uri' => $row['publicuri'],
597
+            'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
598
+            '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
599
+            '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
600
+            '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
601
+            '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
602
+            '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
603
+            '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => true,
604
+            '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
605
+        ];
606
+
607
+        $calendar = $this->rowToCalendar($row, $calendar);
608
+        $calendar = $this->addOwnerPrincipalToCalendar($calendar);
609
+        $calendar = $this->addResourceTypeToCalendar($row, $calendar);
610
+
611
+        return $calendar;
612
+    }
613
+
614
+    /**
615
+     * @param string $principal
616
+     * @param string $uri
617
+     * @return array|null
618
+     */
619
+    public function getCalendarByUri($principal, $uri) {
620
+        $fields = array_column($this->propertyMap, 0);
621
+        $fields[] = 'id';
622
+        $fields[] = 'uri';
623
+        $fields[] = 'synctoken';
624
+        $fields[] = 'components';
625
+        $fields[] = 'principaluri';
626
+        $fields[] = 'transparent';
627
+
628
+        // Making fields a comma-delimited list
629
+        $query = $this->db->getQueryBuilder();
630
+        $query->select($fields)->from('calendars')
631
+            ->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
632
+            ->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal)))
633
+            ->setMaxResults(1);
634
+        $stmt = $query->executeQuery();
635
+
636
+        $row = $stmt->fetch();
637
+        $stmt->closeCursor();
638
+        if ($row === false) {
639
+            return null;
640
+        }
641
+
642
+        $row['principaluri'] = (string)$row['principaluri'];
643
+        $components = [];
644
+        if ($row['components']) {
645
+            $components = explode(',', $row['components']);
646
+        }
647
+
648
+        $calendar = [
649
+            'id' => $row['id'],
650
+            'uri' => $row['uri'],
651
+            'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
652
+            '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
653
+            '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
654
+            '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
655
+            '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
656
+        ];
657
+
658
+        $calendar = $this->rowToCalendar($row, $calendar);
659
+        $calendar = $this->addOwnerPrincipalToCalendar($calendar);
660
+        $calendar = $this->addResourceTypeToCalendar($row, $calendar);
661
+
662
+        return $calendar;
663
+    }
664
+
665
+    /**
666
+     * @psalm-return CalendarInfo|null
667
+     * @return array|null
668
+     */
669
+    public function getCalendarById(int $calendarId): ?array {
670
+        $fields = array_column($this->propertyMap, 0);
671
+        $fields[] = 'id';
672
+        $fields[] = 'uri';
673
+        $fields[] = 'synctoken';
674
+        $fields[] = 'components';
675
+        $fields[] = 'principaluri';
676
+        $fields[] = 'transparent';
677
+
678
+        // Making fields a comma-delimited list
679
+        $query = $this->db->getQueryBuilder();
680
+        $query->select($fields)->from('calendars')
681
+            ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)))
682
+            ->setMaxResults(1);
683
+        $stmt = $query->executeQuery();
684
+
685
+        $row = $stmt->fetch();
686
+        $stmt->closeCursor();
687
+        if ($row === false) {
688
+            return null;
689
+        }
690
+
691
+        $row['principaluri'] = (string)$row['principaluri'];
692
+        $components = [];
693
+        if ($row['components']) {
694
+            $components = explode(',', $row['components']);
695
+        }
696
+
697
+        $calendar = [
698
+            'id' => $row['id'],
699
+            'uri' => $row['uri'],
700
+            'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
701
+            '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'),
702
+            '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?? 0,
703
+            '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
704
+            '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
705
+        ];
706
+
707
+        $calendar = $this->rowToCalendar($row, $calendar);
708
+        $calendar = $this->addOwnerPrincipalToCalendar($calendar);
709
+        $calendar = $this->addResourceTypeToCalendar($row, $calendar);
710
+
711
+        return $calendar;
712
+    }
713
+
714
+    /**
715
+     * @param $subscriptionId
716
+     */
717
+    public function getSubscriptionById($subscriptionId) {
718
+        $fields = array_column($this->subscriptionPropertyMap, 0);
719
+        $fields[] = 'id';
720
+        $fields[] = 'uri';
721
+        $fields[] = 'source';
722
+        $fields[] = 'synctoken';
723
+        $fields[] = 'principaluri';
724
+        $fields[] = 'lastmodified';
725
+
726
+        $query = $this->db->getQueryBuilder();
727
+        $query->select($fields)
728
+            ->from('calendarsubscriptions')
729
+            ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
730
+            ->orderBy('calendarorder', 'asc');
731
+        $stmt = $query->executeQuery();
732
+
733
+        $row = $stmt->fetch();
734
+        $stmt->closeCursor();
735
+        if ($row === false) {
736
+            return null;
737
+        }
738
+
739
+        $row['principaluri'] = (string)$row['principaluri'];
740
+        $subscription = [
741
+            'id' => $row['id'],
742
+            'uri' => $row['uri'],
743
+            'principaluri' => $row['principaluri'],
744
+            'source' => $row['source'],
745
+            'lastmodified' => $row['lastmodified'],
746
+            '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
747
+            '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
748
+        ];
749
+
750
+        return $this->rowToSubscription($row, $subscription);
751
+    }
752
+
753
+    public function getSubscriptionByUri(string $principal, string $uri): ?array {
754
+        $fields = array_column($this->subscriptionPropertyMap, 0);
755
+        $fields[] = 'id';
756
+        $fields[] = 'uri';
757
+        $fields[] = 'source';
758
+        $fields[] = 'synctoken';
759
+        $fields[] = 'principaluri';
760
+        $fields[] = 'lastmodified';
761
+
762
+        $query = $this->db->getQueryBuilder();
763
+        $query->select($fields)
764
+            ->from('calendarsubscriptions')
765
+            ->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
766
+            ->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal)))
767
+            ->setMaxResults(1);
768
+        $stmt = $query->executeQuery();
769
+
770
+        $row = $stmt->fetch();
771
+        $stmt->closeCursor();
772
+        if ($row === false) {
773
+            return null;
774
+        }
775
+
776
+        $row['principaluri'] = (string)$row['principaluri'];
777
+        $subscription = [
778
+            'id' => $row['id'],
779
+            'uri' => $row['uri'],
780
+            'principaluri' => $row['principaluri'],
781
+            'source' => $row['source'],
782
+            'lastmodified' => $row['lastmodified'],
783
+            '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
784
+            '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
785
+        ];
786
+
787
+        return $this->rowToSubscription($row, $subscription);
788
+    }
789
+
790
+    /**
791
+     * Creates a new calendar for a principal.
792
+     *
793
+     * If the creation was a success, an id must be returned that can be used to reference
794
+     * this calendar in other methods, such as updateCalendar.
795
+     *
796
+     * @param string $principalUri
797
+     * @param string $calendarUri
798
+     * @param array $properties
799
+     * @return int
800
+     *
801
+     * @throws CalendarException
802
+     */
803
+    public function createCalendar($principalUri, $calendarUri, array $properties) {
804
+        if (strlen($calendarUri) > 255) {
805
+            throw new CalendarException('URI too long. Calendar not created');
806
+        }
807
+
808
+        $values = [
809
+            'principaluri' => $this->convertPrincipal($principalUri, true),
810
+            'uri' => $calendarUri,
811
+            'synctoken' => 1,
812
+            'transparent' => 0,
813
+            'components' => 'VEVENT,VTODO,VJOURNAL',
814
+            'displayname' => $calendarUri
815
+        ];
816
+
817
+        // Default value
818
+        $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
819
+        if (isset($properties[$sccs])) {
820
+            if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) {
821
+                throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
822
+            }
823
+            $values['components'] = implode(',', $properties[$sccs]->getValue());
824
+        } elseif (isset($properties['components'])) {
825
+            // Allow to provide components internally without having
826
+            // to create a SupportedCalendarComponentSet object
827
+            $values['components'] = $properties['components'];
828
+        }
829
+
830
+        $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
831
+        if (isset($properties[$transp])) {
832
+            $values['transparent'] = (int)($properties[$transp]->getValue() === 'transparent');
833
+        }
834
+
835
+        foreach ($this->propertyMap as $xmlName => [$dbName, $type]) {
836
+            if (isset($properties[$xmlName])) {
837
+                $values[$dbName] = $properties[$xmlName];
838
+            }
839
+        }
840
+
841
+        [$calendarId, $calendarData] = $this->atomic(function () use ($values) {
842
+            $query = $this->db->getQueryBuilder();
843
+            $query->insert('calendars');
844
+            foreach ($values as $column => $value) {
845
+                $query->setValue($column, $query->createNamedParameter($value));
846
+            }
847
+            $query->executeStatement();
848
+            $calendarId = $query->getLastInsertId();
849
+
850
+            $calendarData = $this->getCalendarById($calendarId);
851
+            return [$calendarId, $calendarData];
852
+        }, $this->db);
853
+
854
+        $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData));
855
+
856
+        return $calendarId;
857
+    }
858
+
859
+    /**
860
+     * Updates properties for a calendar.
861
+     *
862
+     * The list of mutations is stored in a Sabre\DAV\PropPatch object.
863
+     * To do the actual updates, you must tell this object which properties
864
+     * you're going to process with the handle() method.
865
+     *
866
+     * Calling the handle method is like telling the PropPatch object "I
867
+     * promise I can handle updating this property".
868
+     *
869
+     * Read the PropPatch documentation for more info and examples.
870
+     *
871
+     * @param mixed $calendarId
872
+     * @param PropPatch $propPatch
873
+     * @return void
874
+     */
875
+    public function updateCalendar($calendarId, PropPatch $propPatch) {
876
+        $supportedProperties = array_keys($this->propertyMap);
877
+        $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
878
+
879
+        $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
880
+            $newValues = [];
881
+            foreach ($mutations as $propertyName => $propertyValue) {
882
+                switch ($propertyName) {
883
+                    case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp':
884
+                        $fieldName = 'transparent';
885
+                        $newValues[$fieldName] = (int)($propertyValue->getValue() === 'transparent');
886
+                        break;
887
+                    default:
888
+                        $fieldName = $this->propertyMap[$propertyName][0];
889
+                        $newValues[$fieldName] = $propertyValue;
890
+                        break;
891
+                }
892
+            }
893
+            [$calendarData, $shares] = $this->atomic(function () use ($calendarId, $newValues) {
894
+                $query = $this->db->getQueryBuilder();
895
+                $query->update('calendars');
896
+                foreach ($newValues as $fieldName => $value) {
897
+                    $query->set($fieldName, $query->createNamedParameter($value));
898
+                }
899
+                $query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
900
+                $query->executeStatement();
901
+
902
+                $this->addChanges($calendarId, [''], 2);
903
+
904
+                $calendarData = $this->getCalendarById($calendarId);
905
+                $shares = $this->getShares($calendarId);
906
+                return [$calendarData, $shares];
907
+            }, $this->db);
908
+
909
+            $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent($calendarId, $calendarData, $shares, $mutations));
910
+
911
+            return true;
912
+        });
913
+    }
914
+
915
+    /**
916
+     * Delete a calendar and all it's objects
917
+     *
918
+     * @param mixed $calendarId
919
+     * @return void
920
+     */
921
+    public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) {
922
+        $this->atomic(function () use ($calendarId, $forceDeletePermanently): void {
923
+            // The calendar is deleted right away if this is either enforced by the caller
924
+            // or the special contacts birthday calendar or when the preference of an empty
925
+            // retention (0 seconds) is set, which signals a disabled trashbin.
926
+            $calendarData = $this->getCalendarById($calendarId);
927
+            $isBirthdayCalendar = isset($calendarData['uri']) && $calendarData['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI;
928
+            $trashbinDisabled = $this->config->getAppValue(Application::APP_ID, RetentionService::RETENTION_CONFIG_KEY) === '0';
929
+            if ($forceDeletePermanently || $isBirthdayCalendar || $trashbinDisabled) {
930
+                $calendarData = $this->getCalendarById($calendarId);
931
+                $shares = $this->getShares($calendarId);
932
+
933
+                $this->purgeCalendarInvitations($calendarId);
934
+
935
+                $qbDeleteCalendarObjectProps = $this->db->getQueryBuilder();
936
+                $qbDeleteCalendarObjectProps->delete($this->dbObjectPropertiesTable)
937
+                    ->where($qbDeleteCalendarObjectProps->expr()->eq('calendarid', $qbDeleteCalendarObjectProps->createNamedParameter($calendarId)))
938
+                    ->andWhere($qbDeleteCalendarObjectProps->expr()->eq('calendartype', $qbDeleteCalendarObjectProps->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)))
939
+                    ->executeStatement();
940
+
941
+                $qbDeleteCalendarObjects = $this->db->getQueryBuilder();
942
+                $qbDeleteCalendarObjects->delete('calendarobjects')
943
+                    ->where($qbDeleteCalendarObjects->expr()->eq('calendarid', $qbDeleteCalendarObjects->createNamedParameter($calendarId)))
944
+                    ->andWhere($qbDeleteCalendarObjects->expr()->eq('calendartype', $qbDeleteCalendarObjects->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)))
945
+                    ->executeStatement();
946
+
947
+                $qbDeleteCalendarChanges = $this->db->getQueryBuilder();
948
+                $qbDeleteCalendarChanges->delete('calendarchanges')
949
+                    ->where($qbDeleteCalendarChanges->expr()->eq('calendarid', $qbDeleteCalendarChanges->createNamedParameter($calendarId)))
950
+                    ->andWhere($qbDeleteCalendarChanges->expr()->eq('calendartype', $qbDeleteCalendarChanges->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)))
951
+                    ->executeStatement();
952
+
953
+                $this->calendarSharingBackend->deleteAllShares($calendarId);
954
+
955
+                $qbDeleteCalendar = $this->db->getQueryBuilder();
956
+                $qbDeleteCalendar->delete('calendars')
957
+                    ->where($qbDeleteCalendar->expr()->eq('id', $qbDeleteCalendar->createNamedParameter($calendarId)))
958
+                    ->executeStatement();
959
+
960
+                // Only dispatch if we actually deleted anything
961
+                if ($calendarData) {
962
+                    $this->dispatcher->dispatchTyped(new CalendarDeletedEvent($calendarId, $calendarData, $shares));
963
+                }
964
+            } else {
965
+                $qbMarkCalendarDeleted = $this->db->getQueryBuilder();
966
+                $qbMarkCalendarDeleted->update('calendars')
967
+                    ->set('deleted_at', $qbMarkCalendarDeleted->createNamedParameter(time()))
968
+                    ->where($qbMarkCalendarDeleted->expr()->eq('id', $qbMarkCalendarDeleted->createNamedParameter($calendarId)))
969
+                    ->executeStatement();
970
+
971
+                $calendarData = $this->getCalendarById($calendarId);
972
+                $shares = $this->getShares($calendarId);
973
+                if ($calendarData) {
974
+                    $this->dispatcher->dispatchTyped(new CalendarMovedToTrashEvent(
975
+                        $calendarId,
976
+                        $calendarData,
977
+                        $shares
978
+                    ));
979
+                }
980
+            }
981
+        }, $this->db);
982
+    }
983
+
984
+    public function restoreCalendar(int $id): void {
985
+        $this->atomic(function () use ($id): void {
986
+            $qb = $this->db->getQueryBuilder();
987
+            $update = $qb->update('calendars')
988
+                ->set('deleted_at', $qb->createNamedParameter(null))
989
+                ->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
990
+            $update->executeStatement();
991
+
992
+            $calendarData = $this->getCalendarById($id);
993
+            $shares = $this->getShares($id);
994
+            if ($calendarData === null) {
995
+                throw new RuntimeException('Calendar data that was just written can\'t be read back. Check your database configuration.');
996
+            }
997
+            $this->dispatcher->dispatchTyped(new CalendarRestoredEvent(
998
+                $id,
999
+                $calendarData,
1000
+                $shares
1001
+            ));
1002
+        }, $this->db);
1003
+    }
1004
+
1005
+    /**
1006
+     * Returns all calendar entries as a stream of data
1007
+     *
1008
+     * @since 32.0.0
1009
+     *
1010
+     * @return Generator<array>
1011
+     */
1012
+    public function exportCalendar(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR, ?CalendarExportOptions $options = null): Generator {
1013
+        // extract options
1014
+        $rangeStart = $options?->getRangeStart();
1015
+        $rangeCount = $options?->getRangeCount();
1016
+        // construct query
1017
+        $qb = $this->db->getQueryBuilder();
1018
+        $qb->select('*')
1019
+            ->from('calendarobjects')
1020
+            ->where($qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)))
1021
+            ->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)))
1022
+            ->andWhere($qb->expr()->isNull('deleted_at'));
1023
+        if ($rangeStart !== null) {
1024
+            $qb->andWhere($qb->expr()->gt('uid', $qb->createNamedParameter($rangeStart)));
1025
+        }
1026
+        if ($rangeCount !== null) {
1027
+            $qb->setMaxResults($rangeCount);
1028
+        }
1029
+        if ($rangeStart !== null || $rangeCount !== null) {
1030
+            $qb->orderBy('uid', 'ASC');
1031
+        }
1032
+        $rs = $qb->executeQuery();
1033
+        // iterate through results
1034
+        try {
1035
+            while (($row = $rs->fetch()) !== false) {
1036
+                yield $row;
1037
+            }
1038
+        } finally {
1039
+            $rs->closeCursor();
1040
+        }
1041
+    }
1042
+
1043
+    /**
1044
+     * Returns all calendar objects with limited metadata for a calendar
1045
+     *
1046
+     * Every item contains an array with the following keys:
1047
+     *   * id - the table row id
1048
+     *   * etag - An arbitrary string
1049
+     *   * uri - a unique key which will be used to construct the uri. This can
1050
+     *     be any arbitrary string.
1051
+     *   * calendardata - The iCalendar-compatible calendar data
1052
+     *
1053
+     * @param mixed $calendarId
1054
+     * @param int $calendarType
1055
+     * @return array
1056
+     */
1057
+    public function getLimitedCalendarObjects(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1058
+        $query = $this->db->getQueryBuilder();
1059
+        $query->select(['id','uid', 'etag', 'uri', 'calendardata'])
1060
+            ->from('calendarobjects')
1061
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1062
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1063
+            ->andWhere($query->expr()->isNull('deleted_at'));
1064
+        $stmt = $query->executeQuery();
1065
+
1066
+        $result = [];
1067
+        while (($row = $stmt->fetch()) !== false) {
1068
+            $result[$row['uid']] = [
1069
+                'id' => $row['id'],
1070
+                'etag' => $row['etag'],
1071
+                'uri' => $row['uri'],
1072
+                'calendardata' => $row['calendardata'],
1073
+            ];
1074
+        }
1075
+        $stmt->closeCursor();
1076
+
1077
+        return $result;
1078
+    }
1079
+
1080
+    /**
1081
+     * Delete all of an user's shares
1082
+     *
1083
+     * @param string $principaluri
1084
+     * @return void
1085
+     */
1086
+    public function deleteAllSharesByUser($principaluri) {
1087
+        $this->calendarSharingBackend->deleteAllSharesByUser($principaluri);
1088
+    }
1089
+
1090
+    /**
1091
+     * Returns all calendar objects within a calendar.
1092
+     *
1093
+     * Every item contains an array with the following keys:
1094
+     *   * calendardata - The iCalendar-compatible calendar data
1095
+     *   * uri - a unique key which will be used to construct the uri. This can
1096
+     *     be any arbitrary string, but making sure it ends with '.ics' is a
1097
+     *     good idea. This is only the basename, or filename, not the full
1098
+     *     path.
1099
+     *   * lastmodified - a timestamp of the last modification time
1100
+     *   * etag - An arbitrary string, surrounded by double-quotes. (e.g.:
1101
+     *   '"abcdef"')
1102
+     *   * size - The size of the calendar objects, in bytes.
1103
+     *   * component - optional, a string containing the type of object, such
1104
+     *     as 'vevent' or 'vtodo'. If specified, this will be used to populate
1105
+     *     the Content-Type header.
1106
+     *
1107
+     * Note that the etag is optional, but it's highly encouraged to return for
1108
+     * speed reasons.
1109
+     *
1110
+     * The calendardata is also optional. If it's not returned
1111
+     * 'getCalendarObject' will be called later, which *is* expected to return
1112
+     * calendardata.
1113
+     *
1114
+     * If neither etag or size are specified, the calendardata will be
1115
+     * used/fetched to determine these numbers. If both are specified the
1116
+     * amount of times this is needed is reduced by a great degree.
1117
+     *
1118
+     * @param mixed $calendarId
1119
+     * @param int $calendarType
1120
+     * @return array
1121
+     */
1122
+    public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1123
+        $query = $this->db->getQueryBuilder();
1124
+        $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification'])
1125
+            ->from('calendarobjects')
1126
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1127
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1128
+            ->andWhere($query->expr()->isNull('deleted_at'));
1129
+        $stmt = $query->executeQuery();
1130
+
1131
+        $result = [];
1132
+        while (($row = $stmt->fetch()) !== false) {
1133
+            $result[] = [
1134
+                'id' => $row['id'],
1135
+                'uri' => $row['uri'],
1136
+                'lastmodified' => $row['lastmodified'],
1137
+                'etag' => '"' . $row['etag'] . '"',
1138
+                'calendarid' => $row['calendarid'],
1139
+                'size' => (int)$row['size'],
1140
+                'component' => strtolower($row['componenttype']),
1141
+                'classification' => (int)$row['classification']
1142
+            ];
1143
+        }
1144
+        $stmt->closeCursor();
1145
+
1146
+        return $result;
1147
+    }
1148
+
1149
+    public function getDeletedCalendarObjects(int $deletedBefore): array {
1150
+        $query = $this->db->getQueryBuilder();
1151
+        $query->select(['co.id', 'co.uri', 'co.lastmodified', 'co.etag', 'co.calendarid', 'co.calendartype', 'co.size', 'co.componenttype', 'co.classification', 'co.deleted_at'])
1152
+            ->from('calendarobjects', 'co')
1153
+            ->join('co', 'calendars', 'c', $query->expr()->eq('c.id', 'co.calendarid', IQueryBuilder::PARAM_INT))
1154
+            ->where($query->expr()->isNotNull('co.deleted_at'))
1155
+            ->andWhere($query->expr()->lt('co.deleted_at', $query->createNamedParameter($deletedBefore)));
1156
+        $stmt = $query->executeQuery();
1157
+
1158
+        $result = [];
1159
+        while (($row = $stmt->fetch()) !== false) {
1160
+            $result[] = [
1161
+                'id' => $row['id'],
1162
+                'uri' => $row['uri'],
1163
+                'lastmodified' => $row['lastmodified'],
1164
+                'etag' => '"' . $row['etag'] . '"',
1165
+                'calendarid' => (int)$row['calendarid'],
1166
+                'calendartype' => (int)$row['calendartype'],
1167
+                'size' => (int)$row['size'],
1168
+                'component' => strtolower($row['componenttype']),
1169
+                'classification' => (int)$row['classification'],
1170
+                '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'],
1171
+            ];
1172
+        }
1173
+        $stmt->closeCursor();
1174
+
1175
+        return $result;
1176
+    }
1177
+
1178
+    /**
1179
+     * Return all deleted calendar objects by the given principal that are not
1180
+     * in deleted calendars.
1181
+     *
1182
+     * @param string $principalUri
1183
+     * @return array
1184
+     * @throws Exception
1185
+     */
1186
+    public function getDeletedCalendarObjectsByPrincipal(string $principalUri): array {
1187
+        $query = $this->db->getQueryBuilder();
1188
+        $query->select(['co.id', 'co.uri', 'co.lastmodified', 'co.etag', 'co.calendarid', 'co.size', 'co.componenttype', 'co.classification', 'co.deleted_at'])
1189
+            ->selectAlias('c.uri', 'calendaruri')
1190
+            ->from('calendarobjects', 'co')
1191
+            ->join('co', 'calendars', 'c', $query->expr()->eq('c.id', 'co.calendarid', IQueryBuilder::PARAM_INT))
1192
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
1193
+            ->andWhere($query->expr()->isNotNull('co.deleted_at'))
1194
+            ->andWhere($query->expr()->isNull('c.deleted_at'));
1195
+        $stmt = $query->executeQuery();
1196
+
1197
+        $result = [];
1198
+        while ($row = $stmt->fetch()) {
1199
+            $result[] = [
1200
+                'id' => $row['id'],
1201
+                'uri' => $row['uri'],
1202
+                'lastmodified' => $row['lastmodified'],
1203
+                'etag' => '"' . $row['etag'] . '"',
1204
+                'calendarid' => $row['calendarid'],
1205
+                'calendaruri' => $row['calendaruri'],
1206
+                'size' => (int)$row['size'],
1207
+                'component' => strtolower($row['componenttype']),
1208
+                'classification' => (int)$row['classification'],
1209
+                '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'],
1210
+            ];
1211
+        }
1212
+        $stmt->closeCursor();
1213
+
1214
+        return $result;
1215
+    }
1216
+
1217
+    /**
1218
+     * Returns information from a single calendar object, based on it's object
1219
+     * uri.
1220
+     *
1221
+     * The object uri is only the basename, or filename and not a full path.
1222
+     *
1223
+     * The returned array must have the same keys as getCalendarObjects. The
1224
+     * 'calendardata' object is required here though, while it's not required
1225
+     * for getCalendarObjects.
1226
+     *
1227
+     * This method must return null if the object did not exist.
1228
+     *
1229
+     * @param mixed $calendarId
1230
+     * @param string $objectUri
1231
+     * @param int $calendarType
1232
+     * @return array|null
1233
+     */
1234
+    public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1235
+        $key = $calendarId . '::' . $objectUri . '::' . $calendarType;
1236
+        if (isset($this->cachedObjects[$key])) {
1237
+            return $this->cachedObjects[$key];
1238
+        }
1239
+        $query = $this->db->getQueryBuilder();
1240
+        $query->select(['id', 'uri', 'uid', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification', 'deleted_at'])
1241
+            ->from('calendarobjects')
1242
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1243
+            ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
1244
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
1245
+        $stmt = $query->executeQuery();
1246
+        $row = $stmt->fetch();
1247
+        $stmt->closeCursor();
1248
+
1249
+        if (!$row) {
1250
+            return null;
1251
+        }
1252
+
1253
+        $object = $this->rowToCalendarObject($row);
1254
+        $this->cachedObjects[$key] = $object;
1255
+        return $object;
1256
+    }
1257
+
1258
+    private function rowToCalendarObject(array $row): array {
1259
+        return [
1260
+            'id' => $row['id'],
1261
+            'uri' => $row['uri'],
1262
+            'uid' => $row['uid'],
1263
+            'lastmodified' => $row['lastmodified'],
1264
+            'etag' => '"' . $row['etag'] . '"',
1265
+            'calendarid' => $row['calendarid'],
1266
+            'size' => (int)$row['size'],
1267
+            'calendardata' => $this->readBlob($row['calendardata']),
1268
+            'component' => strtolower($row['componenttype']),
1269
+            'classification' => (int)$row['classification'],
1270
+            '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'],
1271
+        ];
1272
+    }
1273
+
1274
+    /**
1275
+     * Returns a list of calendar objects.
1276
+     *
1277
+     * This method should work identical to getCalendarObject, but instead
1278
+     * return all the calendar objects in the list as an array.
1279
+     *
1280
+     * If the backend supports this, it may allow for some speed-ups.
1281
+     *
1282
+     * @param mixed $calendarId
1283
+     * @param string[] $uris
1284
+     * @param int $calendarType
1285
+     * @return array
1286
+     */
1287
+    public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1288
+        if (empty($uris)) {
1289
+            return [];
1290
+        }
1291
+
1292
+        $chunks = array_chunk($uris, 100);
1293
+        $objects = [];
1294
+
1295
+        $query = $this->db->getQueryBuilder();
1296
+        $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
1297
+            ->from('calendarobjects')
1298
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1299
+            ->andWhere($query->expr()->in('uri', $query->createParameter('uri')))
1300
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1301
+            ->andWhere($query->expr()->isNull('deleted_at'));
1302
+
1303
+        foreach ($chunks as $uris) {
1304
+            $query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY);
1305
+            $result = $query->executeQuery();
1306
+
1307
+            while ($row = $result->fetch()) {
1308
+                $objects[] = [
1309
+                    'id' => $row['id'],
1310
+                    'uri' => $row['uri'],
1311
+                    'lastmodified' => $row['lastmodified'],
1312
+                    'etag' => '"' . $row['etag'] . '"',
1313
+                    'calendarid' => $row['calendarid'],
1314
+                    'size' => (int)$row['size'],
1315
+                    'calendardata' => $this->readBlob($row['calendardata']),
1316
+                    'component' => strtolower($row['componenttype']),
1317
+                    'classification' => (int)$row['classification']
1318
+                ];
1319
+            }
1320
+            $result->closeCursor();
1321
+        }
1322
+
1323
+        return $objects;
1324
+    }
1325
+
1326
+    /**
1327
+     * Creates a new calendar object.
1328
+     *
1329
+     * The object uri is only the basename, or filename and not a full path.
1330
+     *
1331
+     * It is possible return an etag from this function, which will be used in
1332
+     * the response to this PUT request. Note that the ETag must be surrounded
1333
+     * by double-quotes.
1334
+     *
1335
+     * However, you should only really return this ETag if you don't mangle the
1336
+     * calendar-data. If the result of a subsequent GET to this object is not
1337
+     * the exact same as this request body, you should omit the ETag.
1338
+     *
1339
+     * @param mixed $calendarId
1340
+     * @param string $objectUri
1341
+     * @param string $calendarData
1342
+     * @param int $calendarType
1343
+     * @return string
1344
+     */
1345
+    public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1346
+        $this->cachedObjects = [];
1347
+        $extraData = $this->getDenormalizedData($calendarData);
1348
+
1349
+        return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) {
1350
+            // Try to detect duplicates
1351
+            $qb = $this->db->getQueryBuilder();
1352
+            $qb->select($qb->func()->count('*'))
1353
+                ->from('calendarobjects')
1354
+                ->where($qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)))
1355
+                ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($extraData['uid'])))
1356
+                ->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)))
1357
+                ->andWhere($qb->expr()->isNull('deleted_at'));
1358
+            $result = $qb->executeQuery();
1359
+            $count = (int)$result->fetchOne();
1360
+            $result->closeCursor();
1361
+
1362
+            if ($count !== 0) {
1363
+                throw new BadRequest('Calendar object with uid already exists in this calendar collection.');
1364
+            }
1365
+            // For a more specific error message we also try to explicitly look up the UID but as a deleted entry
1366
+            $qbDel = $this->db->getQueryBuilder();
1367
+            $qbDel->select('*')
1368
+                ->from('calendarobjects')
1369
+                ->where($qbDel->expr()->eq('calendarid', $qbDel->createNamedParameter($calendarId)))
1370
+                ->andWhere($qbDel->expr()->eq('uid', $qbDel->createNamedParameter($extraData['uid'])))
1371
+                ->andWhere($qbDel->expr()->eq('calendartype', $qbDel->createNamedParameter($calendarType)))
1372
+                ->andWhere($qbDel->expr()->isNotNull('deleted_at'));
1373
+            $result = $qbDel->executeQuery();
1374
+            $found = $result->fetch();
1375
+            $result->closeCursor();
1376
+            if ($found !== false) {
1377
+                // the object existed previously but has been deleted
1378
+                // remove the trashbin entry and continue as if it was a new object
1379
+                $this->deleteCalendarObject($calendarId, $found['uri']);
1380
+            }
1381
+
1382
+            $query = $this->db->getQueryBuilder();
1383
+            $query->insert('calendarobjects')
1384
+                ->values([
1385
+                    'calendarid' => $query->createNamedParameter($calendarId),
1386
+                    'uri' => $query->createNamedParameter($objectUri),
1387
+                    'calendardata' => $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB),
1388
+                    'lastmodified' => $query->createNamedParameter(time()),
1389
+                    'etag' => $query->createNamedParameter($extraData['etag']),
1390
+                    'size' => $query->createNamedParameter($extraData['size']),
1391
+                    'componenttype' => $query->createNamedParameter($extraData['componentType']),
1392
+                    'firstoccurence' => $query->createNamedParameter($extraData['firstOccurence']),
1393
+                    'lastoccurence' => $query->createNamedParameter($extraData['lastOccurence']),
1394
+                    'classification' => $query->createNamedParameter($extraData['classification']),
1395
+                    'uid' => $query->createNamedParameter($extraData['uid']),
1396
+                    'calendartype' => $query->createNamedParameter($calendarType),
1397
+                ])
1398
+                ->executeStatement();
1399
+
1400
+            $this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
1401
+            $this->addChanges($calendarId, [$objectUri], 1, $calendarType);
1402
+
1403
+            $objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1404
+            assert($objectRow !== null);
1405
+
1406
+            if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1407
+                $calendarRow = $this->getCalendarById($calendarId);
1408
+                $shares = $this->getShares($calendarId);
1409
+
1410
+                $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent($calendarId, $calendarRow, $shares, $objectRow));
1411
+            } else {
1412
+                $subscriptionRow = $this->getSubscriptionById($calendarId);
1413
+
1414
+                $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent($calendarId, $subscriptionRow, [], $objectRow));
1415
+            }
1416
+
1417
+            return '"' . $extraData['etag'] . '"';
1418
+        }, $this->db);
1419
+    }
1420
+
1421
+    /**
1422
+     * Updates an existing calendarobject, based on it's uri.
1423
+     *
1424
+     * The object uri is only the basename, or filename and not a full path.
1425
+     *
1426
+     * It is possible return an etag from this function, which will be used in
1427
+     * the response to this PUT request. Note that the ETag must be surrounded
1428
+     * by double-quotes.
1429
+     *
1430
+     * However, you should only really return this ETag if you don't mangle the
1431
+     * calendar-data. If the result of a subsequent GET to this object is not
1432
+     * the exact same as this request body, you should omit the ETag.
1433
+     *
1434
+     * @param mixed $calendarId
1435
+     * @param string $objectUri
1436
+     * @param string $calendarData
1437
+     * @param int $calendarType
1438
+     * @return string
1439
+     */
1440
+    public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1441
+        $this->cachedObjects = [];
1442
+        $extraData = $this->getDenormalizedData($calendarData);
1443
+
1444
+        return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) {
1445
+            $query = $this->db->getQueryBuilder();
1446
+            $query->update('calendarobjects')
1447
+                ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB))
1448
+                ->set('lastmodified', $query->createNamedParameter(time()))
1449
+                ->set('etag', $query->createNamedParameter($extraData['etag']))
1450
+                ->set('size', $query->createNamedParameter($extraData['size']))
1451
+                ->set('componenttype', $query->createNamedParameter($extraData['componentType']))
1452
+                ->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence']))
1453
+                ->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence']))
1454
+                ->set('classification', $query->createNamedParameter($extraData['classification']))
1455
+                ->set('uid', $query->createNamedParameter($extraData['uid']))
1456
+                ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1457
+                ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
1458
+                ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1459
+                ->executeStatement();
1460
+
1461
+            $this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
1462
+            $this->addChanges($calendarId, [$objectUri], 2, $calendarType);
1463
+
1464
+            $objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1465
+            if (is_array($objectRow)) {
1466
+                if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1467
+                    $calendarRow = $this->getCalendarById($calendarId);
1468
+                    $shares = $this->getShares($calendarId);
1469
+
1470
+                    $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent($calendarId, $calendarRow, $shares, $objectRow));
1471
+                } else {
1472
+                    $subscriptionRow = $this->getSubscriptionById($calendarId);
1473
+
1474
+                    $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent($calendarId, $subscriptionRow, [], $objectRow));
1475
+                }
1476
+            }
1477
+
1478
+            return '"' . $extraData['etag'] . '"';
1479
+        }, $this->db);
1480
+    }
1481
+
1482
+    /**
1483
+     * Moves a calendar object from calendar to calendar.
1484
+     *
1485
+     * @param string $sourcePrincipalUri
1486
+     * @param int $sourceObjectId
1487
+     * @param string $targetPrincipalUri
1488
+     * @param int $targetCalendarId
1489
+     * @param string $tragetObjectUri
1490
+     * @param int $calendarType
1491
+     * @return bool
1492
+     * @throws Exception
1493
+     */
1494
+    public function moveCalendarObject(string $sourcePrincipalUri, int $sourceObjectId, string $targetPrincipalUri, int $targetCalendarId, string $tragetObjectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR): bool {
1495
+        $this->cachedObjects = [];
1496
+        return $this->atomic(function () use ($sourcePrincipalUri, $sourceObjectId, $targetPrincipalUri, $targetCalendarId, $tragetObjectUri, $calendarType) {
1497
+            $object = $this->getCalendarObjectById($sourcePrincipalUri, $sourceObjectId);
1498
+            if (empty($object)) {
1499
+                return false;
1500
+            }
1501
+
1502
+            $sourceCalendarId = $object['calendarid'];
1503
+            $sourceObjectUri = $object['uri'];
1504
+
1505
+            $query = $this->db->getQueryBuilder();
1506
+            $query->update('calendarobjects')
1507
+                ->set('calendarid', $query->createNamedParameter($targetCalendarId, IQueryBuilder::PARAM_INT))
1508
+                ->set('uri', $query->createNamedParameter($tragetObjectUri, IQueryBuilder::PARAM_STR))
1509
+                ->where($query->expr()->eq('id', $query->createNamedParameter($sourceObjectId, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT))
1510
+                ->executeStatement();
1511
+
1512
+            $this->purgeProperties($sourceCalendarId, $sourceObjectId);
1513
+            $this->updateProperties($targetCalendarId, $tragetObjectUri, $object['calendardata'], $calendarType);
1514
+
1515
+            $this->addChanges($sourceCalendarId, [$sourceObjectUri], 3, $calendarType);
1516
+            $this->addChanges($targetCalendarId, [$tragetObjectUri], 1, $calendarType);
1517
+
1518
+            $object = $this->getCalendarObjectById($targetPrincipalUri, $sourceObjectId);
1519
+            // Calendar Object wasn't found - possibly because it was deleted in the meantime by a different client
1520
+            if (empty($object)) {
1521
+                return false;
1522
+            }
1523
+
1524
+            $targetCalendarRow = $this->getCalendarById($targetCalendarId);
1525
+            // the calendar this event is being moved to does not exist any longer
1526
+            if (empty($targetCalendarRow)) {
1527
+                return false;
1528
+            }
1529
+
1530
+            if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1531
+                $sourceShares = $this->getShares($sourceCalendarId);
1532
+                $targetShares = $this->getShares($targetCalendarId);
1533
+                $sourceCalendarRow = $this->getCalendarById($sourceCalendarId);
1534
+                $this->dispatcher->dispatchTyped(new CalendarObjectMovedEvent($sourceCalendarId, $sourceCalendarRow, $targetCalendarId, $targetCalendarRow, $sourceShares, $targetShares, $object));
1535
+            }
1536
+            return true;
1537
+        }, $this->db);
1538
+    }
1539
+
1540
+    /**
1541
+     * Deletes an existing calendar object.
1542
+     *
1543
+     * The object uri is only the basename, or filename and not a full path.
1544
+     *
1545
+     * @param mixed $calendarId
1546
+     * @param string $objectUri
1547
+     * @param int $calendarType
1548
+     * @param bool $forceDeletePermanently
1549
+     * @return void
1550
+     */
1551
+    public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) {
1552
+        $this->cachedObjects = [];
1553
+        $this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void {
1554
+            $data = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1555
+
1556
+            if ($data === null) {
1557
+                // Nothing to delete
1558
+                return;
1559
+            }
1560
+
1561
+            if ($forceDeletePermanently || $this->config->getAppValue(Application::APP_ID, RetentionService::RETENTION_CONFIG_KEY) === '0') {
1562
+                $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `uri` = ? AND `calendartype` = ?');
1563
+                $stmt->execute([$calendarId, $objectUri, $calendarType]);
1564
+
1565
+                $this->purgeProperties($calendarId, $data['id']);
1566
+
1567
+                $this->purgeObjectInvitations($data['uid']);
1568
+
1569
+                if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1570
+                    $calendarRow = $this->getCalendarById($calendarId);
1571
+                    $shares = $this->getShares($calendarId);
1572
+
1573
+                    $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent($calendarId, $calendarRow, $shares, $data));
1574
+                } else {
1575
+                    $subscriptionRow = $this->getSubscriptionById($calendarId);
1576
+
1577
+                    $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent($calendarId, $subscriptionRow, [], $data));
1578
+                }
1579
+            } else {
1580
+                $pathInfo = pathinfo($data['uri']);
1581
+                if (!empty($pathInfo['extension'])) {
1582
+                    // Append a suffix to "free" the old URI for recreation
1583
+                    $newUri = sprintf(
1584
+                        '%s-deleted.%s',
1585
+                        $pathInfo['filename'],
1586
+                        $pathInfo['extension']
1587
+                    );
1588
+                } else {
1589
+                    $newUri = sprintf(
1590
+                        '%s-deleted',
1591
+                        $pathInfo['filename']
1592
+                    );
1593
+                }
1594
+
1595
+                // Try to detect conflicts before the DB does
1596
+                // As unlikely as it seems, this can happen when the user imports, then deletes, imports and deletes again
1597
+                $newObject = $this->getCalendarObject($calendarId, $newUri, $calendarType);
1598
+                if ($newObject !== null) {
1599
+                    throw new Forbidden("A calendar object with URI $newUri already exists in calendar $calendarId, therefore this object can't be moved into the trashbin");
1600
+                }
1601
+
1602
+                $qb = $this->db->getQueryBuilder();
1603
+                $markObjectDeletedQuery = $qb->update('calendarobjects')
1604
+                    ->set('deleted_at', $qb->createNamedParameter(time(), IQueryBuilder::PARAM_INT))
1605
+                    ->set('uri', $qb->createNamedParameter($newUri))
1606
+                    ->where(
1607
+                        $qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)),
1608
+                        $qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT),
1609
+                        $qb->expr()->eq('uri', $qb->createNamedParameter($objectUri))
1610
+                    );
1611
+                $markObjectDeletedQuery->executeStatement();
1612
+
1613
+                $calendarData = $this->getCalendarById($calendarId);
1614
+                if ($calendarData !== null) {
1615
+                    $this->dispatcher->dispatchTyped(
1616
+                        new CalendarObjectMovedToTrashEvent(
1617
+                            $calendarId,
1618
+                            $calendarData,
1619
+                            $this->getShares($calendarId),
1620
+                            $data
1621
+                        )
1622
+                    );
1623
+                }
1624
+            }
1625
+
1626
+            $this->addChanges($calendarId, [$objectUri], 3, $calendarType);
1627
+        }, $this->db);
1628
+    }
1629
+
1630
+    /**
1631
+     * @param mixed $objectData
1632
+     *
1633
+     * @throws Forbidden
1634
+     */
1635
+    public function restoreCalendarObject(array $objectData): void {
1636
+        $this->cachedObjects = [];
1637
+        $this->atomic(function () use ($objectData): void {
1638
+            $id = (int)$objectData['id'];
1639
+            $restoreUri = str_replace('-deleted.ics', '.ics', $objectData['uri']);
1640
+            $targetObject = $this->getCalendarObject(
1641
+                $objectData['calendarid'],
1642
+                $restoreUri
1643
+            );
1644
+            if ($targetObject !== null) {
1645
+                throw new Forbidden("Can not restore calendar $id because a calendar object with the URI $restoreUri already exists");
1646
+            }
1647
+
1648
+            $qb = $this->db->getQueryBuilder();
1649
+            $update = $qb->update('calendarobjects')
1650
+                ->set('uri', $qb->createNamedParameter($restoreUri))
1651
+                ->set('deleted_at', $qb->createNamedParameter(null))
1652
+                ->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
1653
+            $update->executeStatement();
1654
+
1655
+            // Make sure this change is tracked in the changes table
1656
+            $qb2 = $this->db->getQueryBuilder();
1657
+            $selectObject = $qb2->select('calendardata', 'uri', 'calendarid', 'calendartype')
1658
+                ->selectAlias('componenttype', 'component')
1659
+                ->from('calendarobjects')
1660
+                ->where($qb2->expr()->eq('id', $qb2->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
1661
+            $result = $selectObject->executeQuery();
1662
+            $row = $result->fetch();
1663
+            $result->closeCursor();
1664
+            if ($row === false) {
1665
+                // Welp, this should possibly not have happened, but let's ignore
1666
+                return;
1667
+            }
1668
+            $this->addChanges($row['calendarid'], [$row['uri']], 1, (int)$row['calendartype']);
1669
+
1670
+            $calendarRow = $this->getCalendarById((int)$row['calendarid']);
1671
+            if ($calendarRow === null) {
1672
+                throw new RuntimeException('Calendar object data that was just written can\'t be read back. Check your database configuration.');
1673
+            }
1674
+            $this->dispatcher->dispatchTyped(
1675
+                new CalendarObjectRestoredEvent(
1676
+                    (int)$objectData['calendarid'],
1677
+                    $calendarRow,
1678
+                    $this->getShares((int)$row['calendarid']),
1679
+                    $row
1680
+                )
1681
+            );
1682
+        }, $this->db);
1683
+    }
1684
+
1685
+    /**
1686
+     * Performs a calendar-query on the contents of this calendar.
1687
+     *
1688
+     * The calendar-query is defined in RFC4791 : CalDAV. Using the
1689
+     * calendar-query it is possible for a client to request a specific set of
1690
+     * object, based on contents of iCalendar properties, date-ranges and
1691
+     * iCalendar component types (VTODO, VEVENT).
1692
+     *
1693
+     * This method should just return a list of (relative) urls that match this
1694
+     * query.
1695
+     *
1696
+     * The list of filters are specified as an array. The exact array is
1697
+     * documented by Sabre\CalDAV\CalendarQueryParser.
1698
+     *
1699
+     * Note that it is extremely likely that getCalendarObject for every path
1700
+     * returned from this method will be called almost immediately after. You
1701
+     * may want to anticipate this to speed up these requests.
1702
+     *
1703
+     * This method provides a default implementation, which parses *all* the
1704
+     * iCalendar objects in the specified calendar.
1705
+     *
1706
+     * This default may well be good enough for personal use, and calendars
1707
+     * that aren't very large. But if you anticipate high usage, big calendars
1708
+     * or high loads, you are strongly advised to optimize certain paths.
1709
+     *
1710
+     * The best way to do so is override this method and to optimize
1711
+     * specifically for 'common filters'.
1712
+     *
1713
+     * Requests that are extremely common are:
1714
+     *   * requests for just VEVENTS
1715
+     *   * requests for just VTODO
1716
+     *   * requests with a time-range-filter on either VEVENT or VTODO.
1717
+     *
1718
+     * ..and combinations of these requests. It may not be worth it to try to
1719
+     * handle every possible situation and just rely on the (relatively
1720
+     * easy to use) CalendarQueryValidator to handle the rest.
1721
+     *
1722
+     * Note that especially time-range-filters may be difficult to parse. A
1723
+     * time-range filter specified on a VEVENT must for instance also handle
1724
+     * recurrence rules correctly.
1725
+     * A good example of how to interpret all these filters can also simply
1726
+     * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct
1727
+     * as possible, so it gives you a good idea on what type of stuff you need
1728
+     * to think of.
1729
+     *
1730
+     * @param mixed $calendarId
1731
+     * @param array $filters
1732
+     * @param int $calendarType
1733
+     * @return array
1734
+     */
1735
+    public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1736
+        $componentType = null;
1737
+        $requirePostFilter = true;
1738
+        $timeRange = null;
1739
+
1740
+        // if no filters were specified, we don't need to filter after a query
1741
+        if (!$filters['prop-filters'] && !$filters['comp-filters']) {
1742
+            $requirePostFilter = false;
1743
+        }
1744
+
1745
+        // Figuring out if there's a component filter
1746
+        if (count($filters['comp-filters']) > 0 && !$filters['comp-filters'][0]['is-not-defined']) {
1747
+            $componentType = $filters['comp-filters'][0]['name'];
1748
+
1749
+            // Checking if we need post-filters
1750
+            if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['time-range'] && !$filters['comp-filters'][0]['prop-filters']) {
1751
+                $requirePostFilter = false;
1752
+            }
1753
+            // There was a time-range filter
1754
+            if ($componentType === 'VEVENT' && isset($filters['comp-filters'][0]['time-range']) && is_array($filters['comp-filters'][0]['time-range'])) {
1755
+                $timeRange = $filters['comp-filters'][0]['time-range'];
1756
+
1757
+                // If start time OR the end time is not specified, we can do a
1758
+                // 100% accurate mysql query.
1759
+                if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && (!$timeRange['start'] || !$timeRange['end'])) {
1760
+                    $requirePostFilter = false;
1761
+                }
1762
+            }
1763
+        }
1764
+        $query = $this->db->getQueryBuilder();
1765
+        $query->select(['id', 'uri', 'uid', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification', 'deleted_at'])
1766
+            ->from('calendarobjects')
1767
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1768
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1769
+            ->andWhere($query->expr()->isNull('deleted_at'));
1770
+
1771
+        if ($componentType) {
1772
+            $query->andWhere($query->expr()->eq('componenttype', $query->createNamedParameter($componentType)));
1773
+        }
1774
+
1775
+        if ($timeRange && $timeRange['start']) {
1776
+            $query->andWhere($query->expr()->gt('lastoccurence', $query->createNamedParameter($timeRange['start']->getTimeStamp())));
1777
+        }
1778
+        if ($timeRange && $timeRange['end']) {
1779
+            $query->andWhere($query->expr()->lt('firstoccurence', $query->createNamedParameter($timeRange['end']->getTimeStamp())));
1780
+        }
1781
+
1782
+        $stmt = $query->executeQuery();
1783
+
1784
+        $result = [];
1785
+        while ($row = $stmt->fetch()) {
1786
+            // if we leave it as a blob we can't read it both from the post filter and the rowToCalendarObject
1787
+            if (isset($row['calendardata'])) {
1788
+                $row['calendardata'] = $this->readBlob($row['calendardata']);
1789
+            }
1790
+
1791
+            if ($requirePostFilter) {
1792
+                // validateFilterForObject will parse the calendar data
1793
+                // catch parsing errors
1794
+                try {
1795
+                    $matches = $this->validateFilterForObject($row, $filters);
1796
+                } catch (ParseException $ex) {
1797
+                    $this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [
1798
+                        'app' => 'dav',
1799
+                        'exception' => $ex,
1800
+                    ]);
1801
+                    continue;
1802
+                } catch (InvalidDataException $ex) {
1803
+                    $this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [
1804
+                        'app' => 'dav',
1805
+                        'exception' => $ex,
1806
+                    ]);
1807
+                    continue;
1808
+                } catch (MaxInstancesExceededException $ex) {
1809
+                    $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'], [
1810
+                        'app' => 'dav',
1811
+                        'exception' => $ex,
1812
+                    ]);
1813
+                    continue;
1814
+                }
1815
+
1816
+                if (!$matches) {
1817
+                    continue;
1818
+                }
1819
+            }
1820
+            $result[] = $row['uri'];
1821
+            $key = $calendarId . '::' . $row['uri'] . '::' . $calendarType;
1822
+            $this->cachedObjects[$key] = $this->rowToCalendarObject($row);
1823
+        }
1824
+
1825
+        return $result;
1826
+    }
1827
+
1828
+    /**
1829
+     * custom Nextcloud search extension for CalDAV
1830
+     *
1831
+     * TODO - this should optionally cover cached calendar objects as well
1832
+     *
1833
+     * @param string $principalUri
1834
+     * @param array $filters
1835
+     * @param integer|null $limit
1836
+     * @param integer|null $offset
1837
+     * @return array
1838
+     */
1839
+    public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) {
1840
+        return $this->atomic(function () use ($principalUri, $filters, $limit, $offset) {
1841
+            $calendars = $this->getCalendarsForUser($principalUri);
1842
+            $ownCalendars = [];
1843
+            $sharedCalendars = [];
1844
+
1845
+            $uriMapper = [];
1846
+
1847
+            foreach ($calendars as $calendar) {
1848
+                if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) {
1849
+                    $ownCalendars[] = $calendar['id'];
1850
+                } else {
1851
+                    $sharedCalendars[] = $calendar['id'];
1852
+                }
1853
+                $uriMapper[$calendar['id']] = $calendar['uri'];
1854
+            }
1855
+            if (count($ownCalendars) === 0 && count($sharedCalendars) === 0) {
1856
+                return [];
1857
+            }
1858
+
1859
+            $query = $this->db->getQueryBuilder();
1860
+            // Calendar id expressions
1861
+            $calendarExpressions = [];
1862
+            foreach ($ownCalendars as $id) {
1863
+                $calendarExpressions[] = $query->expr()->andX(
1864
+                    $query->expr()->eq('c.calendarid',
1865
+                        $query->createNamedParameter($id)),
1866
+                    $query->expr()->eq('c.calendartype',
1867
+                        $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1868
+            }
1869
+            foreach ($sharedCalendars as $id) {
1870
+                $calendarExpressions[] = $query->expr()->andX(
1871
+                    $query->expr()->eq('c.calendarid',
1872
+                        $query->createNamedParameter($id)),
1873
+                    $query->expr()->eq('c.classification',
1874
+                        $query->createNamedParameter(self::CLASSIFICATION_PUBLIC)),
1875
+                    $query->expr()->eq('c.calendartype',
1876
+                        $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1877
+            }
1878
+
1879
+            if (count($calendarExpressions) === 1) {
1880
+                $calExpr = $calendarExpressions[0];
1881
+            } else {
1882
+                $calExpr = call_user_func_array([$query->expr(), 'orX'], $calendarExpressions);
1883
+            }
1884
+
1885
+            // Component expressions
1886
+            $compExpressions = [];
1887
+            foreach ($filters['comps'] as $comp) {
1888
+                $compExpressions[] = $query->expr()
1889
+                    ->eq('c.componenttype', $query->createNamedParameter($comp));
1890
+            }
1891
+
1892
+            if (count($compExpressions) === 1) {
1893
+                $compExpr = $compExpressions[0];
1894
+            } else {
1895
+                $compExpr = call_user_func_array([$query->expr(), 'orX'], $compExpressions);
1896
+            }
1897
+
1898
+            if (!isset($filters['props'])) {
1899
+                $filters['props'] = [];
1900
+            }
1901
+            if (!isset($filters['params'])) {
1902
+                $filters['params'] = [];
1903
+            }
1904
+
1905
+            $propParamExpressions = [];
1906
+            foreach ($filters['props'] as $prop) {
1907
+                $propParamExpressions[] = $query->expr()->andX(
1908
+                    $query->expr()->eq('i.name', $query->createNamedParameter($prop)),
1909
+                    $query->expr()->isNull('i.parameter')
1910
+                );
1911
+            }
1912
+            foreach ($filters['params'] as $param) {
1913
+                $propParamExpressions[] = $query->expr()->andX(
1914
+                    $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])),
1915
+                    $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter']))
1916
+                );
1917
+            }
1918
+
1919
+            if (count($propParamExpressions) === 1) {
1920
+                $propParamExpr = $propParamExpressions[0];
1921
+            } else {
1922
+                $propParamExpr = call_user_func_array([$query->expr(), 'orX'], $propParamExpressions);
1923
+            }
1924
+
1925
+            $query->select(['c.calendarid', 'c.uri'])
1926
+                ->from($this->dbObjectPropertiesTable, 'i')
1927
+                ->join('i', 'calendarobjects', 'c', $query->expr()->eq('i.objectid', 'c.id'))
1928
+                ->where($calExpr)
1929
+                ->andWhere($compExpr)
1930
+                ->andWhere($propParamExpr)
1931
+                ->andWhere($query->expr()->iLike('i.value',
1932
+                    $query->createNamedParameter('%' . $this->db->escapeLikeParameter($filters['search-term']) . '%')))
1933
+                ->andWhere($query->expr()->isNull('deleted_at'));
1934
+
1935
+            if ($offset) {
1936
+                $query->setFirstResult($offset);
1937
+            }
1938
+            if ($limit) {
1939
+                $query->setMaxResults($limit);
1940
+            }
1941
+
1942
+            $stmt = $query->executeQuery();
1943
+
1944
+            $result = [];
1945
+            while ($row = $stmt->fetch()) {
1946
+                $path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
1947
+                if (!in_array($path, $result)) {
1948
+                    $result[] = $path;
1949
+                }
1950
+            }
1951
+
1952
+            return $result;
1953
+        }, $this->db);
1954
+    }
1955
+
1956
+    /**
1957
+     * used for Nextcloud's calendar API
1958
+     *
1959
+     * @param array $calendarInfo
1960
+     * @param string $pattern
1961
+     * @param array $searchProperties
1962
+     * @param array $options
1963
+     * @param integer|null $limit
1964
+     * @param integer|null $offset
1965
+     *
1966
+     * @return array
1967
+     */
1968
+    public function search(
1969
+        array $calendarInfo,
1970
+        $pattern,
1971
+        array $searchProperties,
1972
+        array $options,
1973
+        $limit,
1974
+        $offset,
1975
+    ) {
1976
+        $outerQuery = $this->db->getQueryBuilder();
1977
+        $innerQuery = $this->db->getQueryBuilder();
1978
+
1979
+        if (isset($calendarInfo['source'])) {
1980
+            $calendarType = self::CALENDAR_TYPE_SUBSCRIPTION;
1981
+        } else {
1982
+            $calendarType = self::CALENDAR_TYPE_CALENDAR;
1983
+        }
1984
+
1985
+        $innerQuery->selectDistinct('op.objectid')
1986
+            ->from($this->dbObjectPropertiesTable, 'op')
1987
+            ->andWhere($innerQuery->expr()->eq('op.calendarid',
1988
+                $outerQuery->createNamedParameter($calendarInfo['id'])))
1989
+            ->andWhere($innerQuery->expr()->eq('op.calendartype',
1990
+                $outerQuery->createNamedParameter($calendarType)));
1991
+
1992
+        $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
1993
+            ->from('calendarobjects', 'c')
1994
+            ->where($outerQuery->expr()->isNull('deleted_at'));
1995
+
1996
+        // only return public items for shared calendars for now
1997
+        if (isset($calendarInfo['{http://owncloud.org/ns}owner-principal']) === false || $calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) {
1998
+            $outerQuery->andWhere($outerQuery->expr()->eq('c.classification',
1999
+                $outerQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
2000
+        }
2001
+
2002
+        if (!empty($searchProperties)) {
2003
+            $or = [];
2004
+            foreach ($searchProperties as $searchProperty) {
2005
+                $or[] = $innerQuery->expr()->eq('op.name',
2006
+                    $outerQuery->createNamedParameter($searchProperty));
2007
+            }
2008
+            $innerQuery->andWhere($innerQuery->expr()->orX(...$or));
2009
+        }
2010
+
2011
+        if ($pattern !== '') {
2012
+            $innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
2013
+                $outerQuery->createNamedParameter('%'
2014
+                    . $this->db->escapeLikeParameter($pattern) . '%')));
2015
+        }
2016
+
2017
+        $start = null;
2018
+        $end = null;
2019
+
2020
+        $hasLimit = is_int($limit);
2021
+        $hasTimeRange = false;
2022
+
2023
+        if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTimeInterface) {
2024
+            /** @var DateTimeInterface $start */
2025
+            $start = $options['timerange']['start'];
2026
+            $outerQuery->andWhere(
2027
+                $outerQuery->expr()->gt(
2028
+                    'lastoccurence',
2029
+                    $outerQuery->createNamedParameter($start->getTimestamp())
2030
+                )
2031
+            );
2032
+            $hasTimeRange = true;
2033
+        }
2034
+
2035
+        if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTimeInterface) {
2036
+            /** @var DateTimeInterface $end */
2037
+            $end = $options['timerange']['end'];
2038
+            $outerQuery->andWhere(
2039
+                $outerQuery->expr()->lt(
2040
+                    'firstoccurence',
2041
+                    $outerQuery->createNamedParameter($end->getTimestamp())
2042
+                )
2043
+            );
2044
+            $hasTimeRange = true;
2045
+        }
2046
+
2047
+        if (isset($options['uid'])) {
2048
+            $outerQuery->andWhere($outerQuery->expr()->eq('uid', $outerQuery->createNamedParameter($options['uid'])));
2049
+        }
2050
+
2051
+        if (!empty($options['types'])) {
2052
+            $or = [];
2053
+            foreach ($options['types'] as $type) {
2054
+                $or[] = $outerQuery->expr()->eq('componenttype',
2055
+                    $outerQuery->createNamedParameter($type));
2056
+            }
2057
+            $outerQuery->andWhere($outerQuery->expr()->orX(...$or));
2058
+        }
2059
+
2060
+        $outerQuery->andWhere($outerQuery->expr()->in('c.id', $outerQuery->createFunction($innerQuery->getSQL())));
2061
+
2062
+        // Without explicit order by its undefined in which order the SQL server returns the events.
2063
+        // For the pagination with hasLimit and hasTimeRange, a stable ordering is helpful.
2064
+        $outerQuery->addOrderBy('id');
2065
+
2066
+        $offset = (int)$offset;
2067
+        $outerQuery->setFirstResult($offset);
2068
+
2069
+        $calendarObjects = [];
2070
+
2071
+        if ($hasLimit && $hasTimeRange) {
2072
+            /**
2073
+             * Event recurrences are evaluated at runtime because the database only knows the first and last occurrence.
2074
+             *
2075
+             * Given, a user created 8 events with a yearly reoccurrence and two for events tomorrow.
2076
+             * The upcoming event widget asks the CalDAV backend for 7 events within the next 14 days.
2077
+             *
2078
+             * If limit 7 is applied to the SQL query, we find the 7 events with a yearly reoccurrence
2079
+             * and discard the events after evaluating the reoccurrence rules because they are not due within
2080
+             * the next 14 days and end up with an empty result even if there are two events to show.
2081
+             *
2082
+             * The workaround for search requests with a limit and time range is asking for more row than requested
2083
+             * and retrying if we have not reached the limit.
2084
+             *
2085
+             * 25 rows and 3 retries is entirely arbitrary.
2086
+             */
2087
+            $maxResults = (int)max($limit, 25);
2088
+            $outerQuery->setMaxResults($maxResults);
2089
+
2090
+            for ($attempt = $objectsCount = 0; $attempt < 3 && $objectsCount < $limit; $attempt++) {
2091
+                $objectsCount = array_push($calendarObjects, ...$this->searchCalendarObjects($outerQuery, $start, $end));
2092
+                $outerQuery->setFirstResult($offset += $maxResults);
2093
+            }
2094
+
2095
+            $calendarObjects = array_slice($calendarObjects, 0, $limit, false);
2096
+        } else {
2097
+            $outerQuery->setMaxResults($limit);
2098
+            $calendarObjects = $this->searchCalendarObjects($outerQuery, $start, $end);
2099
+        }
2100
+
2101
+        $calendarObjects = array_map(function ($o) use ($options) {
2102
+            $calendarData = Reader::read($o['calendardata']);
2103
+
2104
+            // Expand recurrences if an explicit time range is requested
2105
+            if ($calendarData instanceof VCalendar
2106
+                && isset($options['timerange']['start'], $options['timerange']['end'])) {
2107
+                $calendarData = $calendarData->expand(
2108
+                    $options['timerange']['start'],
2109
+                    $options['timerange']['end'],
2110
+                );
2111
+            }
2112
+
2113
+            $comps = $calendarData->getComponents();
2114
+            $objects = [];
2115
+            $timezones = [];
2116
+            foreach ($comps as $comp) {
2117
+                if ($comp instanceof VTimeZone) {
2118
+                    $timezones[] = $comp;
2119
+                } else {
2120
+                    $objects[] = $comp;
2121
+                }
2122
+            }
2123
+
2124
+            return [
2125
+                'id' => $o['id'],
2126
+                'type' => $o['componenttype'],
2127
+                'uid' => $o['uid'],
2128
+                'uri' => $o['uri'],
2129
+                'objects' => array_map(function ($c) {
2130
+                    return $this->transformSearchData($c);
2131
+                }, $objects),
2132
+                'timezones' => array_map(function ($c) {
2133
+                    return $this->transformSearchData($c);
2134
+                }, $timezones),
2135
+            ];
2136
+        }, $calendarObjects);
2137
+
2138
+        usort($calendarObjects, function (array $a, array $b) {
2139
+            /** @var DateTimeImmutable $startA */
2140
+            $startA = $a['objects'][0]['DTSTART'][0] ?? new DateTimeImmutable(self::MAX_DATE);
2141
+            /** @var DateTimeImmutable $startB */
2142
+            $startB = $b['objects'][0]['DTSTART'][0] ?? new DateTimeImmutable(self::MAX_DATE);
2143
+
2144
+            return $startA->getTimestamp() <=> $startB->getTimestamp();
2145
+        });
2146
+
2147
+        return $calendarObjects;
2148
+    }
2149
+
2150
+    private function searchCalendarObjects(IQueryBuilder $query, ?DateTimeInterface $start, ?DateTimeInterface $end): array {
2151
+        $calendarObjects = [];
2152
+        $filterByTimeRange = ($start instanceof DateTimeInterface) || ($end instanceof DateTimeInterface);
2153
+
2154
+        $result = $query->executeQuery();
2155
+
2156
+        while (($row = $result->fetch()) !== false) {
2157
+            if ($filterByTimeRange === false) {
2158
+                // No filter required
2159
+                $calendarObjects[] = $row;
2160
+                continue;
2161
+            }
2162
+
2163
+            try {
2164
+                $isValid = $this->validateFilterForObject($row, [
2165
+                    'name' => 'VCALENDAR',
2166
+                    'comp-filters' => [
2167
+                        [
2168
+                            'name' => 'VEVENT',
2169
+                            'comp-filters' => [],
2170
+                            'prop-filters' => [],
2171
+                            'is-not-defined' => false,
2172
+                            'time-range' => [
2173
+                                'start' => $start,
2174
+                                'end' => $end,
2175
+                            ],
2176
+                        ],
2177
+                    ],
2178
+                    'prop-filters' => [],
2179
+                    'is-not-defined' => false,
2180
+                    'time-range' => null,
2181
+                ]);
2182
+            } catch (MaxInstancesExceededException $ex) {
2183
+                $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'], [
2184
+                    'app' => 'dav',
2185
+                    'exception' => $ex,
2186
+                ]);
2187
+                continue;
2188
+            }
2189
+
2190
+            if (is_resource($row['calendardata'])) {
2191
+                // Put the stream back to the beginning so it can be read another time
2192
+                rewind($row['calendardata']);
2193
+            }
2194
+
2195
+            if ($isValid) {
2196
+                $calendarObjects[] = $row;
2197
+            }
2198
+        }
2199
+
2200
+        $result->closeCursor();
2201
+
2202
+        return $calendarObjects;
2203
+    }
2204
+
2205
+    /**
2206
+     * @param Component $comp
2207
+     * @return array
2208
+     */
2209
+    private function transformSearchData(Component $comp) {
2210
+        $data = [];
2211
+        /** @var Component[] $subComponents */
2212
+        $subComponents = $comp->getComponents();
2213
+        /** @var Property[] $properties */
2214
+        $properties = array_filter($comp->children(), function ($c) {
2215
+            return $c instanceof Property;
2216
+        });
2217
+        $validationRules = $comp->getValidationRules();
2218
+
2219
+        foreach ($subComponents as $subComponent) {
2220
+            $name = $subComponent->name;
2221
+            if (!isset($data[$name])) {
2222
+                $data[$name] = [];
2223
+            }
2224
+            $data[$name][] = $this->transformSearchData($subComponent);
2225
+        }
2226
+
2227
+        foreach ($properties as $property) {
2228
+            $name = $property->name;
2229
+            if (!isset($validationRules[$name])) {
2230
+                $validationRules[$name] = '*';
2231
+            }
2232
+
2233
+            $rule = $validationRules[$property->name];
2234
+            if ($rule === '+' || $rule === '*') { // multiple
2235
+                if (!isset($data[$name])) {
2236
+                    $data[$name] = [];
2237
+                }
2238
+
2239
+                $data[$name][] = $this->transformSearchProperty($property);
2240
+            } else { // once
2241
+                $data[$name] = $this->transformSearchProperty($property);
2242
+            }
2243
+        }
2244
+
2245
+        return $data;
2246
+    }
2247
+
2248
+    /**
2249
+     * @param Property $prop
2250
+     * @return array
2251
+     */
2252
+    private function transformSearchProperty(Property $prop) {
2253
+        // No need to check Date, as it extends DateTime
2254
+        if ($prop instanceof Property\ICalendar\DateTime) {
2255
+            $value = $prop->getDateTime();
2256
+        } else {
2257
+            $value = $prop->getValue();
2258
+        }
2259
+
2260
+        return [
2261
+            $value,
2262
+            $prop->parameters()
2263
+        ];
2264
+    }
2265
+
2266
+    /**
2267
+     * @param string $principalUri
2268
+     * @param string $pattern
2269
+     * @param array $componentTypes
2270
+     * @param array $searchProperties
2271
+     * @param array $searchParameters
2272
+     * @param array $options
2273
+     * @return array
2274
+     */
2275
+    public function searchPrincipalUri(string $principalUri,
2276
+        string $pattern,
2277
+        array $componentTypes,
2278
+        array $searchProperties,
2279
+        array $searchParameters,
2280
+        array $options = [],
2281
+    ): array {
2282
+        return $this->atomic(function () use ($principalUri, $pattern, $componentTypes, $searchProperties, $searchParameters, $options) {
2283
+            $escapePattern = !\array_key_exists('escape_like_param', $options) || $options['escape_like_param'] !== false;
2284
+
2285
+            $calendarObjectIdQuery = $this->db->getQueryBuilder();
2286
+            $calendarOr = [];
2287
+            $searchOr = [];
2288
+
2289
+            // Fetch calendars and subscription
2290
+            $calendars = $this->getCalendarsForUser($principalUri);
2291
+            $subscriptions = $this->getSubscriptionsForUser($principalUri);
2292
+            foreach ($calendars as $calendar) {
2293
+                $calendarAnd = $calendarObjectIdQuery->expr()->andX(
2294
+                    $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])),
2295
+                    $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)),
2296
+                );
2297
+
2298
+                // If it's shared, limit search to public events
2299
+                if (isset($calendar['{http://owncloud.org/ns}owner-principal'])
2300
+                    && $calendar['principaluri'] !== $calendar['{http://owncloud.org/ns}owner-principal']) {
2301
+                    $calendarAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
2302
+                }
2303
+
2304
+                $calendarOr[] = $calendarAnd;
2305
+            }
2306
+            foreach ($subscriptions as $subscription) {
2307
+                $subscriptionAnd = $calendarObjectIdQuery->expr()->andX(
2308
+                    $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])),
2309
+                    $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)),
2310
+                );
2311
+
2312
+                // If it's shared, limit search to public events
2313
+                if (isset($subscription['{http://owncloud.org/ns}owner-principal'])
2314
+                    && $subscription['principaluri'] !== $subscription['{http://owncloud.org/ns}owner-principal']) {
2315
+                    $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
2316
+                }
2317
+
2318
+                $calendarOr[] = $subscriptionAnd;
2319
+            }
2320
+
2321
+            foreach ($searchProperties as $property) {
2322
+                $propertyAnd = $calendarObjectIdQuery->expr()->andX(
2323
+                    $calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR)),
2324
+                    $calendarObjectIdQuery->expr()->isNull('cob.parameter'),
2325
+                );
2326
+
2327
+                $searchOr[] = $propertyAnd;
2328
+            }
2329
+            foreach ($searchParameters as $property => $parameter) {
2330
+                $parameterAnd = $calendarObjectIdQuery->expr()->andX(
2331
+                    $calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR)),
2332
+                    $calendarObjectIdQuery->expr()->eq('cob.parameter', $calendarObjectIdQuery->createNamedParameter($parameter, IQueryBuilder::PARAM_STR_ARRAY)),
2333
+                );
2334
+
2335
+                $searchOr[] = $parameterAnd;
2336
+            }
2337
+
2338
+            if (empty($calendarOr)) {
2339
+                return [];
2340
+            }
2341
+            if (empty($searchOr)) {
2342
+                return [];
2343
+            }
2344
+
2345
+            $calendarObjectIdQuery->selectDistinct('cob.objectid')
2346
+                ->from($this->dbObjectPropertiesTable, 'cob')
2347
+                ->leftJoin('cob', 'calendarobjects', 'co', $calendarObjectIdQuery->expr()->eq('co.id', 'cob.objectid'))
2348
+                ->andWhere($calendarObjectIdQuery->expr()->in('co.componenttype', $calendarObjectIdQuery->createNamedParameter($componentTypes, IQueryBuilder::PARAM_STR_ARRAY)))
2349
+                ->andWhere($calendarObjectIdQuery->expr()->orX(...$calendarOr))
2350
+                ->andWhere($calendarObjectIdQuery->expr()->orX(...$searchOr))
2351
+                ->andWhere($calendarObjectIdQuery->expr()->isNull('deleted_at'));
2352
+
2353
+            if ($pattern !== '') {
2354
+                if (!$escapePattern) {
2355
+                    $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern)));
2356
+                } else {
2357
+                    $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
2358
+                }
2359
+            }
2360
+
2361
+            if (isset($options['limit'])) {
2362
+                $calendarObjectIdQuery->setMaxResults($options['limit']);
2363
+            }
2364
+            if (isset($options['offset'])) {
2365
+                $calendarObjectIdQuery->setFirstResult($options['offset']);
2366
+            }
2367
+            if (isset($options['timerange'])) {
2368
+                if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTimeInterface) {
2369
+                    $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->gt(
2370
+                        'lastoccurence',
2371
+                        $calendarObjectIdQuery->createNamedParameter($options['timerange']['start']->getTimeStamp()),
2372
+                    ));
2373
+                }
2374
+                if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTimeInterface) {
2375
+                    $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->lt(
2376
+                        'firstoccurence',
2377
+                        $calendarObjectIdQuery->createNamedParameter($options['timerange']['end']->getTimeStamp()),
2378
+                    ));
2379
+                }
2380
+            }
2381
+
2382
+            $result = $calendarObjectIdQuery->executeQuery();
2383
+            $matches = [];
2384
+            while (($row = $result->fetch()) !== false) {
2385
+                $matches[] = (int)$row['objectid'];
2386
+            }
2387
+            $result->closeCursor();
2388
+
2389
+            $query = $this->db->getQueryBuilder();
2390
+            $query->select('calendardata', 'uri', 'calendarid', 'calendartype')
2391
+                ->from('calendarobjects')
2392
+                ->where($query->expr()->in('id', $query->createNamedParameter($matches, IQueryBuilder::PARAM_INT_ARRAY)));
2393
+
2394
+            $result = $query->executeQuery();
2395
+            $calendarObjects = [];
2396
+            while (($array = $result->fetch()) !== false) {
2397
+                $array['calendarid'] = (int)$array['calendarid'];
2398
+                $array['calendartype'] = (int)$array['calendartype'];
2399
+                $array['calendardata'] = $this->readBlob($array['calendardata']);
2400
+
2401
+                $calendarObjects[] = $array;
2402
+            }
2403
+            $result->closeCursor();
2404
+            return $calendarObjects;
2405
+        }, $this->db);
2406
+    }
2407
+
2408
+    /**
2409
+     * Searches through all of a users calendars and calendar objects to find
2410
+     * an object with a specific UID.
2411
+     *
2412
+     * This method should return the path to this object, relative to the
2413
+     * calendar home, so this path usually only contains two parts:
2414
+     *
2415
+     * calendarpath/objectpath.ics
2416
+     *
2417
+     * If the uid is not found, return null.
2418
+     *
2419
+     * This method should only consider * objects that the principal owns, so
2420
+     * any calendars owned by other principals that also appear in this
2421
+     * collection should be ignored.
2422
+     *
2423
+     * @param string $principalUri
2424
+     * @param string $uid
2425
+     * @return string|null
2426
+     */
2427
+    public function getCalendarObjectByUID($principalUri, $uid, $calendarUri = null) {
2428
+        $query = $this->db->getQueryBuilder();
2429
+        $query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi')
2430
+            ->from('calendarobjects', 'co')
2431
+            ->leftJoin('co', 'calendars', 'c', $query->expr()->eq('co.calendarid', 'c.id'))
2432
+            ->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri)))
2433
+            ->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid)))
2434
+            ->andWhere($query->expr()->isNull('co.deleted_at'));
2435
+
2436
+        if ($calendarUri !== null) {
2437
+            $query->andWhere($query->expr()->eq('c.uri', $query->createNamedParameter($calendarUri)));
2438
+        }
2439
+
2440
+        $stmt = $query->executeQuery();
2441
+        $row = $stmt->fetch();
2442
+        $stmt->closeCursor();
2443
+        if ($row) {
2444
+            return $row['calendaruri'] . '/' . $row['objecturi'];
2445
+        }
2446
+
2447
+        return null;
2448
+    }
2449
+
2450
+    public function getCalendarObjectById(string $principalUri, int $id): ?array {
2451
+        $query = $this->db->getQueryBuilder();
2452
+        $query->select(['co.id', 'co.uri', 'co.lastmodified', 'co.etag', 'co.calendarid', 'co.size', 'co.calendardata', 'co.componenttype', 'co.classification', 'co.deleted_at'])
2453
+            ->selectAlias('c.uri', 'calendaruri')
2454
+            ->from('calendarobjects', 'co')
2455
+            ->join('co', 'calendars', 'c', $query->expr()->eq('c.id', 'co.calendarid', IQueryBuilder::PARAM_INT))
2456
+            ->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri)))
2457
+            ->andWhere($query->expr()->eq('co.id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
2458
+        $stmt = $query->executeQuery();
2459
+        $row = $stmt->fetch();
2460
+        $stmt->closeCursor();
2461
+
2462
+        if (!$row) {
2463
+            return null;
2464
+        }
2465
+
2466
+        return [
2467
+            'id' => $row['id'],
2468
+            'uri' => $row['uri'],
2469
+            'lastmodified' => $row['lastmodified'],
2470
+            'etag' => '"' . $row['etag'] . '"',
2471
+            'calendarid' => $row['calendarid'],
2472
+            'calendaruri' => $row['calendaruri'],
2473
+            'size' => (int)$row['size'],
2474
+            'calendardata' => $this->readBlob($row['calendardata']),
2475
+            'component' => strtolower($row['componenttype']),
2476
+            'classification' => (int)$row['classification'],
2477
+            'deleted_at' => isset($row['deleted_at']) ? ((int)$row['deleted_at']) : null,
2478
+        ];
2479
+    }
2480
+
2481
+    /**
2482
+     * The getChanges method returns all the changes that have happened, since
2483
+     * the specified syncToken in the specified calendar.
2484
+     *
2485
+     * This function should return an array, such as the following:
2486
+     *
2487
+     * [
2488
+     *   'syncToken' => 'The current synctoken',
2489
+     *   'added'   => [
2490
+     *      'new.txt',
2491
+     *   ],
2492
+     *   'modified'   => [
2493
+     *      'modified.txt',
2494
+     *   ],
2495
+     *   'deleted' => [
2496
+     *      'foo.php.bak',
2497
+     *      'old.txt'
2498
+     *   ]
2499
+     * );
2500
+     *
2501
+     * The returned syncToken property should reflect the *current* syncToken
2502
+     * of the calendar, as reported in the {http://sabredav.org/ns}sync-token
2503
+     * property This is * needed here too, to ensure the operation is atomic.
2504
+     *
2505
+     * If the $syncToken argument is specified as null, this is an initial
2506
+     * sync, and all members should be reported.
2507
+     *
2508
+     * The modified property is an array of nodenames that have changed since
2509
+     * the last token.
2510
+     *
2511
+     * The deleted property is an array with nodenames, that have been deleted
2512
+     * from collection.
2513
+     *
2514
+     * The $syncLevel argument is basically the 'depth' of the report. If it's
2515
+     * 1, you only have to report changes that happened only directly in
2516
+     * immediate descendants. If it's 2, it should also include changes from
2517
+     * the nodes below the child collections. (grandchildren)
2518
+     *
2519
+     * The $limit argument allows a client to specify how many results should
2520
+     * be returned at most. If the limit is not specified, it should be treated
2521
+     * as infinite.
2522
+     *
2523
+     * If the limit (infinite or not) is higher than you're willing to return,
2524
+     * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception.
2525
+     *
2526
+     * If the syncToken is expired (due to data cleanup) or unknown, you must
2527
+     * return null.
2528
+     *
2529
+     * The limit is 'suggestive'. You are free to ignore it.
2530
+     *
2531
+     * @param string $calendarId
2532
+     * @param string $syncToken
2533
+     * @param int $syncLevel
2534
+     * @param int|null $limit
2535
+     * @param int $calendarType
2536
+     * @return ?array
2537
+     */
2538
+    public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2539
+        $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
2540
+
2541
+        return $this->atomic(function () use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType, $table) {
2542
+            // Current synctoken
2543
+            $qb = $this->db->getQueryBuilder();
2544
+            $qb->select('synctoken')
2545
+                ->from($table)
2546
+                ->where(
2547
+                    $qb->expr()->eq('id', $qb->createNamedParameter($calendarId))
2548
+                );
2549
+            $stmt = $qb->executeQuery();
2550
+            $currentToken = $stmt->fetchOne();
2551
+            $initialSync = !is_numeric($syncToken);
2552
+
2553
+            if ($currentToken === false) {
2554
+                return null;
2555
+            }
2556
+
2557
+            // evaluate if this is a initial sync and construct appropriate command
2558
+            if ($initialSync) {
2559
+                $qb = $this->db->getQueryBuilder();
2560
+                $qb->select('uri')
2561
+                    ->from('calendarobjects')
2562
+                    ->where($qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)))
2563
+                    ->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)))
2564
+                    ->andWhere($qb->expr()->isNull('deleted_at'));
2565
+            } else {
2566
+                $qb = $this->db->getQueryBuilder();
2567
+                $qb->select('uri', $qb->func()->max('operation'))
2568
+                    ->from('calendarchanges')
2569
+                    ->where($qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)))
2570
+                    ->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)))
2571
+                    ->andWhere($qb->expr()->gte('synctoken', $qb->createNamedParameter($syncToken)))
2572
+                    ->andWhere($qb->expr()->lt('synctoken', $qb->createNamedParameter($currentToken)))
2573
+                    ->groupBy('uri');
2574
+            }
2575
+            // evaluate if limit exists
2576
+            if (is_numeric($limit)) {
2577
+                $qb->setMaxResults($limit);
2578
+            }
2579
+            // execute command
2580
+            $stmt = $qb->executeQuery();
2581
+            // build results
2582
+            $result = ['syncToken' => $currentToken, 'added' => [], 'modified' => [], 'deleted' => []];
2583
+            // retrieve results
2584
+            if ($initialSync) {
2585
+                $result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
2586
+            } else {
2587
+                // \PDO::FETCH_NUM is needed due to the inconsistent field names
2588
+                // produced by doctrine for MAX() with different databases
2589
+                while ($entry = $stmt->fetch(\PDO::FETCH_NUM)) {
2590
+                    // assign uri (column 0) to appropriate mutation based on operation (column 1)
2591
+                    // forced (int) is needed as doctrine with OCI returns the operation field as string not integer
2592
+                    match ((int)$entry[1]) {
2593
+                        1 => $result['added'][] = $entry[0],
2594
+                        2 => $result['modified'][] = $entry[0],
2595
+                        3 => $result['deleted'][] = $entry[0],
2596
+                        default => $this->logger->debug('Unknown calendar change operation detected')
2597
+                    };
2598
+                }
2599
+            }
2600
+            $stmt->closeCursor();
2601
+
2602
+            return $result;
2603
+        }, $this->db);
2604
+    }
2605
+
2606
+    /**
2607
+     * Returns a list of subscriptions for a principal.
2608
+     *
2609
+     * Every subscription is an array with the following keys:
2610
+     *  * id, a unique id that will be used by other functions to modify the
2611
+     *    subscription. This can be the same as the uri or a database key.
2612
+     *  * uri. This is just the 'base uri' or 'filename' of the subscription.
2613
+     *  * principaluri. The owner of the subscription. Almost always the same as
2614
+     *    principalUri passed to this method.
2615
+     *
2616
+     * Furthermore, all the subscription info must be returned too:
2617
+     *
2618
+     * 1. {DAV:}displayname
2619
+     * 2. {http://apple.com/ns/ical/}refreshrate
2620
+     * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos
2621
+     *    should not be stripped).
2622
+     * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms
2623
+     *    should not be stripped).
2624
+     * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if
2625
+     *    attachments should not be stripped).
2626
+     * 6. {http://calendarserver.org/ns/}source (Must be a
2627
+     *     Sabre\DAV\Property\Href).
2628
+     * 7. {http://apple.com/ns/ical/}calendar-color
2629
+     * 8. {http://apple.com/ns/ical/}calendar-order
2630
+     * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
2631
+     *    (should just be an instance of
2632
+     *    Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of
2633
+     *    default components).
2634
+     *
2635
+     * @param string $principalUri
2636
+     * @return array
2637
+     */
2638
+    public function getSubscriptionsForUser($principalUri) {
2639
+        $fields = array_column($this->subscriptionPropertyMap, 0);
2640
+        $fields[] = 'id';
2641
+        $fields[] = 'uri';
2642
+        $fields[] = 'source';
2643
+        $fields[] = 'principaluri';
2644
+        $fields[] = 'lastmodified';
2645
+        $fields[] = 'synctoken';
2646
+
2647
+        $query = $this->db->getQueryBuilder();
2648
+        $query->select($fields)
2649
+            ->from('calendarsubscriptions')
2650
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2651
+            ->orderBy('calendarorder', 'asc');
2652
+        $stmt = $query->executeQuery();
2653
+
2654
+        $subscriptions = [];
2655
+        while ($row = $stmt->fetch()) {
2656
+            $subscription = [
2657
+                'id' => $row['id'],
2658
+                'uri' => $row['uri'],
2659
+                'principaluri' => $row['principaluri'],
2660
+                'source' => $row['source'],
2661
+                'lastmodified' => $row['lastmodified'],
2662
+
2663
+                '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
2664
+                '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
2665
+            ];
2666
+
2667
+            $subscriptions[] = $this->rowToSubscription($row, $subscription);
2668
+        }
2669
+
2670
+        return $subscriptions;
2671
+    }
2672
+
2673
+    /**
2674
+     * Creates a new subscription for a principal.
2675
+     *
2676
+     * If the creation was a success, an id must be returned that can be used to reference
2677
+     * this subscription in other methods, such as updateSubscription.
2678
+     *
2679
+     * @param string $principalUri
2680
+     * @param string $uri
2681
+     * @param array $properties
2682
+     * @return mixed
2683
+     */
2684
+    public function createSubscription($principalUri, $uri, array $properties) {
2685
+        if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
2686
+            throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
2687
+        }
2688
+
2689
+        $values = [
2690
+            'principaluri' => $principalUri,
2691
+            'uri' => $uri,
2692
+            'source' => $properties['{http://calendarserver.org/ns/}source']->getHref(),
2693
+            'lastmodified' => time(),
2694
+        ];
2695
+
2696
+        $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
2697
+
2698
+        foreach ($this->subscriptionPropertyMap as $xmlName => [$dbName, $type]) {
2699
+            if (array_key_exists($xmlName, $properties)) {
2700
+                $values[$dbName] = $properties[$xmlName];
2701
+                if (in_array($dbName, $propertiesBoolean)) {
2702
+                    $values[$dbName] = true;
2703
+                }
2704
+            }
2705
+        }
2706
+
2707
+        [$subscriptionId, $subscriptionRow] = $this->atomic(function () use ($values) {
2708
+            $valuesToInsert = [];
2709
+            $query = $this->db->getQueryBuilder();
2710
+            foreach (array_keys($values) as $name) {
2711
+                $valuesToInsert[$name] = $query->createNamedParameter($values[$name]);
2712
+            }
2713
+            $query->insert('calendarsubscriptions')
2714
+                ->values($valuesToInsert)
2715
+                ->executeStatement();
2716
+
2717
+            $subscriptionId = $query->getLastInsertId();
2718
+
2719
+            $subscriptionRow = $this->getSubscriptionById($subscriptionId);
2720
+            return [$subscriptionId, $subscriptionRow];
2721
+        }, $this->db);
2722
+
2723
+        $this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent($subscriptionId, $subscriptionRow));
2724
+
2725
+        return $subscriptionId;
2726
+    }
2727
+
2728
+    /**
2729
+     * Updates a subscription
2730
+     *
2731
+     * The list of mutations is stored in a Sabre\DAV\PropPatch object.
2732
+     * To do the actual updates, you must tell this object which properties
2733
+     * you're going to process with the handle() method.
2734
+     *
2735
+     * Calling the handle method is like telling the PropPatch object "I
2736
+     * promise I can handle updating this property".
2737
+     *
2738
+     * Read the PropPatch documentation for more info and examples.
2739
+     *
2740
+     * @param mixed $subscriptionId
2741
+     * @param PropPatch $propPatch
2742
+     * @return void
2743
+     */
2744
+    public function updateSubscription($subscriptionId, PropPatch $propPatch) {
2745
+        $supportedProperties = array_keys($this->subscriptionPropertyMap);
2746
+        $supportedProperties[] = '{http://calendarserver.org/ns/}source';
2747
+
2748
+        $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
2749
+            $newValues = [];
2750
+
2751
+            foreach ($mutations as $propertyName => $propertyValue) {
2752
+                if ($propertyName === '{http://calendarserver.org/ns/}source') {
2753
+                    $newValues['source'] = $propertyValue->getHref();
2754
+                } else {
2755
+                    $fieldName = $this->subscriptionPropertyMap[$propertyName][0];
2756
+                    $newValues[$fieldName] = $propertyValue;
2757
+                }
2758
+            }
2759
+
2760
+            $subscriptionRow = $this->atomic(function () use ($subscriptionId, $newValues) {
2761
+                $query = $this->db->getQueryBuilder();
2762
+                $query->update('calendarsubscriptions')
2763
+                    ->set('lastmodified', $query->createNamedParameter(time()));
2764
+                foreach ($newValues as $fieldName => $value) {
2765
+                    $query->set($fieldName, $query->createNamedParameter($value));
2766
+                }
2767
+                $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
2768
+                    ->executeStatement();
2769
+
2770
+                return $this->getSubscriptionById($subscriptionId);
2771
+            }, $this->db);
2772
+
2773
+            $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations));
2774
+
2775
+            return true;
2776
+        });
2777
+    }
2778
+
2779
+    /**
2780
+     * Deletes a subscription.
2781
+     *
2782
+     * @param mixed $subscriptionId
2783
+     * @return void
2784
+     */
2785
+    public function deleteSubscription($subscriptionId) {
2786
+        $this->atomic(function () use ($subscriptionId): void {
2787
+            $subscriptionRow = $this->getSubscriptionById($subscriptionId);
2788
+
2789
+            $query = $this->db->getQueryBuilder();
2790
+            $query->delete('calendarsubscriptions')
2791
+                ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
2792
+                ->executeStatement();
2793
+
2794
+            $query = $this->db->getQueryBuilder();
2795
+            $query->delete('calendarobjects')
2796
+                ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2797
+                ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2798
+                ->executeStatement();
2799
+
2800
+            $query->delete('calendarchanges')
2801
+                ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2802
+                ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2803
+                ->executeStatement();
2804
+
2805
+            $query->delete($this->dbObjectPropertiesTable)
2806
+                ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2807
+                ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2808
+                ->executeStatement();
2809
+
2810
+            if ($subscriptionRow) {
2811
+                $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, []));
2812
+            }
2813
+        }, $this->db);
2814
+    }
2815
+
2816
+    /**
2817
+     * Returns a single scheduling object for the inbox collection.
2818
+     *
2819
+     * The returned array should contain the following elements:
2820
+     *   * uri - A unique basename for the object. This will be used to
2821
+     *           construct a full uri.
2822
+     *   * calendardata - The iCalendar object
2823
+     *   * lastmodified - The last modification date. Can be an int for a unix
2824
+     *                    timestamp, or a PHP DateTime object.
2825
+     *   * etag - A unique token that must change if the object changed.
2826
+     *   * size - The size of the object, in bytes.
2827
+     *
2828
+     * @param string $principalUri
2829
+     * @param string $objectUri
2830
+     * @return array
2831
+     */
2832
+    public function getSchedulingObject($principalUri, $objectUri) {
2833
+        $query = $this->db->getQueryBuilder();
2834
+        $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
2835
+            ->from('schedulingobjects')
2836
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2837
+            ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
2838
+            ->executeQuery();
2839
+
2840
+        $row = $stmt->fetch();
2841
+
2842
+        if (!$row) {
2843
+            return null;
2844
+        }
2845
+
2846
+        return [
2847
+            'uri' => $row['uri'],
2848
+            'calendardata' => $row['calendardata'],
2849
+            'lastmodified' => $row['lastmodified'],
2850
+            'etag' => '"' . $row['etag'] . '"',
2851
+            'size' => (int)$row['size'],
2852
+        ];
2853
+    }
2854
+
2855
+    /**
2856
+     * Returns all scheduling objects for the inbox collection.
2857
+     *
2858
+     * These objects should be returned as an array. Every item in the array
2859
+     * should follow the same structure as returned from getSchedulingObject.
2860
+     *
2861
+     * The main difference is that 'calendardata' is optional.
2862
+     *
2863
+     * @param string $principalUri
2864
+     * @return array
2865
+     */
2866
+    public function getSchedulingObjects($principalUri) {
2867
+        $query = $this->db->getQueryBuilder();
2868
+        $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
2869
+            ->from('schedulingobjects')
2870
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2871
+            ->executeQuery();
2872
+
2873
+        $results = [];
2874
+        while (($row = $stmt->fetch()) !== false) {
2875
+            $results[] = [
2876
+                'calendardata' => $row['calendardata'],
2877
+                'uri' => $row['uri'],
2878
+                'lastmodified' => $row['lastmodified'],
2879
+                'etag' => '"' . $row['etag'] . '"',
2880
+                'size' => (int)$row['size'],
2881
+            ];
2882
+        }
2883
+        $stmt->closeCursor();
2884
+
2885
+        return $results;
2886
+    }
2887
+
2888
+    /**
2889
+     * Deletes a scheduling object from the inbox collection.
2890
+     *
2891
+     * @param string $principalUri
2892
+     * @param string $objectUri
2893
+     * @return void
2894
+     */
2895
+    public function deleteSchedulingObject($principalUri, $objectUri) {
2896
+        $this->cachedObjects = [];
2897
+        $query = $this->db->getQueryBuilder();
2898
+        $query->delete('schedulingobjects')
2899
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2900
+            ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
2901
+            ->executeStatement();
2902
+    }
2903
+
2904
+    /**
2905
+     * Deletes all scheduling objects last modified before $modifiedBefore from the inbox collection.
2906
+     *
2907
+     * @param int $modifiedBefore
2908
+     * @param int $limit
2909
+     * @return void
2910
+     */
2911
+    public function deleteOutdatedSchedulingObjects(int $modifiedBefore, int $limit): void {
2912
+        $query = $this->db->getQueryBuilder();
2913
+        $query->select('id')
2914
+            ->from('schedulingobjects')
2915
+            ->where($query->expr()->lt('lastmodified', $query->createNamedParameter($modifiedBefore)))
2916
+            ->setMaxResults($limit);
2917
+        $result = $query->executeQuery();
2918
+        $count = $result->rowCount();
2919
+        if ($count === 0) {
2920
+            return;
2921
+        }
2922
+        $ids = array_map(static function (array $id) {
2923
+            return (int)$id[0];
2924
+        }, $result->fetchAll(\PDO::FETCH_NUM));
2925
+        $result->closeCursor();
2926
+
2927
+        $numDeleted = 0;
2928
+        $deleteQuery = $this->db->getQueryBuilder();
2929
+        $deleteQuery->delete('schedulingobjects')
2930
+            ->where($deleteQuery->expr()->in('id', $deleteQuery->createParameter('ids'), IQueryBuilder::PARAM_INT_ARRAY));
2931
+        foreach (array_chunk($ids, 1000) as $chunk) {
2932
+            $deleteQuery->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY);
2933
+            $numDeleted += $deleteQuery->executeStatement();
2934
+        }
2935
+
2936
+        if ($numDeleted === $limit) {
2937
+            $this->logger->info("Deleted $limit scheduling objects, continuing with next batch");
2938
+            $this->deleteOutdatedSchedulingObjects($modifiedBefore, $limit);
2939
+        }
2940
+    }
2941
+
2942
+    /**
2943
+     * Creates a new scheduling object. This should land in a users' inbox.
2944
+     *
2945
+     * @param string $principalUri
2946
+     * @param string $objectUri
2947
+     * @param string $objectData
2948
+     * @return void
2949
+     */
2950
+    public function createSchedulingObject($principalUri, $objectUri, $objectData) {
2951
+        $this->cachedObjects = [];
2952
+        $query = $this->db->getQueryBuilder();
2953
+        $query->insert('schedulingobjects')
2954
+            ->values([
2955
+                'principaluri' => $query->createNamedParameter($principalUri),
2956
+                'calendardata' => $query->createNamedParameter($objectData, IQueryBuilder::PARAM_LOB),
2957
+                'uri' => $query->createNamedParameter($objectUri),
2958
+                'lastmodified' => $query->createNamedParameter(time()),
2959
+                'etag' => $query->createNamedParameter(md5($objectData)),
2960
+                'size' => $query->createNamedParameter(strlen($objectData))
2961
+            ])
2962
+            ->executeStatement();
2963
+    }
2964
+
2965
+    /**
2966
+     * Adds a change record to the calendarchanges table.
2967
+     *
2968
+     * @param mixed $calendarId
2969
+     * @param string[] $objectUris
2970
+     * @param int $operation 1 = add, 2 = modify, 3 = delete.
2971
+     * @param int $calendarType
2972
+     * @return void
2973
+     */
2974
+    protected function addChanges(int $calendarId, array $objectUris, int $operation, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void {
2975
+        $this->cachedObjects = [];
2976
+        $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
2977
+
2978
+        $this->atomic(function () use ($calendarId, $objectUris, $operation, $calendarType, $table): void {
2979
+            $query = $this->db->getQueryBuilder();
2980
+            $query->select('synctoken')
2981
+                ->from($table)
2982
+                ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
2983
+            $result = $query->executeQuery();
2984
+            $syncToken = (int)$result->fetchOne();
2985
+            $result->closeCursor();
2986
+
2987
+            $query = $this->db->getQueryBuilder();
2988
+            $query->insert('calendarchanges')
2989
+                ->values([
2990
+                    'uri' => $query->createParameter('uri'),
2991
+                    'synctoken' => $query->createNamedParameter($syncToken),
2992
+                    'calendarid' => $query->createNamedParameter($calendarId),
2993
+                    'operation' => $query->createNamedParameter($operation),
2994
+                    'calendartype' => $query->createNamedParameter($calendarType),
2995
+                    'created_at' => $query->createNamedParameter(time()),
2996
+                ]);
2997
+            foreach ($objectUris as $uri) {
2998
+                $query->setParameter('uri', $uri);
2999
+                $query->executeStatement();
3000
+            }
3001
+
3002
+            $query = $this->db->getQueryBuilder();
3003
+            $query->update($table)
3004
+                ->set('synctoken', $query->createNamedParameter($syncToken + 1, IQueryBuilder::PARAM_INT))
3005
+                ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)))
3006
+                ->executeStatement();
3007
+        }, $this->db);
3008
+    }
3009
+
3010
+    public function restoreChanges(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void {
3011
+        $this->cachedObjects = [];
3012
+
3013
+        $this->atomic(function () use ($calendarId, $calendarType): void {
3014
+            $qbAdded = $this->db->getQueryBuilder();
3015
+            $qbAdded->select('uri')
3016
+                ->from('calendarobjects')
3017
+                ->where(
3018
+                    $qbAdded->expr()->andX(
3019
+                        $qbAdded->expr()->eq('calendarid', $qbAdded->createNamedParameter($calendarId)),
3020
+                        $qbAdded->expr()->eq('calendartype', $qbAdded->createNamedParameter($calendarType)),
3021
+                        $qbAdded->expr()->isNull('deleted_at'),
3022
+                    )
3023
+                );
3024
+            $resultAdded = $qbAdded->executeQuery();
3025
+            $addedUris = $resultAdded->fetchAll(\PDO::FETCH_COLUMN);
3026
+            $resultAdded->closeCursor();
3027
+            // Track everything as changed
3028
+            // Tracking the creation is not necessary because \OCA\DAV\CalDAV\CalDavBackend::getChangesForCalendar
3029
+            // only returns the last change per object.
3030
+            $this->addChanges($calendarId, $addedUris, 2, $calendarType);
3031
+
3032
+            $qbDeleted = $this->db->getQueryBuilder();
3033
+            $qbDeleted->select('uri')
3034
+                ->from('calendarobjects')
3035
+                ->where(
3036
+                    $qbDeleted->expr()->andX(
3037
+                        $qbDeleted->expr()->eq('calendarid', $qbDeleted->createNamedParameter($calendarId)),
3038
+                        $qbDeleted->expr()->eq('calendartype', $qbDeleted->createNamedParameter($calendarType)),
3039
+                        $qbDeleted->expr()->isNotNull('deleted_at'),
3040
+                    )
3041
+                );
3042
+            $resultDeleted = $qbDeleted->executeQuery();
3043
+            $deletedUris = array_map(function (string $uri) {
3044
+                return str_replace('-deleted.ics', '.ics', $uri);
3045
+            }, $resultDeleted->fetchAll(\PDO::FETCH_COLUMN));
3046
+            $resultDeleted->closeCursor();
3047
+            $this->addChanges($calendarId, $deletedUris, 3, $calendarType);
3048
+        }, $this->db);
3049
+    }
3050
+
3051
+    /**
3052
+     * Parses some information from calendar objects, used for optimized
3053
+     * calendar-queries.
3054
+     *
3055
+     * Returns an array with the following keys:
3056
+     *   * etag - An md5 checksum of the object without the quotes.
3057
+     *   * size - Size of the object in bytes
3058
+     *   * componentType - VEVENT, VTODO or VJOURNAL
3059
+     *   * firstOccurence
3060
+     *   * lastOccurence
3061
+     *   * uid - value of the UID property
3062
+     *
3063
+     * @param string $calendarData
3064
+     * @return array
3065
+     */
3066
+    public function getDenormalizedData(string $calendarData): array {
3067
+        $vObject = Reader::read($calendarData);
3068
+        $vEvents = [];
3069
+        $componentType = null;
3070
+        $component = null;
3071
+        $firstOccurrence = null;
3072
+        $lastOccurrence = null;
3073
+        $uid = null;
3074
+        $classification = self::CLASSIFICATION_PUBLIC;
3075
+        $hasDTSTART = false;
3076
+        foreach ($vObject->getComponents() as $component) {
3077
+            if ($component->name !== 'VTIMEZONE') {
3078
+                // Finding all VEVENTs, and track them
3079
+                if ($component->name === 'VEVENT') {
3080
+                    $vEvents[] = $component;
3081
+                    if ($component->DTSTART) {
3082
+                        $hasDTSTART = true;
3083
+                    }
3084
+                }
3085
+                // Track first component type and uid
3086
+                if ($uid === null) {
3087
+                    $componentType = $component->name;
3088
+                    $uid = (string)$component->UID;
3089
+                }
3090
+            }
3091
+        }
3092
+        if (!$componentType) {
3093
+            throw new BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');
3094
+        }
3095
+
3096
+        if ($hasDTSTART) {
3097
+            $component = $vEvents[0];
3098
+
3099
+            // Finding the last occurrence is a bit harder
3100
+            if (!isset($component->RRULE) && count($vEvents) === 1) {
3101
+                $firstOccurrence = $component->DTSTART->getDateTime()->getTimeStamp();
3102
+                if (isset($component->DTEND)) {
3103
+                    $lastOccurrence = $component->DTEND->getDateTime()->getTimeStamp();
3104
+                } elseif (isset($component->DURATION)) {
3105
+                    $endDate = clone $component->DTSTART->getDateTime();
3106
+                    $endDate->add(DateTimeParser::parse($component->DURATION->getValue()));
3107
+                    $lastOccurrence = $endDate->getTimeStamp();
3108
+                } elseif (!$component->DTSTART->hasTime()) {
3109
+                    $endDate = clone $component->DTSTART->getDateTime();
3110
+                    $endDate->modify('+1 day');
3111
+                    $lastOccurrence = $endDate->getTimeStamp();
3112
+                } else {
3113
+                    $lastOccurrence = $firstOccurrence;
3114
+                }
3115
+            } else {
3116
+                try {
3117
+                    $it = new EventIterator($vEvents);
3118
+                } catch (NoInstancesException $e) {
3119
+                    $this->logger->debug('Caught no instance exception for calendar data. This usually indicates invalid calendar data.', [
3120
+                        'app' => 'dav',
3121
+                        'exception' => $e,
3122
+                    ]);
3123
+                    throw new Forbidden($e->getMessage());
3124
+                }
3125
+                $maxDate = new DateTime(self::MAX_DATE);
3126
+                $firstOccurrence = $it->getDtStart()->getTimestamp();
3127
+                if ($it->isInfinite()) {
3128
+                    $lastOccurrence = $maxDate->getTimestamp();
3129
+                } else {
3130
+                    $end = $it->getDtEnd();
3131
+                    while ($it->valid() && $end < $maxDate) {
3132
+                        $end = $it->getDtEnd();
3133
+                        $it->next();
3134
+                    }
3135
+                    $lastOccurrence = $end->getTimestamp();
3136
+                }
3137
+            }
3138
+        }
3139
+
3140
+        if ($component->CLASS) {
3141
+            $classification = CalDavBackend::CLASSIFICATION_PRIVATE;
3142
+            switch ($component->CLASS->getValue()) {
3143
+                case 'PUBLIC':
3144
+                    $classification = CalDavBackend::CLASSIFICATION_PUBLIC;
3145
+                    break;
3146
+                case 'CONFIDENTIAL':
3147
+                    $classification = CalDavBackend::CLASSIFICATION_CONFIDENTIAL;
3148
+                    break;
3149
+            }
3150
+        }
3151
+        return [
3152
+            'etag' => md5($calendarData),
3153
+            'size' => strlen($calendarData),
3154
+            'componentType' => $componentType,
3155
+            'firstOccurence' => is_null($firstOccurrence) ? null : max(0, $firstOccurrence),
3156
+            'lastOccurence' => is_null($lastOccurrence) ? null : max(0, $lastOccurrence),
3157
+            'uid' => $uid,
3158
+            'classification' => $classification
3159
+        ];
3160
+    }
3161
+
3162
+    /**
3163
+     * @param $cardData
3164
+     * @return bool|string
3165
+     */
3166
+    private function readBlob($cardData) {
3167
+        if (is_resource($cardData)) {
3168
+            return stream_get_contents($cardData);
3169
+        }
3170
+
3171
+        return $cardData;
3172
+    }
3173
+
3174
+    /**
3175
+     * @param list<array{href: string, commonName: string, readOnly: bool}> $add
3176
+     * @param list<string> $remove
3177
+     */
3178
+    public function updateShares(IShareable $shareable, array $add, array $remove): void {
3179
+        $this->atomic(function () use ($shareable, $add, $remove): void {
3180
+            $calendarId = $shareable->getResourceId();
3181
+            $calendarRow = $this->getCalendarById($calendarId);
3182
+            if ($calendarRow === null) {
3183
+                throw new \RuntimeException('Trying to update shares for non-existing calendar: ' . $calendarId);
3184
+            }
3185
+            $oldShares = $this->getShares($calendarId);
3186
+
3187
+            $this->calendarSharingBackend->updateShares($shareable, $add, $remove, $oldShares);
3188
+
3189
+            $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent($calendarId, $calendarRow, $oldShares, $add, $remove));
3190
+        }, $this->db);
3191
+    }
3192
+
3193
+    /**
3194
+     * @return list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}>
3195
+     */
3196
+    public function getShares(int $resourceId): array {
3197
+        return $this->calendarSharingBackend->getShares($resourceId);
3198
+    }
3199
+
3200
+    public function preloadShares(array $resourceIds): void {
3201
+        $this->calendarSharingBackend->preloadShares($resourceIds);
3202
+    }
3203
+
3204
+    /**
3205
+     * @param boolean $value
3206
+     * @param Calendar $calendar
3207
+     * @return string|null
3208
+     */
3209
+    public function setPublishStatus($value, $calendar) {
3210
+        return $this->atomic(function () use ($value, $calendar) {
3211
+            $calendarId = $calendar->getResourceId();
3212
+            $calendarData = $this->getCalendarById($calendarId);
3213
+
3214
+            $query = $this->db->getQueryBuilder();
3215
+            if ($value) {
3216
+                $publicUri = $this->random->generate(16, ISecureRandom::CHAR_HUMAN_READABLE);
3217
+                $query->insert('dav_shares')
3218
+                    ->values([
3219
+                        'principaluri' => $query->createNamedParameter($calendar->getPrincipalURI()),
3220
+                        'type' => $query->createNamedParameter('calendar'),
3221
+                        'access' => $query->createNamedParameter(self::ACCESS_PUBLIC),
3222
+                        'resourceid' => $query->createNamedParameter($calendar->getResourceId()),
3223
+                        'publicuri' => $query->createNamedParameter($publicUri)
3224
+                    ]);
3225
+                $query->executeStatement();
3226
+
3227
+                $this->dispatcher->dispatchTyped(new CalendarPublishedEvent($calendarId, $calendarData, $publicUri));
3228
+                return $publicUri;
3229
+            }
3230
+            $query->delete('dav_shares')
3231
+                ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
3232
+                ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)));
3233
+            $query->executeStatement();
3234
+
3235
+            $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent($calendarId, $calendarData));
3236
+            return null;
3237
+        }, $this->db);
3238
+    }
3239
+
3240
+    /**
3241
+     * @param Calendar $calendar
3242
+     * @return mixed
3243
+     */
3244
+    public function getPublishStatus($calendar) {
3245
+        $query = $this->db->getQueryBuilder();
3246
+        $result = $query->select('publicuri')
3247
+            ->from('dav_shares')
3248
+            ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
3249
+            ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
3250
+            ->executeQuery();
3251
+
3252
+        $row = $result->fetch();
3253
+        $result->closeCursor();
3254
+        return $row ? reset($row) : false;
3255
+    }
3256
+
3257
+    /**
3258
+     * @param int $resourceId
3259
+     * @param list<array{privilege: string, principal: string, protected: bool}> $acl
3260
+     * @return list<array{privilege: string, principal: string, protected: bool}>
3261
+     */
3262
+    public function applyShareAcl(int $resourceId, array $acl): array {
3263
+        $shares = $this->calendarSharingBackend->getShares($resourceId);
3264
+        return $this->calendarSharingBackend->applyShareAcl($shares, $acl);
3265
+    }
3266
+
3267
+    /**
3268
+     * update properties table
3269
+     *
3270
+     * @param int $calendarId
3271
+     * @param string $objectUri
3272
+     * @param string $calendarData
3273
+     * @param int $calendarType
3274
+     */
3275
+    public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
3276
+        $this->cachedObjects = [];
3277
+        $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $calendarType): void {
3278
+            $objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType);
3279
+
3280
+            try {
3281
+                $vCalendar = $this->readCalendarData($calendarData);
3282
+            } catch (\Exception $ex) {
3283
+                return;
3284
+            }
3285
+
3286
+            $this->purgeProperties($calendarId, $objectId);
3287
+
3288
+            $query = $this->db->getQueryBuilder();
3289
+            $query->insert($this->dbObjectPropertiesTable)
3290
+                ->values(
3291
+                    [
3292
+                        'calendarid' => $query->createNamedParameter($calendarId),
3293
+                        'calendartype' => $query->createNamedParameter($calendarType),
3294
+                        'objectid' => $query->createNamedParameter($objectId),
3295
+                        'name' => $query->createParameter('name'),
3296
+                        'parameter' => $query->createParameter('parameter'),
3297
+                        'value' => $query->createParameter('value'),
3298
+                    ]
3299
+                );
3300
+
3301
+            $indexComponents = ['VEVENT', 'VJOURNAL', 'VTODO'];
3302
+            foreach ($vCalendar->getComponents() as $component) {
3303
+                if (!in_array($component->name, $indexComponents)) {
3304
+                    continue;
3305
+                }
3306
+
3307
+                foreach ($component->children() as $property) {
3308
+                    if (in_array($property->name, self::INDEXED_PROPERTIES, true)) {
3309
+                        $value = $property->getValue();
3310
+                        // is this a shitty db?
3311
+                        if (!$this->db->supports4ByteText()) {
3312
+                            $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value);
3313
+                        }
3314
+                        $value = mb_strcut($value, 0, 254);
3315
+
3316
+                        $query->setParameter('name', $property->name);
3317
+                        $query->setParameter('parameter', null);
3318
+                        $query->setParameter('value', mb_strcut($value, 0, 254));
3319
+                        $query->executeStatement();
3320
+                    }
3321
+
3322
+                    if (array_key_exists($property->name, self::$indexParameters)) {
3323
+                        $parameters = $property->parameters();
3324
+                        $indexedParametersForProperty = self::$indexParameters[$property->name];
3325
+
3326
+                        foreach ($parameters as $key => $value) {
3327
+                            if (in_array($key, $indexedParametersForProperty)) {
3328
+                                // is this a shitty db?
3329
+                                if ($this->db->supports4ByteText()) {
3330
+                                    $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value);
3331
+                                }
3332
+
3333
+                                $query->setParameter('name', $property->name);
3334
+                                $query->setParameter('parameter', mb_strcut($key, 0, 254));
3335
+                                $query->setParameter('value', mb_strcut($value, 0, 254));
3336
+                                $query->executeStatement();
3337
+                            }
3338
+                        }
3339
+                    }
3340
+                }
3341
+            }
3342
+        }, $this->db);
3343
+    }
3344
+
3345
+    /**
3346
+     * deletes all birthday calendars
3347
+     */
3348
+    public function deleteAllBirthdayCalendars() {
3349
+        $this->atomic(function (): void {
3350
+            $query = $this->db->getQueryBuilder();
3351
+            $result = $query->select(['id'])->from('calendars')
3352
+                ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
3353
+                ->executeQuery();
3354
+
3355
+            while (($row = $result->fetch()) !== false) {
3356
+                $this->deleteCalendar(
3357
+                    $row['id'],
3358
+                    true // No data to keep in the trashbin, if the user re-enables then we regenerate
3359
+                );
3360
+            }
3361
+            $result->closeCursor();
3362
+        }, $this->db);
3363
+    }
3364
+
3365
+    /**
3366
+     * @param $subscriptionId
3367
+     */
3368
+    public function purgeAllCachedEventsForSubscription($subscriptionId) {
3369
+        $this->atomic(function () use ($subscriptionId): void {
3370
+            $query = $this->db->getQueryBuilder();
3371
+            $query->select('uri')
3372
+                ->from('calendarobjects')
3373
+                ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3374
+                ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)));
3375
+            $stmt = $query->executeQuery();
3376
+
3377
+            $uris = [];
3378
+            while (($row = $stmt->fetch()) !== false) {
3379
+                $uris[] = $row['uri'];
3380
+            }
3381
+            $stmt->closeCursor();
3382
+
3383
+            $query = $this->db->getQueryBuilder();
3384
+            $query->delete('calendarobjects')
3385
+                ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3386
+                ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3387
+                ->executeStatement();
3388
+
3389
+            $query = $this->db->getQueryBuilder();
3390
+            $query->delete('calendarchanges')
3391
+                ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3392
+                ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3393
+                ->executeStatement();
3394
+
3395
+            $query = $this->db->getQueryBuilder();
3396
+            $query->delete($this->dbObjectPropertiesTable)
3397
+                ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3398
+                ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3399
+                ->executeStatement();
3400
+
3401
+            $this->addChanges($subscriptionId, $uris, 3, self::CALENDAR_TYPE_SUBSCRIPTION);
3402
+        }, $this->db);
3403
+    }
3404
+
3405
+    /**
3406
+     * @param int $subscriptionId
3407
+     * @param array<int> $calendarObjectIds
3408
+     * @param array<string> $calendarObjectUris
3409
+     */
3410
+    public function purgeCachedEventsForSubscription(int $subscriptionId, array $calendarObjectIds, array $calendarObjectUris): void {
3411
+        if (empty($calendarObjectUris)) {
3412
+            return;
3413
+        }
3414
+
3415
+        $this->atomic(function () use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void {
3416
+            foreach (array_chunk($calendarObjectIds, 1000) as $chunk) {
3417
+                $query = $this->db->getQueryBuilder();
3418
+                $query->delete($this->dbObjectPropertiesTable)
3419
+                    ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3420
+                    ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3421
+                    ->andWhere($query->expr()->in('id', $query->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY), IQueryBuilder::PARAM_INT_ARRAY))
3422
+                    ->executeStatement();
3423
+
3424
+                $query = $this->db->getQueryBuilder();
3425
+                $query->delete('calendarobjects')
3426
+                    ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3427
+                    ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3428
+                    ->andWhere($query->expr()->in('id', $query->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY), IQueryBuilder::PARAM_INT_ARRAY))
3429
+                    ->executeStatement();
3430
+            }
3431
+
3432
+            foreach (array_chunk($calendarObjectUris, 1000) as $chunk) {
3433
+                $query = $this->db->getQueryBuilder();
3434
+                $query->delete('calendarchanges')
3435
+                    ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
3436
+                    ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
3437
+                    ->andWhere($query->expr()->in('uri', $query->createNamedParameter($chunk, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY))
3438
+                    ->executeStatement();
3439
+            }
3440
+            $this->addChanges($subscriptionId, $calendarObjectUris, 3, self::CALENDAR_TYPE_SUBSCRIPTION);
3441
+        }, $this->db);
3442
+    }
3443
+
3444
+    /**
3445
+     * Move a calendar from one user to another
3446
+     *
3447
+     * @param string $uriName
3448
+     * @param string $uriOrigin
3449
+     * @param string $uriDestination
3450
+     * @param string $newUriName (optional) the new uriName
3451
+     */
3452
+    public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName = null) {
3453
+        $query = $this->db->getQueryBuilder();
3454
+        $query->update('calendars')
3455
+            ->set('principaluri', $query->createNamedParameter($uriDestination))
3456
+            ->set('uri', $query->createNamedParameter($newUriName ?: $uriName))
3457
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($uriOrigin)))
3458
+            ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($uriName)))
3459
+            ->executeStatement();
3460
+    }
3461
+
3462
+    /**
3463
+     * read VCalendar data into a VCalendar object
3464
+     *
3465
+     * @param string $objectData
3466
+     * @return VCalendar
3467
+     */
3468
+    protected function readCalendarData($objectData) {
3469
+        return Reader::read($objectData);
3470
+    }
3471
+
3472
+    /**
3473
+     * delete all properties from a given calendar object
3474
+     *
3475
+     * @param int $calendarId
3476
+     * @param int $objectId
3477
+     */
3478
+    protected function purgeProperties($calendarId, $objectId) {
3479
+        $this->cachedObjects = [];
3480
+        $query = $this->db->getQueryBuilder();
3481
+        $query->delete($this->dbObjectPropertiesTable)
3482
+            ->where($query->expr()->eq('objectid', $query->createNamedParameter($objectId)))
3483
+            ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)));
3484
+        $query->executeStatement();
3485
+    }
3486
+
3487
+    /**
3488
+     * get ID from a given calendar object
3489
+     *
3490
+     * @param int $calendarId
3491
+     * @param string $uri
3492
+     * @param int $calendarType
3493
+     * @return int
3494
+     */
3495
+    protected function getCalendarObjectId($calendarId, $uri, $calendarType):int {
3496
+        $query = $this->db->getQueryBuilder();
3497
+        $query->select('id')
3498
+            ->from('calendarobjects')
3499
+            ->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
3500
+            ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
3501
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
3502
+
3503
+        $result = $query->executeQuery();
3504
+        $objectIds = $result->fetch();
3505
+        $result->closeCursor();
3506
+
3507
+        if (!isset($objectIds['id'])) {
3508
+            throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
3509
+        }
3510
+
3511
+        return (int)$objectIds['id'];
3512
+    }
3513
+
3514
+    /**
3515
+     * @throws \InvalidArgumentException
3516
+     */
3517
+    public function pruneOutdatedSyncTokens(int $keep, int $retention): int {
3518
+        if ($keep < 0) {
3519
+            throw new \InvalidArgumentException();
3520
+        }
3521
+
3522
+        $query = $this->db->getQueryBuilder();
3523
+        $query->select($query->func()->max('id'))
3524
+            ->from('calendarchanges');
3525
+
3526
+        $result = $query->executeQuery();
3527
+        $maxId = (int)$result->fetchOne();
3528
+        $result->closeCursor();
3529
+        if (!$maxId || $maxId < $keep) {
3530
+            return 0;
3531
+        }
3532
+
3533
+        $query = $this->db->getQueryBuilder();
3534
+        $query->delete('calendarchanges')
3535
+            ->where(
3536
+                $query->expr()->lte('id', $query->createNamedParameter($maxId - $keep, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT),
3537
+                $query->expr()->lte('created_at', $query->createNamedParameter($retention)),
3538
+            );
3539
+        return $query->executeStatement();
3540
+    }
3541
+
3542
+    /**
3543
+     * return legacy endpoint principal name to new principal name
3544
+     *
3545
+     * @param $principalUri
3546
+     * @param $toV2
3547
+     * @return string
3548
+     */
3549
+    private function convertPrincipal($principalUri, $toV2) {
3550
+        if ($this->principalBackend->getPrincipalPrefix() === 'principals') {
3551
+            [, $name] = Uri\split($principalUri);
3552
+            if ($toV2 === true) {
3553
+                return "principals/users/$name";
3554
+            }
3555
+            return "principals/$name";
3556
+        }
3557
+        return $principalUri;
3558
+    }
3559
+
3560
+    /**
3561
+     * adds information about an owner to the calendar data
3562
+     *
3563
+     */
3564
+    private function addOwnerPrincipalToCalendar(array $calendarInfo): array {
3565
+        $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
3566
+        $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
3567
+        if (isset($calendarInfo[$ownerPrincipalKey])) {
3568
+            $uri = $calendarInfo[$ownerPrincipalKey];
3569
+        } else {
3570
+            $uri = $calendarInfo['principaluri'];
3571
+        }
3572
+
3573
+        $principalInformation = $this->principalBackend->getPrincipalByPath($uri);
3574
+        if (isset($principalInformation['{DAV:}displayname'])) {
3575
+            $calendarInfo[$displaynameKey] = $principalInformation['{DAV:}displayname'];
3576
+        }
3577
+        return $calendarInfo;
3578
+    }
3579
+
3580
+    private function addResourceTypeToCalendar(array $row, array $calendar): array {
3581
+        if (isset($row['deleted_at'])) {
3582
+            // Columns is set and not null -> this is a deleted calendar
3583
+            // we send a custom resourcetype to hide the deleted calendar
3584
+            // from ordinary DAV clients, but the Calendar app will know
3585
+            // how to handle this special resource.
3586
+            $calendar['{DAV:}resourcetype'] = new DAV\Xml\Property\ResourceType([
3587
+                '{DAV:}collection',
3588
+                sprintf('{%s}deleted-calendar', \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD),
3589
+            ]);
3590
+        }
3591
+        return $calendar;
3592
+    }
3593
+
3594
+    /**
3595
+     * Amend the calendar info with database row data
3596
+     *
3597
+     * @param array $row
3598
+     * @param array $calendar
3599
+     *
3600
+     * @return array
3601
+     */
3602
+    private function rowToCalendar($row, array $calendar): array {
3603
+        foreach ($this->propertyMap as $xmlName => [$dbName, $type]) {
3604
+            $value = $row[$dbName];
3605
+            if ($value !== null) {
3606
+                settype($value, $type);
3607
+            }
3608
+            $calendar[$xmlName] = $value;
3609
+        }
3610
+        return $calendar;
3611
+    }
3612
+
3613
+    /**
3614
+     * Amend the subscription info with database row data
3615
+     *
3616
+     * @param array $row
3617
+     * @param array $subscription
3618
+     *
3619
+     * @return array
3620
+     */
3621
+    private function rowToSubscription($row, array $subscription): array {
3622
+        foreach ($this->subscriptionPropertyMap as $xmlName => [$dbName, $type]) {
3623
+            $value = $row[$dbName];
3624
+            if ($value !== null) {
3625
+                settype($value, $type);
3626
+            }
3627
+            $subscription[$xmlName] = $value;
3628
+        }
3629
+        return $subscription;
3630
+    }
3631
+
3632
+    /**
3633
+     * delete all invitations from a given calendar
3634
+     *
3635
+     * @since 31.0.0
3636
+     *
3637
+     * @param int $calendarId
3638
+     *
3639
+     * @return void
3640
+     */
3641
+    protected function purgeCalendarInvitations(int $calendarId): void {
3642
+        // select all calendar object uid's
3643
+        $cmd = $this->db->getQueryBuilder();
3644
+        $cmd->select('uid')
3645
+            ->from($this->dbObjectsTable)
3646
+            ->where($cmd->expr()->eq('calendarid', $cmd->createNamedParameter($calendarId)));
3647
+        $allIds = $cmd->executeQuery()->fetchAll(\PDO::FETCH_COLUMN);
3648
+        // delete all links that match object uid's
3649
+        $cmd = $this->db->getQueryBuilder();
3650
+        $cmd->delete($this->dbObjectInvitationsTable)
3651
+            ->where($cmd->expr()->in('uid', $cmd->createParameter('uids'), IQueryBuilder::PARAM_STR_ARRAY));
3652
+        foreach (array_chunk($allIds, 1000) as $chunkIds) {
3653
+            $cmd->setParameter('uids', $chunkIds, IQueryBuilder::PARAM_STR_ARRAY);
3654
+            $cmd->executeStatement();
3655
+        }
3656
+    }
3657
+
3658
+    /**
3659
+     * Delete all invitations from a given calendar event
3660
+     *
3661
+     * @since 31.0.0
3662
+     *
3663
+     * @param string $eventId UID of the event
3664
+     *
3665
+     * @return void
3666
+     */
3667
+    protected function purgeObjectInvitations(string $eventId): void {
3668
+        $cmd = $this->db->getQueryBuilder();
3669
+        $cmd->delete($this->dbObjectInvitationsTable)
3670
+            ->where($cmd->expr()->eq('uid', $cmd->createNamedParameter($eventId, IQueryBuilder::PARAM_STR), IQueryBuilder::PARAM_STR));
3671
+        $cmd->executeStatement();
3672
+    }
3673
+
3674
+    public function unshare(IShareable $shareable, string $principal): void {
3675
+        $this->atomic(function () use ($shareable, $principal): void {
3676
+            $calendarData = $this->getCalendarById($shareable->getResourceId());
3677
+            if ($calendarData === null) {
3678
+                throw new \RuntimeException('Trying to update shares for non-existing calendar: ' . $shareable->getResourceId());
3679
+            }
3680
+
3681
+            $oldShares = $this->getShares($shareable->getResourceId());
3682
+            $unshare = $this->calendarSharingBackend->unshare($shareable, $principal);
3683
+
3684
+            if ($unshare) {
3685
+                $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent(
3686
+                    $shareable->getResourceId(),
3687
+                    $calendarData,
3688
+                    $oldShares,
3689
+                    [],
3690
+                    [$principal]
3691
+                ));
3692
+            }
3693
+        }, $this->db);
3694
+    }
3695 3695
 }
Please login to merge, or discard this patch.
apps/dav/lib/Command/ImportCalendar.php 2 patches
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -27,163 +27,163 @@
 block discarded – undo
27 27
  * Used to import data to supported calendars from disk or stdin
28 28
  */
29 29
 #[AsCommand(
30
-	name: 'calendar:import',
31
-	description: 'Import calendar data to supported calendars from disk or stdin',
32
-	hidden: false
30
+    name: 'calendar:import',
31
+    description: 'Import calendar data to supported calendars from disk or stdin',
32
+    hidden: false
33 33
 )]
34 34
 class ImportCalendar extends Command {
35
-	public function __construct(
36
-		private IUserManager $userManager,
37
-		private IManager $calendarManager,
38
-		private ITempManager $tempManager,
39
-		private ImportService $importService,
40
-	) {
41
-		parent::__construct();
42
-	}
35
+    public function __construct(
36
+        private IUserManager $userManager,
37
+        private IManager $calendarManager,
38
+        private ITempManager $tempManager,
39
+        private ImportService $importService,
40
+    ) {
41
+        parent::__construct();
42
+    }
43 43
 
44
-	protected function configure(): void {
45
-		$this->setName('calendar:import')
46
-			->setDescription('Import calendar data to supported calendars from disk or stdin')
47
-			->addArgument('uid', InputArgument::REQUIRED, 'Id of system user')
48
-			->addArgument('uri', InputArgument::REQUIRED, 'Uri of calendar')
49
-			->addArgument('location', InputArgument::OPTIONAL, 'Location to read the input from, defaults to stdin.')
50
-			->addOption('format', null, InputOption::VALUE_REQUIRED, 'Format of input (ical, jcal, xcal) defaults to ical', 'ical')
51
-			->addOption('errors', null, InputOption::VALUE_REQUIRED, 'how to handel item errors (0 - continue, 1 - fail)')
52
-			->addOption('validation', null, InputOption::VALUE_REQUIRED, 'how to handel item validation (0 - no validation, 1 - validate and skip on issue, 2 - validate and fail on issue)')
53
-			->addOption('supersede', null, InputOption::VALUE_NONE, 'override/replace existing items')
54
-			->addOption('show-created', null, InputOption::VALUE_NONE, 'show all created items after processing')
55
-			->addOption('show-updated', null, InputOption::VALUE_NONE, 'show all updated items after processing')
56
-			->addOption('show-skipped', null, InputOption::VALUE_NONE, 'show all skipped items after processing')
57
-			->addOption('show-errors', null, InputOption::VALUE_NONE, 'show all errored items after processing');
58
-	}
44
+    protected function configure(): void {
45
+        $this->setName('calendar:import')
46
+            ->setDescription('Import calendar data to supported calendars from disk or stdin')
47
+            ->addArgument('uid', InputArgument::REQUIRED, 'Id of system user')
48
+            ->addArgument('uri', InputArgument::REQUIRED, 'Uri of calendar')
49
+            ->addArgument('location', InputArgument::OPTIONAL, 'Location to read the input from, defaults to stdin.')
50
+            ->addOption('format', null, InputOption::VALUE_REQUIRED, 'Format of input (ical, jcal, xcal) defaults to ical', 'ical')
51
+            ->addOption('errors', null, InputOption::VALUE_REQUIRED, 'how to handel item errors (0 - continue, 1 - fail)')
52
+            ->addOption('validation', null, InputOption::VALUE_REQUIRED, 'how to handel item validation (0 - no validation, 1 - validate and skip on issue, 2 - validate and fail on issue)')
53
+            ->addOption('supersede', null, InputOption::VALUE_NONE, 'override/replace existing items')
54
+            ->addOption('show-created', null, InputOption::VALUE_NONE, 'show all created items after processing')
55
+            ->addOption('show-updated', null, InputOption::VALUE_NONE, 'show all updated items after processing')
56
+            ->addOption('show-skipped', null, InputOption::VALUE_NONE, 'show all skipped items after processing')
57
+            ->addOption('show-errors', null, InputOption::VALUE_NONE, 'show all errored items after processing');
58
+    }
59 59
 
60
-	protected function execute(InputInterface $input, OutputInterface $output): int {
61
-		$userId = $input->getArgument('uid');
62
-		$calendarId = $input->getArgument('uri');
63
-		$location = $input->getArgument('location');
64
-		$format = $input->getOption('format');
65
-		$errors = is_numeric($input->getOption('errors')) ? (int)$input->getOption('errors') : null;
66
-		$validation = is_numeric($input->getOption('validation')) ? (int)$input->getOption('validation') : null;
67
-		$supersede = $input->getOption('supersede');
68
-		$showCreated = $input->getOption('show-created');
69
-		$showUpdated = $input->getOption('show-updated');
70
-		$showSkipped = $input->getOption('show-skipped');
71
-		$showErrors = $input->getOption('show-errors');
60
+    protected function execute(InputInterface $input, OutputInterface $output): int {
61
+        $userId = $input->getArgument('uid');
62
+        $calendarId = $input->getArgument('uri');
63
+        $location = $input->getArgument('location');
64
+        $format = $input->getOption('format');
65
+        $errors = is_numeric($input->getOption('errors')) ? (int)$input->getOption('errors') : null;
66
+        $validation = is_numeric($input->getOption('validation')) ? (int)$input->getOption('validation') : null;
67
+        $supersede = $input->getOption('supersede');
68
+        $showCreated = $input->getOption('show-created');
69
+        $showUpdated = $input->getOption('show-updated');
70
+        $showSkipped = $input->getOption('show-skipped');
71
+        $showErrors = $input->getOption('show-errors');
72 72
 
73
-		if (!$this->userManager->userExists($userId)) {
74
-			throw new InvalidArgumentException("User <$userId> not found.");
75
-		}
76
-		// retrieve calendar and evaluate if import is supported and writeable
77
-		$calendars = $this->calendarManager->getCalendarsForPrincipal('principals/users/' . $userId, [$calendarId]);
78
-		if ($calendars === []) {
79
-			throw new InvalidArgumentException("Calendar <$calendarId> not found");
80
-		}
81
-		$calendar = $calendars[0];
82
-		if (!$calendar instanceof CalendarImpl) {
83
-			throw new InvalidArgumentException("Calendar <$calendarId> doesn't support this function");
84
-		}
85
-		if (!$calendar->isWritable()) {
86
-			throw new InvalidArgumentException("Calendar <$calendarId> is not writeable");
87
-		}
88
-		if ($calendar->isDeleted()) {
89
-			throw new InvalidArgumentException("Calendar <$calendarId> is deleted");
90
-		}
91
-		// construct options object
92
-		$options = new CalendarImportOptions();
93
-		$options->setSupersede($supersede);
94
-		if ($errors !== null) {
95
-			$options->setErrors($errors);
96
-		}
97
-		if ($validation !== null) {
98
-			$options->setValidate($validation);
99
-		}
100
-		$options->setFormat($format);
101
-		// evaluate if a valid location was given and is usable otherwise default to stdin
102
-		$timeStarted = microtime(true);
103
-		if ($location !== null) {
104
-			$input = fopen($location, 'r');
105
-			if ($input === false) {
106
-				throw new InvalidArgumentException("Location <$location> is not valid. Can not open location for read operation.");
107
-			}
108
-			try {
109
-				$outcome = $this->importService->import($input, $calendar, $options);
110
-			} finally {
111
-				fclose($input);
112
-			}
113
-		} else {
114
-			$input = fopen('php://stdin', 'r');
115
-			if ($input === false) {
116
-				throw new InvalidArgumentException('Can not open stdin for read operation.');
117
-			}
118
-			try {
119
-				$tempPath = $this->tempManager->getTemporaryFile();
120
-				$tempFile = fopen($tempPath, 'w+');
121
-				while (!feof($input)) {
122
-					fwrite($tempFile, fread($input, 8192));
123
-				}
124
-				fseek($tempFile, 0);
125
-				$outcome = $this->importService->import($tempFile, $calendar, $options);
126
-			} finally {
127
-				fclose($input);
128
-				fclose($tempFile);
129
-			}
130
-		}
131
-		$timeFinished = microtime(true);
73
+        if (!$this->userManager->userExists($userId)) {
74
+            throw new InvalidArgumentException("User <$userId> not found.");
75
+        }
76
+        // retrieve calendar and evaluate if import is supported and writeable
77
+        $calendars = $this->calendarManager->getCalendarsForPrincipal('principals/users/' . $userId, [$calendarId]);
78
+        if ($calendars === []) {
79
+            throw new InvalidArgumentException("Calendar <$calendarId> not found");
80
+        }
81
+        $calendar = $calendars[0];
82
+        if (!$calendar instanceof CalendarImpl) {
83
+            throw new InvalidArgumentException("Calendar <$calendarId> doesn't support this function");
84
+        }
85
+        if (!$calendar->isWritable()) {
86
+            throw new InvalidArgumentException("Calendar <$calendarId> is not writeable");
87
+        }
88
+        if ($calendar->isDeleted()) {
89
+            throw new InvalidArgumentException("Calendar <$calendarId> is deleted");
90
+        }
91
+        // construct options object
92
+        $options = new CalendarImportOptions();
93
+        $options->setSupersede($supersede);
94
+        if ($errors !== null) {
95
+            $options->setErrors($errors);
96
+        }
97
+        if ($validation !== null) {
98
+            $options->setValidate($validation);
99
+        }
100
+        $options->setFormat($format);
101
+        // evaluate if a valid location was given and is usable otherwise default to stdin
102
+        $timeStarted = microtime(true);
103
+        if ($location !== null) {
104
+            $input = fopen($location, 'r');
105
+            if ($input === false) {
106
+                throw new InvalidArgumentException("Location <$location> is not valid. Can not open location for read operation.");
107
+            }
108
+            try {
109
+                $outcome = $this->importService->import($input, $calendar, $options);
110
+            } finally {
111
+                fclose($input);
112
+            }
113
+        } else {
114
+            $input = fopen('php://stdin', 'r');
115
+            if ($input === false) {
116
+                throw new InvalidArgumentException('Can not open stdin for read operation.');
117
+            }
118
+            try {
119
+                $tempPath = $this->tempManager->getTemporaryFile();
120
+                $tempFile = fopen($tempPath, 'w+');
121
+                while (!feof($input)) {
122
+                    fwrite($tempFile, fread($input, 8192));
123
+                }
124
+                fseek($tempFile, 0);
125
+                $outcome = $this->importService->import($tempFile, $calendar, $options);
126
+            } finally {
127
+                fclose($input);
128
+                fclose($tempFile);
129
+            }
130
+        }
131
+        $timeFinished = microtime(true);
132 132
 
133
-		// summarize the outcome
134
-		$totalCreated = 0;
135
-		$totalUpdated = 0;
136
-		$totalSkipped = 0;
137
-		$totalErrors = 0;
133
+        // summarize the outcome
134
+        $totalCreated = 0;
135
+        $totalUpdated = 0;
136
+        $totalSkipped = 0;
137
+        $totalErrors = 0;
138 138
 
139
-		if ($outcome !== []) {
140
-			if ($showCreated || $showUpdated || $showSkipped || $showErrors) {
141
-				$output->writeln('');
142
-			}
143
-			foreach ($outcome as $id => $result) {
144
-				if (isset($result['outcome'])) {
145
-					switch ($result['outcome']) {
146
-						case 'created':
147
-							$totalCreated++;
148
-							if ($showCreated) {
149
-								$output->writeln(['created: ' . $id]);
150
-							}
151
-							break;
152
-						case 'updated':
153
-							$totalUpdated++;
154
-							if ($showUpdated) {
155
-								$output->writeln(['updated: ' . $id]);
156
-							}
157
-							break;
158
-						case 'exists':
159
-							$totalSkipped++;
160
-							if ($showSkipped) {
161
-								$output->writeln(['skipped: ' . $id]);
162
-							}
163
-							break;
164
-						case 'error':
165
-							$totalErrors++;
166
-							if ($showErrors) {
167
-								$output->writeln(['errors: ' . $id]);
168
-								$output->writeln($result['errors']);
169
-							}
170
-							break;
171
-					}
172
-				}
173
-			}
174
-		}
175
-		$output->writeln([
176
-			'',
177
-			'Import Completed',
178
-			'================',
179
-			'Execution Time: ' . ($timeFinished - $timeStarted) . ' sec',
180
-			'Total Created: ' . $totalCreated,
181
-			'Total Updated: ' . $totalUpdated,
182
-			'Total Skipped: ' . $totalSkipped,
183
-			'Total Errors: ' . $totalErrors,
184
-			''
185
-		]);
139
+        if ($outcome !== []) {
140
+            if ($showCreated || $showUpdated || $showSkipped || $showErrors) {
141
+                $output->writeln('');
142
+            }
143
+            foreach ($outcome as $id => $result) {
144
+                if (isset($result['outcome'])) {
145
+                    switch ($result['outcome']) {
146
+                        case 'created':
147
+                            $totalCreated++;
148
+                            if ($showCreated) {
149
+                                $output->writeln(['created: ' . $id]);
150
+                            }
151
+                            break;
152
+                        case 'updated':
153
+                            $totalUpdated++;
154
+                            if ($showUpdated) {
155
+                                $output->writeln(['updated: ' . $id]);
156
+                            }
157
+                            break;
158
+                        case 'exists':
159
+                            $totalSkipped++;
160
+                            if ($showSkipped) {
161
+                                $output->writeln(['skipped: ' . $id]);
162
+                            }
163
+                            break;
164
+                        case 'error':
165
+                            $totalErrors++;
166
+                            if ($showErrors) {
167
+                                $output->writeln(['errors: ' . $id]);
168
+                                $output->writeln($result['errors']);
169
+                            }
170
+                            break;
171
+                    }
172
+                }
173
+            }
174
+        }
175
+        $output->writeln([
176
+            '',
177
+            'Import Completed',
178
+            '================',
179
+            'Execution Time: ' . ($timeFinished - $timeStarted) . ' sec',
180
+            'Total Created: ' . $totalCreated,
181
+            'Total Updated: ' . $totalUpdated,
182
+            'Total Skipped: ' . $totalSkipped,
183
+            'Total Errors: ' . $totalErrors,
184
+            ''
185
+        ]);
186 186
 
187
-		return self::SUCCESS;
188
-	}
187
+        return self::SUCCESS;
188
+    }
189 189
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 		$calendarId = $input->getArgument('uri');
63 63
 		$location = $input->getArgument('location');
64 64
 		$format = $input->getOption('format');
65
-		$errors = is_numeric($input->getOption('errors')) ? (int)$input->getOption('errors') : null;
66
-		$validation = is_numeric($input->getOption('validation')) ? (int)$input->getOption('validation') : null;
65
+		$errors = is_numeric($input->getOption('errors')) ? (int) $input->getOption('errors') : null;
66
+		$validation = is_numeric($input->getOption('validation')) ? (int) $input->getOption('validation') : null;
67 67
 		$supersede = $input->getOption('supersede');
68 68
 		$showCreated = $input->getOption('show-created');
69 69
 		$showUpdated = $input->getOption('show-updated');
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 			throw new InvalidArgumentException("User <$userId> not found.");
75 75
 		}
76 76
 		// retrieve calendar and evaluate if import is supported and writeable
77
-		$calendars = $this->calendarManager->getCalendarsForPrincipal('principals/users/' . $userId, [$calendarId]);
77
+		$calendars = $this->calendarManager->getCalendarsForPrincipal('principals/users/'.$userId, [$calendarId]);
78 78
 		if ($calendars === []) {
79 79
 			throw new InvalidArgumentException("Calendar <$calendarId> not found");
80 80
 		}
@@ -146,25 +146,25 @@  discard block
 block discarded – undo
146 146
 						case 'created':
147 147
 							$totalCreated++;
148 148
 							if ($showCreated) {
149
-								$output->writeln(['created: ' . $id]);
149
+								$output->writeln(['created: '.$id]);
150 150
 							}
151 151
 							break;
152 152
 						case 'updated':
153 153
 							$totalUpdated++;
154 154
 							if ($showUpdated) {
155
-								$output->writeln(['updated: ' . $id]);
155
+								$output->writeln(['updated: '.$id]);
156 156
 							}
157 157
 							break;
158 158
 						case 'exists':
159 159
 							$totalSkipped++;
160 160
 							if ($showSkipped) {
161
-								$output->writeln(['skipped: ' . $id]);
161
+								$output->writeln(['skipped: '.$id]);
162 162
 							}
163 163
 							break;
164 164
 						case 'error':
165 165
 							$totalErrors++;
166 166
 							if ($showErrors) {
167
-								$output->writeln(['errors: ' . $id]);
167
+								$output->writeln(['errors: '.$id]);
168 168
 								$output->writeln($result['errors']);
169 169
 							}
170 170
 							break;
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 			'',
177 177
 			'Import Completed',
178 178
 			'================',
179
-			'Execution Time: ' . ($timeFinished - $timeStarted) . ' sec',
180
-			'Total Created: ' . $totalCreated,
181
-			'Total Updated: ' . $totalUpdated,
182
-			'Total Skipped: ' . $totalSkipped,
183
-			'Total Errors: ' . $totalErrors,
179
+			'Execution Time: '.($timeFinished - $timeStarted).' sec',
180
+			'Total Created: '.$totalCreated,
181
+			'Total Updated: '.$totalUpdated,
182
+			'Total Skipped: '.$totalSkipped,
183
+			'Total Errors: '.$totalErrors,
184 184
 			''
185 185
 		]);
186 186
 
Please login to merge, or discard this patch.