Passed
Push — master ( fdf54e...22ba8f )
by Morris
25:54 queued 12s
created
apps/dav/lib/Listener/CalendarDeletionReminderUpdaterListener.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -38,37 +38,37 @@
 block discarded – undo
38 38
  */
39 39
 class CalendarDeletionReminderUpdaterListener implements IEventListener {
40 40
 
41
-	/** @var ReminderBackend */
42
-	private $reminderBackend;
41
+    /** @var ReminderBackend */
42
+    private $reminderBackend;
43 43
 
44
-	/** @var LoggerInterface */
45
-	private $logger;
44
+    /** @var LoggerInterface */
45
+    private $logger;
46 46
 
47
-	public function __construct(ReminderBackend $reminderBackend,
48
-								LoggerInterface $logger) {
49
-		$this->reminderBackend = $reminderBackend;
50
-		$this->logger = $logger;
51
-	}
47
+    public function __construct(ReminderBackend $reminderBackend,
48
+                                LoggerInterface $logger) {
49
+        $this->reminderBackend = $reminderBackend;
50
+        $this->logger = $logger;
51
+    }
52 52
 
53
-	public function handle(Event $event): void {
54
-		if (!($event instanceof CalendarDeletedEvent)) {
55
-			// Not what we subscribed to
56
-			return;
57
-		}
53
+    public function handle(Event $event): void {
54
+        if (!($event instanceof CalendarDeletedEvent)) {
55
+            // Not what we subscribed to
56
+            return;
57
+        }
58 58
 
59
-		try {
60
-			$this->reminderBackend->cleanRemindersForCalendar(
61
-				$event->getCalendarId()
62
-			);
59
+        try {
60
+            $this->reminderBackend->cleanRemindersForCalendar(
61
+                $event->getCalendarId()
62
+            );
63 63
 
64
-			$this->logger->debug(
65
-				sprintf('Reminders of calendar %d cleaned up', $event->getCalendarId())
66
-			);
67
-		} catch (Throwable $e) {
68
-			// Any error with activities shouldn't abort the calendar deletion, so we just log it
69
-			$this->logger->error('Error cleaning up reminders of a deleted calendar: ' . $e->getMessage(), [
70
-				'exception' => $e,
71
-			]);
72
-		}
73
-	}
64
+            $this->logger->debug(
65
+                sprintf('Reminders of calendar %d cleaned up', $event->getCalendarId())
66
+            );
67
+        } catch (Throwable $e) {
68
+            // Any error with activities shouldn't abort the calendar deletion, so we just log it
69
+            $this->logger->error('Error cleaning up reminders of a deleted calendar: ' . $e->getMessage(), [
70
+                'exception' => $e,
71
+            ]);
72
+        }
73
+    }
74 74
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
 			);
67 67
 		} catch (Throwable $e) {
68 68
 			// Any error with activities shouldn't abort the calendar deletion, so we just log it
69
-			$this->logger->error('Error cleaning up reminders of a deleted calendar: ' . $e->getMessage(), [
69
+			$this->logger->error('Error cleaning up reminders of a deleted calendar: '.$e->getMessage(), [
70 70
 				'exception' => $e,
71 71
 			]);
72 72
 		}
Please login to merge, or discard this patch.
apps/dav/lib/Listener/CalendarDeletionDefaultUpdaterListener.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -38,49 +38,49 @@
 block discarded – undo
38 38
  */
39 39
 class CalendarDeletionDefaultUpdaterListener implements IEventListener {
40 40
 
41
-	/** @var IConfig */
42
-	private $config;
41
+    /** @var IConfig */
42
+    private $config;
43 43
 
44
-	/** @var LoggerInterface */
45
-	private $logger;
44
+    /** @var LoggerInterface */
45
+    private $logger;
46 46
 
47
-	public function __construct(IConfig $config,
48
-								LoggerInterface $logger) {
49
-		$this->config = $config;
50
-		$this->logger = $logger;
51
-	}
47
+    public function __construct(IConfig $config,
48
+                                LoggerInterface $logger) {
49
+        $this->config = $config;
50
+        $this->logger = $logger;
51
+    }
52 52
 
53
-	/**
54
-	 * In case the user has set their default calendar to the deleted one
55
-	 */
56
-	public function handle(Event $event): void {
57
-		if (!($event instanceof CalendarDeletedEvent)) {
58
-			// Not what we subscribed to
59
-			return;
60
-		}
53
+    /**
54
+     * In case the user has set their default calendar to the deleted one
55
+     */
56
+    public function handle(Event $event): void {
57
+        if (!($event instanceof CalendarDeletedEvent)) {
58
+            // Not what we subscribed to
59
+            return;
60
+        }
61 61
 
62
-		try {
63
-			$principalUri = $event->getCalendarData()['principaluri'];
64
-			if (strpos($principalUri, 'principals/users') !== 0) {
65
-				$this->logger->debug('Default calendar needs no update because the deleted calendar does not belong to a user principal');
66
-				return;
67
-			}
62
+        try {
63
+            $principalUri = $event->getCalendarData()['principaluri'];
64
+            if (strpos($principalUri, 'principals/users') !== 0) {
65
+                $this->logger->debug('Default calendar needs no update because the deleted calendar does not belong to a user principal');
66
+                return;
67
+            }
68 68
 
69
-			[, $uid] = \Sabre\Uri\split($principalUri);
70
-			$uri = $event->getCalendarData()['uri'];
71
-			if ($this->config->getUserValue($uid, 'dav', 'defaultCalendar') !== $uri) {
72
-				$this->logger->debug('Default calendar needs no update because the deleted calendar is no the user\'s default one');
73
-				return;
74
-			}
69
+            [, $uid] = \Sabre\Uri\split($principalUri);
70
+            $uri = $event->getCalendarData()['uri'];
71
+            if ($this->config->getUserValue($uid, 'dav', 'defaultCalendar') !== $uri) {
72
+                $this->logger->debug('Default calendar needs no update because the deleted calendar is no the user\'s default one');
73
+                return;
74
+            }
75 75
 
76
-			$this->config->deleteUserValue($uid, 'dav', 'defaultCalendar');
76
+            $this->config->deleteUserValue($uid, 'dav', 'defaultCalendar');
77 77
 
78
-			$this->logger->debug('Default user calendar reset');
79
-		} catch (Throwable $e) {
80
-			// Any error with activities shouldn't abort the calendar deletion, so we just log it
81
-			$this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [
82
-				'exception' => $e,
83
-			]);
84
-		}
85
-	}
78
+            $this->logger->debug('Default user calendar reset');
79
+        } catch (Throwable $e) {
80
+            // Any error with activities shouldn't abort the calendar deletion, so we just log it
81
+            $this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [
82
+                'exception' => $e,
83
+            ]);
84
+        }
85
+    }
86 86
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 			$this->logger->debug('Default user calendar reset');
79 79
 		} catch (Throwable $e) {
80 80
 			// Any error with activities shouldn't abort the calendar deletion, so we just log it
81
-			$this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [
81
+			$this->logger->error('Error generating activities for a deleted calendar: '.$e->getMessage(), [
82 82
 				'exception' => $e,
83 83
 			]);
84 84
 		}
Please login to merge, or discard this patch.
apps/dav/lib/Listener/CalendarDeletionActivityUpdaterListener.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -38,38 +38,38 @@
 block discarded – undo
38 38
  */
39 39
 class CalendarDeletionActivityUpdaterListener implements IEventListener {
40 40
 
41
-	/** @var ActivityBackend */
42
-	private $activityBackend;
41
+    /** @var ActivityBackend */
42
+    private $activityBackend;
43 43
 
44
-	/** @var LoggerInterface */
45
-	private $logger;
44
+    /** @var LoggerInterface */
45
+    private $logger;
46 46
 
47
-	public function __construct(ActivityBackend $activityBackend,
48
-								LoggerInterface $logger) {
49
-		$this->activityBackend = $activityBackend;
50
-		$this->logger = $logger;
51
-	}
47
+    public function __construct(ActivityBackend $activityBackend,
48
+                                LoggerInterface $logger) {
49
+        $this->activityBackend = $activityBackend;
50
+        $this->logger = $logger;
51
+    }
52 52
 
53
-	public function handle(Event $event): void {
54
-		if (!($event instanceof CalendarDeletedEvent)) {
55
-			// Not what we subscribed to
56
-			return;
57
-		}
53
+    public function handle(Event $event): void {
54
+        if (!($event instanceof CalendarDeletedEvent)) {
55
+            // Not what we subscribed to
56
+            return;
57
+        }
58 58
 
59
-		try {
60
-			$this->activityBackend->onCalendarDelete(
61
-				$event->getCalendarData(),
62
-				$event->getShares()
63
-			);
59
+        try {
60
+            $this->activityBackend->onCalendarDelete(
61
+                $event->getCalendarData(),
62
+                $event->getShares()
63
+            );
64 64
 
65
-			$this->logger->debug(
66
-				sprintf('Activity generated for deleted calendar %d', $event->getCalendarId())
67
-			);
68
-		} catch (Throwable $e) {
69
-			// Any error with activities shouldn't abort the calendar deletion, so we just log it
70
-			$this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [
71
-				'exception' => $e,
72
-			]);
73
-		}
74
-	}
65
+            $this->logger->debug(
66
+                sprintf('Activity generated for deleted calendar %d', $event->getCalendarId())
67
+            );
68
+        } catch (Throwable $e) {
69
+            // Any error with activities shouldn't abort the calendar deletion, so we just log it
70
+            $this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [
71
+                'exception' => $e,
72
+            ]);
73
+        }
74
+    }
75 75
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 			);
68 68
 		} catch (Throwable $e) {
69 69
 			// Any error with activities shouldn't abort the calendar deletion, so we just log it
70
-			$this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [
70
+			$this->logger->error('Error generating activities for a deleted calendar: '.$e->getMessage(), [
71 71
 				'exception' => $e,
72 72
 			]);
73 73
 		}
Please login to merge, or discard this patch.
apps/dav/lib/AppInfo/Application.php 2 patches
Indentation   +290 added lines, -290 removed lines patch added patch discarded remove patch
@@ -81,303 +81,303 @@
 block discarded – undo
81 81
 use function is_null;
82 82
 
83 83
 class Application extends App implements IBootstrap {
84
-	public const APP_ID = 'dav';
84
+    public const APP_ID = 'dav';
85 85
 
86
-	public function __construct() {
87
-		parent::__construct(self::APP_ID);
88
-	}
86
+    public function __construct() {
87
+        parent::__construct(self::APP_ID);
88
+    }
89 89
 
90
-	public function register(IRegistrationContext $context): void {
91
-		$context->registerServiceAlias('CardDAVSyncService', SyncService::class);
92
-		$context->registerService(PhotoCache::class, function (ContainerInterface $c) {
93
-			/** @var IServerContainer $server */
94
-			$server = $c->get(IServerContainer::class);
90
+    public function register(IRegistrationContext $context): void {
91
+        $context->registerServiceAlias('CardDAVSyncService', SyncService::class);
92
+        $context->registerService(PhotoCache::class, function (ContainerInterface $c) {
93
+            /** @var IServerContainer $server */
94
+            $server = $c->get(IServerContainer::class);
95 95
 
96
-			return new PhotoCache(
97
-				$server->getAppDataDir('dav-photocache'),
98
-				$c->get(ILogger::class)
99
-			);
100
-		});
96
+            return new PhotoCache(
97
+                $server->getAppDataDir('dav-photocache'),
98
+                $c->get(ILogger::class)
99
+            );
100
+        });
101 101
 
102
-		/*
102
+        /*
103 103
 		 * Register capabilities
104 104
 		 */
105
-		$context->registerCapability(Capabilities::class);
105
+        $context->registerCapability(Capabilities::class);
106 106
 
107
-		/*
107
+        /*
108 108
 		 * Register Search Providers
109 109
 		 */
110
-		$context->registerSearchProvider(ContactsSearchProvider::class);
111
-		$context->registerSearchProvider(EventsSearchProvider::class);
112
-		$context->registerSearchProvider(TasksSearchProvider::class);
113
-
114
-		/**
115
-		 * Register event listeners
116
-		 */
117
-		$context->registerEventListener(CalendarDeletedEvent::class, CalendarDeletionActivityUpdaterListener::class);
118
-		$context->registerEventListener(CalendarDeletedEvent::class, CalendarDeletionReminderUpdaterListener::class);
119
-		$context->registerEventListener(CalendarDeletedEvent::class, CalendarDeletionDefaultUpdaterListener::class);
120
-		$context->registerEventListener(CalendarObjectCreatedEvent::class, CalendarContactInteractionListener::class);
121
-		$context->registerEventListener(CalendarObjectUpdatedEvent::class, CalendarContactInteractionListener::class);
122
-		$context->registerEventListener(CalendarShareUpdatedEvent::class, CalendarContactInteractionListener::class);
123
-
124
-		$context->registerNotifierService(Notifier::class);
125
-	}
126
-
127
-	public function boot(IBootContext $context): void {
128
-		// Load all dav apps
129
-		\OC_App::loadApps(['dav']);
130
-
131
-		$context->injectFn([$this, 'registerHooks']);
132
-		$context->injectFn([$this, 'registerContactsManager']);
133
-		$context->injectFn([$this, 'registerCalendarManager']);
134
-		$context->injectFn([$this, 'registerCalendarReminders']);
135
-	}
136
-
137
-	public function registerHooks(HookManager $hm,
138
-								   EventDispatcherInterface $dispatcher,
139
-								   IAppContainer $container,
140
-								   IServerContainer $serverContainer) {
141
-		$hm->setup();
142
-
143
-		// first time login event setup
144
-		$dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) {
145
-			if ($event instanceof GenericEvent) {
146
-				$hm->firstLogin($event->getSubject());
147
-			}
148
-		});
149
-
150
-		$birthdayListener = function ($event) use ($container): void {
151
-			if ($event instanceof GenericEvent) {
152
-				/** @var BirthdayService $b */
153
-				$b = $container->query(BirthdayService::class);
154
-				$b->onCardChanged(
155
-					(int) $event->getArgument('addressBookId'),
156
-					(string) $event->getArgument('cardUri'),
157
-					(string) $event->getArgument('cardData')
158
-				);
159
-			}
160
-		};
161
-
162
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $birthdayListener);
163
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $birthdayListener);
164
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function ($event) use ($container) {
165
-			if ($event instanceof GenericEvent) {
166
-				/** @var BirthdayService $b */
167
-				$b = $container->query(BirthdayService::class);
168
-				$b->onCardDeleted(
169
-					(int) $event->getArgument('addressBookId'),
170
-					(string) $event->getArgument('cardUri')
171
-				);
172
-			}
173
-		});
174
-
175
-		$clearPhotoCache = function ($event) use ($container): void {
176
-			if ($event instanceof GenericEvent) {
177
-				/** @var PhotoCache $p */
178
-				$p = $container->query(PhotoCache::class);
179
-				$p->delete(
180
-					$event->getArgument('addressBookId'),
181
-					$event->getArgument('cardUri')
182
-				);
183
-			}
184
-		};
185
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache);
186
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache);
187
-
188
-		$dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($container) {
189
-			$user = $event->getSubject();
190
-			/** @var SyncService $syncService */
191
-			$syncService = $container->query(SyncService::class);
192
-			$syncService->updateUser($user);
193
-		});
194
-
195
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function (GenericEvent $event) use ($container) {
196
-			/** @var Backend $backend */
197
-			$backend = $container->query(Backend::class);
198
-			$backend->onCalendarAdd(
199
-				$event->getArgument('calendarData')
200
-			);
201
-		});
202
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function (GenericEvent $event) use ($container) {
203
-			/** @var Backend $backend */
204
-			$backend = $container->query(Backend::class);
205
-			$backend->onCalendarUpdate(
206
-				$event->getArgument('calendarData'),
207
-				$event->getArgument('shares'),
208
-				$event->getArgument('propertyMutations')
209
-			);
210
-		});
211
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function (GenericEvent $event) use ($container) {
212
-			/** @var Backend $backend */
213
-			$backend = $container->query(Backend::class);
214
-			$backend->onCalendarUpdateShares(
215
-				$event->getArgument('calendarData'),
216
-				$event->getArgument('shares'),
217
-				$event->getArgument('add'),
218
-				$event->getArgument('remove')
219
-			);
220
-
221
-			// Here we should recalculate if reminders should be sent to new or old sharees
222
-		});
223
-
224
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function (GenericEvent $event) use ($container) {
225
-			/** @var Backend $backend */
226
-			$backend = $container->query(Backend::class);
227
-			$backend->onCalendarPublication(
228
-				$event->getArgument('calendarData'),
229
-				$event->getArgument('public')
230
-			);
231
-		});
232
-
233
-		$listener = function (GenericEvent $event, $eventName) use ($container): void {
234
-			/** @var Backend $backend */
235
-			$backend = $container->query(Backend::class);
236
-
237
-			$subject = Event::SUBJECT_OBJECT_ADD;
238
-			if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject') {
239
-				$subject = Event::SUBJECT_OBJECT_UPDATE;
240
-			} elseif ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject') {
241
-				$subject = Event::SUBJECT_OBJECT_DELETE;
242
-			}
243
-			$backend->onTouchCalendarObject(
244
-				$subject,
245
-				$event->getArgument('calendarData'),
246
-				$event->getArgument('shares'),
247
-				$event->getArgument('objectData')
248
-			);
249
-
250
-			/** @var ReminderService $reminderBackend */
251
-			$reminderService = $container->query(ReminderService::class);
252
-
253
-			$reminderService->onTouchCalendarObject(
254
-				$eventName,
255
-				$event->getArgument('objectData')
256
-			);
257
-		};
258
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', $listener);
259
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', $listener);
260
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', $listener);
261
-
262
-		$dispatcher->addListener('OCP\Federation\TrustedServerEvent::remove',
263
-			function (GenericEvent $event) {
264
-				/** @var CardDavBackend $cardDavBackend */
265
-				$cardDavBackend = \OC::$server->query(CardDavBackend::class);
266
-				$addressBookUri = $event->getSubject();
267
-				$addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri);
268
-				if (!is_null($addressBook)) {
269
-					$cardDavBackend->deleteAddressBook($addressBook['id']);
270
-				}
271
-			}
272
-		);
273
-
274
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription',
275
-			function (GenericEvent $event) use ($container, $serverContainer) {
276
-				$jobList = $serverContainer->getJobList();
277
-				$subscriptionData = $event->getArgument('subscriptionData');
278
-
279
-				/**
280
-				 * Initial subscription refetch
281
-				 *
282
-				 * @var RefreshWebcalService $refreshWebcalService
283
-				 */
284
-				$refreshWebcalService = $container->query(RefreshWebcalService::class);
285
-				$refreshWebcalService->refreshSubscription(
286
-					(string) $subscriptionData['principaluri'],
287
-					(string) $subscriptionData['uri']
288
-				);
289
-
290
-				$jobList->add(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [
291
-					'principaluri' => $subscriptionData['principaluri'],
292
-					'uri' => $subscriptionData['uri']
293
-				]);
294
-			}
295
-		);
296
-
297
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription',
298
-			function (GenericEvent $event) use ($container, $serverContainer) {
299
-				$jobList = $serverContainer->getJobList();
300
-				$subscriptionData = $event->getArgument('subscriptionData');
301
-
302
-				$jobList->remove(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [
303
-					'principaluri' => $subscriptionData['principaluri'],
304
-					'uri' => $subscriptionData['uri']
305
-				]);
306
-
307
-				/** @var CalDavBackend $calDavBackend */
308
-				$calDavBackend = $container->query(CalDavBackend::class);
309
-				$calDavBackend->purgeAllCachedEventsForSubscription($subscriptionData['id']);
310
-			}
311
-		);
312
-
313
-		$eventHandler = function () use ($container, $serverContainer): void {
314
-			try {
315
-				/** @var UpdateCalendarResourcesRoomsBackgroundJob $job */
316
-				$job = $container->query(UpdateCalendarResourcesRoomsBackgroundJob::class);
317
-				$job->run([]);
318
-				$serverContainer->getJobList()->setLastRun($job);
319
-			} catch (Exception $ex) {
320
-				$serverContainer->getLogger()->logException($ex);
321
-			}
322
-		};
323
-
324
-		$dispatcher->addListener('\OCP\Calendar\Resource\ForceRefreshEvent', $eventHandler);
325
-		$dispatcher->addListener('\OCP\Calendar\Room\ForceRefreshEvent', $eventHandler);
326
-	}
327
-
328
-	public function registerContactsManager(IContactsManager $cm, IAppContainer $container): void {
329
-		$cm->register(function () use ($container, $cm): void {
330
-			$user = \OC::$server->getUserSession()->getUser();
331
-			if (!is_null($user)) {
332
-				$this->setupContactsProvider($cm, $container, $user->getUID());
333
-			} else {
334
-				$this->setupSystemContactsProvider($cm, $container);
335
-			}
336
-		});
337
-	}
338
-
339
-	private function setupContactsProvider(IContactsManager $contactsManager,
340
-										   IAppContainer $container,
341
-										   string $userID): void {
342
-		/** @var ContactsManager $cm */
343
-		$cm = $container->query(ContactsManager::class);
344
-		$urlGenerator = $container->getServer()->getURLGenerator();
345
-		$cm->setupContactsProvider($contactsManager, $userID, $urlGenerator);
346
-	}
347
-
348
-	private function setupSystemContactsProvider(IContactsManager $contactsManager,
349
-												 IAppContainer $container): void {
350
-		/** @var ContactsManager $cm */
351
-		$cm = $container->query(ContactsManager::class);
352
-		$urlGenerator = $container->getServer()->getURLGenerator();
353
-		$cm->setupSystemContactsProvider($contactsManager, $urlGenerator);
354
-	}
355
-
356
-	public function registerCalendarManager(ICalendarManager $calendarManager,
357
-											 IAppContainer $container): void {
358
-		$calendarManager->register(function () use ($container, $calendarManager) {
359
-			$user = \OC::$server->getUserSession()->getUser();
360
-			if ($user !== null) {
361
-				$this->setupCalendarProvider($calendarManager, $container, $user->getUID());
362
-			}
363
-		});
364
-	}
365
-
366
-	private function setupCalendarProvider(ICalendarManager $calendarManager,
367
-										   IAppContainer $container,
368
-										   $userId) {
369
-		$cm = $container->query(CalendarManager::class);
370
-		$cm->setupCalendarProvider($calendarManager, $userId);
371
-	}
372
-
373
-	public function registerCalendarReminders(NotificationProviderManager $manager,
374
-											   ILogger $logger): void {
375
-		try {
376
-			$manager->registerProvider(AudioProvider::class);
377
-			$manager->registerProvider(EmailProvider::class);
378
-			$manager->registerProvider(PushProvider::class);
379
-		} catch (Throwable $ex) {
380
-			$logger->logException($ex);
381
-		}
382
-	}
110
+        $context->registerSearchProvider(ContactsSearchProvider::class);
111
+        $context->registerSearchProvider(EventsSearchProvider::class);
112
+        $context->registerSearchProvider(TasksSearchProvider::class);
113
+
114
+        /**
115
+         * Register event listeners
116
+         */
117
+        $context->registerEventListener(CalendarDeletedEvent::class, CalendarDeletionActivityUpdaterListener::class);
118
+        $context->registerEventListener(CalendarDeletedEvent::class, CalendarDeletionReminderUpdaterListener::class);
119
+        $context->registerEventListener(CalendarDeletedEvent::class, CalendarDeletionDefaultUpdaterListener::class);
120
+        $context->registerEventListener(CalendarObjectCreatedEvent::class, CalendarContactInteractionListener::class);
121
+        $context->registerEventListener(CalendarObjectUpdatedEvent::class, CalendarContactInteractionListener::class);
122
+        $context->registerEventListener(CalendarShareUpdatedEvent::class, CalendarContactInteractionListener::class);
123
+
124
+        $context->registerNotifierService(Notifier::class);
125
+    }
126
+
127
+    public function boot(IBootContext $context): void {
128
+        // Load all dav apps
129
+        \OC_App::loadApps(['dav']);
130
+
131
+        $context->injectFn([$this, 'registerHooks']);
132
+        $context->injectFn([$this, 'registerContactsManager']);
133
+        $context->injectFn([$this, 'registerCalendarManager']);
134
+        $context->injectFn([$this, 'registerCalendarReminders']);
135
+    }
136
+
137
+    public function registerHooks(HookManager $hm,
138
+                                    EventDispatcherInterface $dispatcher,
139
+                                    IAppContainer $container,
140
+                                    IServerContainer $serverContainer) {
141
+        $hm->setup();
142
+
143
+        // first time login event setup
144
+        $dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) {
145
+            if ($event instanceof GenericEvent) {
146
+                $hm->firstLogin($event->getSubject());
147
+            }
148
+        });
149
+
150
+        $birthdayListener = function ($event) use ($container): void {
151
+            if ($event instanceof GenericEvent) {
152
+                /** @var BirthdayService $b */
153
+                $b = $container->query(BirthdayService::class);
154
+                $b->onCardChanged(
155
+                    (int) $event->getArgument('addressBookId'),
156
+                    (string) $event->getArgument('cardUri'),
157
+                    (string) $event->getArgument('cardData')
158
+                );
159
+            }
160
+        };
161
+
162
+        $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $birthdayListener);
163
+        $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $birthdayListener);
164
+        $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function ($event) use ($container) {
165
+            if ($event instanceof GenericEvent) {
166
+                /** @var BirthdayService $b */
167
+                $b = $container->query(BirthdayService::class);
168
+                $b->onCardDeleted(
169
+                    (int) $event->getArgument('addressBookId'),
170
+                    (string) $event->getArgument('cardUri')
171
+                );
172
+            }
173
+        });
174
+
175
+        $clearPhotoCache = function ($event) use ($container): void {
176
+            if ($event instanceof GenericEvent) {
177
+                /** @var PhotoCache $p */
178
+                $p = $container->query(PhotoCache::class);
179
+                $p->delete(
180
+                    $event->getArgument('addressBookId'),
181
+                    $event->getArgument('cardUri')
182
+                );
183
+            }
184
+        };
185
+        $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache);
186
+        $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache);
187
+
188
+        $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($container) {
189
+            $user = $event->getSubject();
190
+            /** @var SyncService $syncService */
191
+            $syncService = $container->query(SyncService::class);
192
+            $syncService->updateUser($user);
193
+        });
194
+
195
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function (GenericEvent $event) use ($container) {
196
+            /** @var Backend $backend */
197
+            $backend = $container->query(Backend::class);
198
+            $backend->onCalendarAdd(
199
+                $event->getArgument('calendarData')
200
+            );
201
+        });
202
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function (GenericEvent $event) use ($container) {
203
+            /** @var Backend $backend */
204
+            $backend = $container->query(Backend::class);
205
+            $backend->onCalendarUpdate(
206
+                $event->getArgument('calendarData'),
207
+                $event->getArgument('shares'),
208
+                $event->getArgument('propertyMutations')
209
+            );
210
+        });
211
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function (GenericEvent $event) use ($container) {
212
+            /** @var Backend $backend */
213
+            $backend = $container->query(Backend::class);
214
+            $backend->onCalendarUpdateShares(
215
+                $event->getArgument('calendarData'),
216
+                $event->getArgument('shares'),
217
+                $event->getArgument('add'),
218
+                $event->getArgument('remove')
219
+            );
220
+
221
+            // Here we should recalculate if reminders should be sent to new or old sharees
222
+        });
223
+
224
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function (GenericEvent $event) use ($container) {
225
+            /** @var Backend $backend */
226
+            $backend = $container->query(Backend::class);
227
+            $backend->onCalendarPublication(
228
+                $event->getArgument('calendarData'),
229
+                $event->getArgument('public')
230
+            );
231
+        });
232
+
233
+        $listener = function (GenericEvent $event, $eventName) use ($container): void {
234
+            /** @var Backend $backend */
235
+            $backend = $container->query(Backend::class);
236
+
237
+            $subject = Event::SUBJECT_OBJECT_ADD;
238
+            if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject') {
239
+                $subject = Event::SUBJECT_OBJECT_UPDATE;
240
+            } elseif ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject') {
241
+                $subject = Event::SUBJECT_OBJECT_DELETE;
242
+            }
243
+            $backend->onTouchCalendarObject(
244
+                $subject,
245
+                $event->getArgument('calendarData'),
246
+                $event->getArgument('shares'),
247
+                $event->getArgument('objectData')
248
+            );
249
+
250
+            /** @var ReminderService $reminderBackend */
251
+            $reminderService = $container->query(ReminderService::class);
252
+
253
+            $reminderService->onTouchCalendarObject(
254
+                $eventName,
255
+                $event->getArgument('objectData')
256
+            );
257
+        };
258
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', $listener);
259
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', $listener);
260
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', $listener);
261
+
262
+        $dispatcher->addListener('OCP\Federation\TrustedServerEvent::remove',
263
+            function (GenericEvent $event) {
264
+                /** @var CardDavBackend $cardDavBackend */
265
+                $cardDavBackend = \OC::$server->query(CardDavBackend::class);
266
+                $addressBookUri = $event->getSubject();
267
+                $addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri);
268
+                if (!is_null($addressBook)) {
269
+                    $cardDavBackend->deleteAddressBook($addressBook['id']);
270
+                }
271
+            }
272
+        );
273
+
274
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription',
275
+            function (GenericEvent $event) use ($container, $serverContainer) {
276
+                $jobList = $serverContainer->getJobList();
277
+                $subscriptionData = $event->getArgument('subscriptionData');
278
+
279
+                /**
280
+                 * Initial subscription refetch
281
+                 *
282
+                 * @var RefreshWebcalService $refreshWebcalService
283
+                 */
284
+                $refreshWebcalService = $container->query(RefreshWebcalService::class);
285
+                $refreshWebcalService->refreshSubscription(
286
+                    (string) $subscriptionData['principaluri'],
287
+                    (string) $subscriptionData['uri']
288
+                );
289
+
290
+                $jobList->add(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [
291
+                    'principaluri' => $subscriptionData['principaluri'],
292
+                    'uri' => $subscriptionData['uri']
293
+                ]);
294
+            }
295
+        );
296
+
297
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription',
298
+            function (GenericEvent $event) use ($container, $serverContainer) {
299
+                $jobList = $serverContainer->getJobList();
300
+                $subscriptionData = $event->getArgument('subscriptionData');
301
+
302
+                $jobList->remove(\OCA\DAV\BackgroundJob\RefreshWebcalJob::class, [
303
+                    'principaluri' => $subscriptionData['principaluri'],
304
+                    'uri' => $subscriptionData['uri']
305
+                ]);
306
+
307
+                /** @var CalDavBackend $calDavBackend */
308
+                $calDavBackend = $container->query(CalDavBackend::class);
309
+                $calDavBackend->purgeAllCachedEventsForSubscription($subscriptionData['id']);
310
+            }
311
+        );
312
+
313
+        $eventHandler = function () use ($container, $serverContainer): void {
314
+            try {
315
+                /** @var UpdateCalendarResourcesRoomsBackgroundJob $job */
316
+                $job = $container->query(UpdateCalendarResourcesRoomsBackgroundJob::class);
317
+                $job->run([]);
318
+                $serverContainer->getJobList()->setLastRun($job);
319
+            } catch (Exception $ex) {
320
+                $serverContainer->getLogger()->logException($ex);
321
+            }
322
+        };
323
+
324
+        $dispatcher->addListener('\OCP\Calendar\Resource\ForceRefreshEvent', $eventHandler);
325
+        $dispatcher->addListener('\OCP\Calendar\Room\ForceRefreshEvent', $eventHandler);
326
+    }
327
+
328
+    public function registerContactsManager(IContactsManager $cm, IAppContainer $container): void {
329
+        $cm->register(function () use ($container, $cm): void {
330
+            $user = \OC::$server->getUserSession()->getUser();
331
+            if (!is_null($user)) {
332
+                $this->setupContactsProvider($cm, $container, $user->getUID());
333
+            } else {
334
+                $this->setupSystemContactsProvider($cm, $container);
335
+            }
336
+        });
337
+    }
338
+
339
+    private function setupContactsProvider(IContactsManager $contactsManager,
340
+                                            IAppContainer $container,
341
+                                            string $userID): void {
342
+        /** @var ContactsManager $cm */
343
+        $cm = $container->query(ContactsManager::class);
344
+        $urlGenerator = $container->getServer()->getURLGenerator();
345
+        $cm->setupContactsProvider($contactsManager, $userID, $urlGenerator);
346
+    }
347
+
348
+    private function setupSystemContactsProvider(IContactsManager $contactsManager,
349
+                                                    IAppContainer $container): void {
350
+        /** @var ContactsManager $cm */
351
+        $cm = $container->query(ContactsManager::class);
352
+        $urlGenerator = $container->getServer()->getURLGenerator();
353
+        $cm->setupSystemContactsProvider($contactsManager, $urlGenerator);
354
+    }
355
+
356
+    public function registerCalendarManager(ICalendarManager $calendarManager,
357
+                                                IAppContainer $container): void {
358
+        $calendarManager->register(function () use ($container, $calendarManager) {
359
+            $user = \OC::$server->getUserSession()->getUser();
360
+            if ($user !== null) {
361
+                $this->setupCalendarProvider($calendarManager, $container, $user->getUID());
362
+            }
363
+        });
364
+    }
365
+
366
+    private function setupCalendarProvider(ICalendarManager $calendarManager,
367
+                                            IAppContainer $container,
368
+                                            $userId) {
369
+        $cm = $container->query(CalendarManager::class);
370
+        $cm->setupCalendarProvider($calendarManager, $userId);
371
+    }
372
+
373
+    public function registerCalendarReminders(NotificationProviderManager $manager,
374
+                                                ILogger $logger): void {
375
+        try {
376
+            $manager->registerProvider(AudioProvider::class);
377
+            $manager->registerProvider(EmailProvider::class);
378
+            $manager->registerProvider(PushProvider::class);
379
+        } catch (Throwable $ex) {
380
+            $logger->logException($ex);
381
+        }
382
+    }
383 383
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
 	public function register(IRegistrationContext $context): void {
91 91
 		$context->registerServiceAlias('CardDAVSyncService', SyncService::class);
92
-		$context->registerService(PhotoCache::class, function (ContainerInterface $c) {
92
+		$context->registerService(PhotoCache::class, function(ContainerInterface $c) {
93 93
 			/** @var IServerContainer $server */
94 94
 			$server = $c->get(IServerContainer::class);
95 95
 
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 		$hm->setup();
142 142
 
143 143
 		// first time login event setup
144
-		$dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) {
144
+		$dispatcher->addListener(IUser::class.'::firstLogin', function($event) use ($hm) {
145 145
 			if ($event instanceof GenericEvent) {
146 146
 				$hm->firstLogin($event->getSubject());
147 147
 			}
148 148
 		});
149 149
 
150
-		$birthdayListener = function ($event) use ($container): void {
150
+		$birthdayListener = function($event) use ($container): void {
151 151
 			if ($event instanceof GenericEvent) {
152 152
 				/** @var BirthdayService $b */
153 153
 				$b = $container->query(BirthdayService::class);
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $birthdayListener);
163 163
 		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $birthdayListener);
164
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function ($event) use ($container) {
164
+		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function($event) use ($container) {
165 165
 			if ($event instanceof GenericEvent) {
166 166
 				/** @var BirthdayService $b */
167 167
 				$b = $container->query(BirthdayService::class);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 			}
173 173
 		});
174 174
 
175
-		$clearPhotoCache = function ($event) use ($container): void {
175
+		$clearPhotoCache = function($event) use ($container): void {
176 176
 			if ($event instanceof GenericEvent) {
177 177
 				/** @var PhotoCache $p */
178 178
 				$p = $container->query(PhotoCache::class);
@@ -185,21 +185,21 @@  discard block
 block discarded – undo
185 185
 		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache);
186 186
 		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache);
187 187
 
188
-		$dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($container) {
188
+		$dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) use ($container) {
189 189
 			$user = $event->getSubject();
190 190
 			/** @var SyncService $syncService */
191 191
 			$syncService = $container->query(SyncService::class);
192 192
 			$syncService->updateUser($user);
193 193
 		});
194 194
 
195
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function (GenericEvent $event) use ($container) {
195
+		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function(GenericEvent $event) use ($container) {
196 196
 			/** @var Backend $backend */
197 197
 			$backend = $container->query(Backend::class);
198 198
 			$backend->onCalendarAdd(
199 199
 				$event->getArgument('calendarData')
200 200
 			);
201 201
 		});
202
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function (GenericEvent $event) use ($container) {
202
+		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function(GenericEvent $event) use ($container) {
203 203
 			/** @var Backend $backend */
204 204
 			$backend = $container->query(Backend::class);
205 205
 			$backend->onCalendarUpdate(
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 				$event->getArgument('propertyMutations')
209 209
 			);
210 210
 		});
211
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function (GenericEvent $event) use ($container) {
211
+		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function(GenericEvent $event) use ($container) {
212 212
 			/** @var Backend $backend */
213 213
 			$backend = $container->query(Backend::class);
214 214
 			$backend->onCalendarUpdateShares(
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 			// Here we should recalculate if reminders should be sent to new or old sharees
222 222
 		});
223 223
 
224
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function (GenericEvent $event) use ($container) {
224
+		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function(GenericEvent $event) use ($container) {
225 225
 			/** @var Backend $backend */
226 226
 			$backend = $container->query(Backend::class);
227 227
 			$backend->onCalendarPublication(
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 			);
231 231
 		});
232 232
 
233
-		$listener = function (GenericEvent $event, $eventName) use ($container): void {
233
+		$listener = function(GenericEvent $event, $eventName) use ($container): void {
234 234
 			/** @var Backend $backend */
235 235
 			$backend = $container->query(Backend::class);
236 236
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', $listener);
261 261
 
262 262
 		$dispatcher->addListener('OCP\Federation\TrustedServerEvent::remove',
263
-			function (GenericEvent $event) {
263
+			function(GenericEvent $event) {
264 264
 				/** @var CardDavBackend $cardDavBackend */
265 265
 				$cardDavBackend = \OC::$server->query(CardDavBackend::class);
266 266
 				$addressBookUri = $event->getSubject();
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		);
273 273
 
274 274
 		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription',
275
-			function (GenericEvent $event) use ($container, $serverContainer) {
275
+			function(GenericEvent $event) use ($container, $serverContainer) {
276 276
 				$jobList = $serverContainer->getJobList();
277 277
 				$subscriptionData = $event->getArgument('subscriptionData');
278 278
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		);
296 296
 
297 297
 		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription',
298
-			function (GenericEvent $event) use ($container, $serverContainer) {
298
+			function(GenericEvent $event) use ($container, $serverContainer) {
299 299
 				$jobList = $serverContainer->getJobList();
300 300
 				$subscriptionData = $event->getArgument('subscriptionData');
301 301
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			}
311 311
 		);
312 312
 
313
-		$eventHandler = function () use ($container, $serverContainer): void {
313
+		$eventHandler = function() use ($container, $serverContainer): void {
314 314
 			try {
315 315
 				/** @var UpdateCalendarResourcesRoomsBackgroundJob $job */
316 316
 				$job = $container->query(UpdateCalendarResourcesRoomsBackgroundJob::class);
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	}
327 327
 
328 328
 	public function registerContactsManager(IContactsManager $cm, IAppContainer $container): void {
329
-		$cm->register(function () use ($container, $cm): void {
329
+		$cm->register(function() use ($container, $cm): void {
330 330
 			$user = \OC::$server->getUserSession()->getUser();
331 331
 			if (!is_null($user)) {
332 332
 				$this->setupContactsProvider($cm, $container, $user->getUID());
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 
356 356
 	public function registerCalendarManager(ICalendarManager $calendarManager,
357 357
 											 IAppContainer $container): void {
358
-		$calendarManager->register(function () use ($container, $calendarManager) {
358
+		$calendarManager->register(function() use ($container, $calendarManager) {
359 359
 			$user = \OC::$server->getUserSession()->getUser();
360 360
 			if ($user !== null) {
361 361
 				$this->setupCalendarProvider($calendarManager, $container, $user->getUID());
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/CalDavBackend.php 2 patches
Indentation   +2764 added lines, -2764 removed lines patch added patch discarded remove patch
@@ -96,2768 +96,2768 @@
 block discarded – undo
96 96
  * @package OCA\DAV\CalDAV
97 97
  */
98 98
 class CalDavBackend extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport {
99
-	public const CALENDAR_TYPE_CALENDAR = 0;
100
-	public const CALENDAR_TYPE_SUBSCRIPTION = 1;
101
-
102
-	public const PERSONAL_CALENDAR_URI = 'personal';
103
-	public const PERSONAL_CALENDAR_NAME = 'Personal';
104
-
105
-	public const RESOURCE_BOOKING_CALENDAR_URI = 'calendar';
106
-	public const RESOURCE_BOOKING_CALENDAR_NAME = 'Calendar';
107
-
108
-	/**
109
-	 * We need to specify a max date, because we need to stop *somewhere*
110
-	 *
111
-	 * On 32 bit system the maximum for a signed integer is 2147483647, so
112
-	 * MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results
113
-	 * in 2038-01-19 to avoid problems when the date is converted
114
-	 * to a unix timestamp.
115
-	 */
116
-	public const MAX_DATE = '2038-01-01';
117
-
118
-	public const ACCESS_PUBLIC = 4;
119
-	public const CLASSIFICATION_PUBLIC = 0;
120
-	public const CLASSIFICATION_PRIVATE = 1;
121
-	public const CLASSIFICATION_CONFIDENTIAL = 2;
122
-
123
-	/**
124
-	 * List of CalDAV properties, and how they map to database field names
125
-	 * Add your own properties by simply adding on to this array.
126
-	 *
127
-	 * Note that only string-based properties are supported here.
128
-	 *
129
-	 * @var array
130
-	 */
131
-	public $propertyMap = [
132
-		'{DAV:}displayname' => 'displayname',
133
-		'{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description',
134
-		'{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone',
135
-		'{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
136
-		'{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
137
-	];
138
-
139
-	/**
140
-	 * List of subscription properties, and how they map to database field names.
141
-	 *
142
-	 * @var array
143
-	 */
144
-	public $subscriptionPropertyMap = [
145
-		'{DAV:}displayname' => 'displayname',
146
-		'{http://apple.com/ns/ical/}refreshrate' => 'refreshrate',
147
-		'{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
148
-		'{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
149
-		'{http://calendarserver.org/ns/}subscribed-strip-todos' => 'striptodos',
150
-		'{http://calendarserver.org/ns/}subscribed-strip-alarms' => 'stripalarms',
151
-		'{http://calendarserver.org/ns/}subscribed-strip-attachments' => 'stripattachments',
152
-	];
153
-
154
-	/** @var array properties to index */
155
-	public static $indexProperties = ['CATEGORIES', 'COMMENT', 'DESCRIPTION',
156
-		'LOCATION', 'RESOURCES', 'STATUS', 'SUMMARY', 'ATTENDEE', 'CONTACT',
157
-		'ORGANIZER'];
158
-
159
-	/** @var array parameters to index */
160
-	public static $indexParameters = [
161
-		'ATTENDEE' => ['CN'],
162
-		'ORGANIZER' => ['CN'],
163
-	];
164
-
165
-	/**
166
-	 * @var string[] Map of uid => display name
167
-	 */
168
-	protected $userDisplayNames;
169
-
170
-	/** @var IDBConnection */
171
-	private $db;
172
-
173
-	/** @var Backend */
174
-	private $calendarSharingBackend;
175
-
176
-	/** @var Principal */
177
-	private $principalBackend;
178
-
179
-	/** @var IUserManager */
180
-	private $userManager;
181
-
182
-	/** @var ISecureRandom */
183
-	private $random;
184
-
185
-	/** @var ILogger */
186
-	private $logger;
187
-
188
-	/** @var IEventDispatcher */
189
-	private $dispatcher;
190
-
191
-	/** @var EventDispatcherInterface */
192
-	private $legacyDispatcher;
193
-
194
-	/** @var bool */
195
-	private $legacyEndpoint;
196
-
197
-	/** @var string */
198
-	private $dbObjectPropertiesTable = 'calendarobjects_props';
199
-
200
-	/**
201
-	 * CalDavBackend constructor.
202
-	 *
203
-	 * @param IDBConnection $db
204
-	 * @param Principal $principalBackend
205
-	 * @param IUserManager $userManager
206
-	 * @param IGroupManager $groupManager
207
-	 * @param ISecureRandom $random
208
-	 * @param ILogger $logger
209
-	 * @param IEventDispatcher $dispatcher
210
-	 * @param EventDispatcherInterface $legacyDispatcher
211
-	 * @param bool $legacyEndpoint
212
-	 */
213
-	public function __construct(IDBConnection $db,
214
-								Principal $principalBackend,
215
-								IUserManager $userManager,
216
-								IGroupManager $groupManager,
217
-								ISecureRandom $random,
218
-								ILogger $logger,
219
-								IEventDispatcher $dispatcher,
220
-								EventDispatcherInterface $legacyDispatcher,
221
-								bool $legacyEndpoint = false) {
222
-		$this->db = $db;
223
-		$this->principalBackend = $principalBackend;
224
-		$this->userManager = $userManager;
225
-		$this->calendarSharingBackend = new Backend($this->db, $this->userManager, $groupManager, $principalBackend, 'calendar');
226
-		$this->random = $random;
227
-		$this->logger = $logger;
228
-		$this->dispatcher = $dispatcher;
229
-		$this->legacyDispatcher = $legacyDispatcher;
230
-		$this->legacyEndpoint = $legacyEndpoint;
231
-	}
232
-
233
-	/**
234
-	 * Return the number of calendars for a principal
235
-	 *
236
-	 * By default this excludes the automatically generated birthday calendar
237
-	 *
238
-	 * @param $principalUri
239
-	 * @param bool $excludeBirthday
240
-	 * @return int
241
-	 */
242
-	public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) {
243
-		$principalUri = $this->convertPrincipal($principalUri, true);
244
-		$query = $this->db->getQueryBuilder();
245
-		$query->select($query->func()->count('*'))
246
-			->from('calendars');
247
-
248
-		if ($principalUri === '') {
249
-			$query->where($query->expr()->emptyString('principaluri'));
250
-		} else {
251
-			$query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
252
-		}
253
-
254
-		if ($excludeBirthday) {
255
-			$query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)));
256
-		}
257
-
258
-		$result = $query->executeQuery();
259
-		$column = (int)$result->fetchOne();
260
-		$result->closeCursor();
261
-		return $column;
262
-	}
263
-
264
-	/**
265
-	 * Returns a list of calendars for a principal.
266
-	 *
267
-	 * Every project is an array with the following keys:
268
-	 *  * id, a unique id that will be used by other functions to modify the
269
-	 *    calendar. This can be the same as the uri or a database key.
270
-	 *  * uri, which the basename of the uri with which the calendar is
271
-	 *    accessed.
272
-	 *  * principaluri. The owner of the calendar. Almost always the same as
273
-	 *    principalUri passed to this method.
274
-	 *
275
-	 * Furthermore it can contain webdav properties in clark notation. A very
276
-	 * common one is '{DAV:}displayname'.
277
-	 *
278
-	 * Many clients also require:
279
-	 * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
280
-	 * For this property, you can just return an instance of
281
-	 * Sabre\CalDAV\Property\SupportedCalendarComponentSet.
282
-	 *
283
-	 * If you return {http://sabredav.org/ns}read-only and set the value to 1,
284
-	 * ACL will automatically be put in read-only mode.
285
-	 *
286
-	 * @param string $principalUri
287
-	 * @return array
288
-	 */
289
-	public function getCalendarsForUser($principalUri) {
290
-		$principalUriOriginal = $principalUri;
291
-		$principalUri = $this->convertPrincipal($principalUri, true);
292
-		$fields = array_values($this->propertyMap);
293
-		$fields[] = 'id';
294
-		$fields[] = 'uri';
295
-		$fields[] = 'synctoken';
296
-		$fields[] = 'components';
297
-		$fields[] = 'principaluri';
298
-		$fields[] = 'transparent';
299
-
300
-		// Making fields a comma-delimited list
301
-		$query = $this->db->getQueryBuilder();
302
-		$query->select($fields)
303
-			->from('calendars')
304
-			->orderBy('calendarorder', 'ASC');
305
-
306
-		if ($principalUri === '') {
307
-			$query->where($query->expr()->emptyString('principaluri'));
308
-		} else {
309
-			$query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
310
-		}
311
-
312
-		$result = $query->executeQuery();
313
-
314
-		$calendars = [];
315
-		while ($row = $result->fetch()) {
316
-			$row['principaluri'] = (string) $row['principaluri'];
317
-			$components = [];
318
-			if ($row['components']) {
319
-				$components = explode(',',$row['components']);
320
-			}
321
-
322
-			$calendar = [
323
-				'id' => $row['id'],
324
-				'uri' => $row['uri'],
325
-				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
326
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
327
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
328
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
329
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
330
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
331
-			];
332
-
333
-			foreach ($this->propertyMap as $xmlName => $dbName) {
334
-				$calendar[$xmlName] = $row[$dbName];
335
-			}
336
-
337
-			$this->addOwnerPrincipal($calendar);
338
-
339
-			if (!isset($calendars[$calendar['id']])) {
340
-				$calendars[$calendar['id']] = $calendar;
341
-			}
342
-		}
343
-		$result->closeCursor();
344
-
345
-		// query for shared calendars
346
-		$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
347
-		$principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal));
348
-
349
-		$principals[] = $principalUri;
350
-
351
-		$fields = array_values($this->propertyMap);
352
-		$fields[] = 'a.id';
353
-		$fields[] = 'a.uri';
354
-		$fields[] = 'a.synctoken';
355
-		$fields[] = 'a.components';
356
-		$fields[] = 'a.principaluri';
357
-		$fields[] = 'a.transparent';
358
-		$fields[] = 's.access';
359
-		$query = $this->db->getQueryBuilder();
360
-		$query->select($fields)
361
-			->from('dav_shares', 's')
362
-			->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
363
-			->where($query->expr()->in('s.principaluri', $query->createParameter('principaluri')))
364
-			->andWhere($query->expr()->eq('s.type', $query->createParameter('type')))
365
-			->setParameter('type', 'calendar')
366
-			->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY);
367
-
368
-		$result = $query->executeQuery();
369
-
370
-		$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
371
-		while ($row = $result->fetch()) {
372
-			$row['principaluri'] = (string) $row['principaluri'];
373
-			if ($row['principaluri'] === $principalUri) {
374
-				continue;
375
-			}
376
-
377
-			$readOnly = (int) $row['access'] === Backend::ACCESS_READ;
378
-			if (isset($calendars[$row['id']])) {
379
-				if ($readOnly) {
380
-					// New share can not have more permissions then the old one.
381
-					continue;
382
-				}
383
-				if (isset($calendars[$row['id']][$readOnlyPropertyName]) &&
384
-					$calendars[$row['id']][$readOnlyPropertyName] === 0) {
385
-					// Old share is already read-write, no more permissions can be gained
386
-					continue;
387
-				}
388
-			}
389
-
390
-			[, $name] = Uri\split($row['principaluri']);
391
-			$uri = $row['uri'] . '_shared_by_' . $name;
392
-			$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
393
-			$components = [];
394
-			if ($row['components']) {
395
-				$components = explode(',',$row['components']);
396
-			}
397
-			$calendar = [
398
-				'id' => $row['id'],
399
-				'uri' => $uri,
400
-				'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
401
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
402
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
403
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
404
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
405
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
406
-				$readOnlyPropertyName => $readOnly,
407
-			];
408
-
409
-			foreach ($this->propertyMap as $xmlName => $dbName) {
410
-				$calendar[$xmlName] = $row[$dbName];
411
-			}
412
-
413
-			$this->addOwnerPrincipal($calendar);
414
-
415
-			$calendars[$calendar['id']] = $calendar;
416
-		}
417
-		$result->closeCursor();
418
-
419
-		return array_values($calendars);
420
-	}
421
-
422
-	/**
423
-	 * @param $principalUri
424
-	 * @return array
425
-	 */
426
-	public function getUsersOwnCalendars($principalUri) {
427
-		$principalUri = $this->convertPrincipal($principalUri, true);
428
-		$fields = array_values($this->propertyMap);
429
-		$fields[] = 'id';
430
-		$fields[] = 'uri';
431
-		$fields[] = 'synctoken';
432
-		$fields[] = 'components';
433
-		$fields[] = 'principaluri';
434
-		$fields[] = 'transparent';
435
-		// Making fields a comma-delimited list
436
-		$query = $this->db->getQueryBuilder();
437
-		$query->select($fields)->from('calendars')
438
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
439
-			->orderBy('calendarorder', 'ASC');
440
-		$stmt = $query->executeQuery();
441
-		$calendars = [];
442
-		while ($row = $stmt->fetch()) {
443
-			$row['principaluri'] = (string) $row['principaluri'];
444
-			$components = [];
445
-			if ($row['components']) {
446
-				$components = explode(',',$row['components']);
447
-			}
448
-			$calendar = [
449
-				'id' => $row['id'],
450
-				'uri' => $row['uri'],
451
-				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
452
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
453
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
454
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
455
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
456
-			];
457
-			foreach ($this->propertyMap as $xmlName => $dbName) {
458
-				$calendar[$xmlName] = $row[$dbName];
459
-			}
460
-
461
-			$this->addOwnerPrincipal($calendar);
462
-
463
-			if (!isset($calendars[$calendar['id']])) {
464
-				$calendars[$calendar['id']] = $calendar;
465
-			}
466
-		}
467
-		$stmt->closeCursor();
468
-		return array_values($calendars);
469
-	}
470
-
471
-
472
-	/**
473
-	 * @param $uid
474
-	 * @return string
475
-	 */
476
-	private function getUserDisplayName($uid) {
477
-		if (!isset($this->userDisplayNames[$uid])) {
478
-			$user = $this->userManager->get($uid);
479
-
480
-			if ($user instanceof IUser) {
481
-				$this->userDisplayNames[$uid] = $user->getDisplayName();
482
-			} else {
483
-				$this->userDisplayNames[$uid] = $uid;
484
-			}
485
-		}
486
-
487
-		return $this->userDisplayNames[$uid];
488
-	}
489
-
490
-	/**
491
-	 * @return array
492
-	 */
493
-	public function getPublicCalendars() {
494
-		$fields = array_values($this->propertyMap);
495
-		$fields[] = 'a.id';
496
-		$fields[] = 'a.uri';
497
-		$fields[] = 'a.synctoken';
498
-		$fields[] = 'a.components';
499
-		$fields[] = 'a.principaluri';
500
-		$fields[] = 'a.transparent';
501
-		$fields[] = 's.access';
502
-		$fields[] = 's.publicuri';
503
-		$calendars = [];
504
-		$query = $this->db->getQueryBuilder();
505
-		$result = $query->select($fields)
506
-			->from('dav_shares', 's')
507
-			->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
508
-			->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
509
-			->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
510
-			->executeQuery();
511
-
512
-		while ($row = $result->fetch()) {
513
-			$row['principaluri'] = (string) $row['principaluri'];
514
-			[, $name] = Uri\split($row['principaluri']);
515
-			$row['displayname'] = $row['displayname'] . "($name)";
516
-			$components = [];
517
-			if ($row['components']) {
518
-				$components = explode(',',$row['components']);
519
-			}
520
-			$calendar = [
521
-				'id' => $row['id'],
522
-				'uri' => $row['publicuri'],
523
-				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
524
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
525
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
526
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
527
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
528
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
529
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
530
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
531
-			];
532
-
533
-			foreach ($this->propertyMap as $xmlName => $dbName) {
534
-				$calendar[$xmlName] = $row[$dbName];
535
-			}
536
-
537
-			$this->addOwnerPrincipal($calendar);
538
-
539
-			if (!isset($calendars[$calendar['id']])) {
540
-				$calendars[$calendar['id']] = $calendar;
541
-			}
542
-		}
543
-		$result->closeCursor();
544
-
545
-		return array_values($calendars);
546
-	}
547
-
548
-	/**
549
-	 * @param string $uri
550
-	 * @return array
551
-	 * @throws NotFound
552
-	 */
553
-	public function getPublicCalendar($uri) {
554
-		$fields = array_values($this->propertyMap);
555
-		$fields[] = 'a.id';
556
-		$fields[] = 'a.uri';
557
-		$fields[] = 'a.synctoken';
558
-		$fields[] = 'a.components';
559
-		$fields[] = 'a.principaluri';
560
-		$fields[] = 'a.transparent';
561
-		$fields[] = 's.access';
562
-		$fields[] = 's.publicuri';
563
-		$query = $this->db->getQueryBuilder();
564
-		$result = $query->select($fields)
565
-			->from('dav_shares', 's')
566
-			->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
567
-			->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
568
-			->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
569
-			->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri)))
570
-			->executeQuery();
571
-
572
-		$row = $result->fetch();
573
-
574
-		$result->closeCursor();
575
-
576
-		if ($row === false) {
577
-			throw new NotFound('Node with name \'' . $uri . '\' could not be found');
578
-		}
579
-
580
-		$row['principaluri'] = (string) $row['principaluri'];
581
-		[, $name] = Uri\split($row['principaluri']);
582
-		$row['displayname'] = $row['displayname'] . ' ' . "($name)";
583
-		$components = [];
584
-		if ($row['components']) {
585
-			$components = explode(',',$row['components']);
586
-		}
587
-		$calendar = [
588
-			'id' => $row['id'],
589
-			'uri' => $row['publicuri'],
590
-			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
591
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
592
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
593
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
594
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
595
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
596
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
597
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
598
-		];
599
-
600
-		foreach ($this->propertyMap as $xmlName => $dbName) {
601
-			$calendar[$xmlName] = $row[$dbName];
602
-		}
603
-
604
-		$this->addOwnerPrincipal($calendar);
605
-
606
-		return $calendar;
607
-	}
608
-
609
-	/**
610
-	 * @param string $principal
611
-	 * @param string $uri
612
-	 * @return array|null
613
-	 */
614
-	public function getCalendarByUri($principal, $uri) {
615
-		$fields = array_values($this->propertyMap);
616
-		$fields[] = 'id';
617
-		$fields[] = 'uri';
618
-		$fields[] = 'synctoken';
619
-		$fields[] = 'components';
620
-		$fields[] = 'principaluri';
621
-		$fields[] = 'transparent';
622
-
623
-		// Making fields a comma-delimited list
624
-		$query = $this->db->getQueryBuilder();
625
-		$query->select($fields)->from('calendars')
626
-			->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
627
-			->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal)))
628
-			->setMaxResults(1);
629
-		$stmt = $query->executeQuery();
630
-
631
-		$row = $stmt->fetch();
632
-		$stmt->closeCursor();
633
-		if ($row === false) {
634
-			return null;
635
-		}
636
-
637
-		$row['principaluri'] = (string) $row['principaluri'];
638
-		$components = [];
639
-		if ($row['components']) {
640
-			$components = explode(',',$row['components']);
641
-		}
642
-
643
-		$calendar = [
644
-			'id' => $row['id'],
645
-			'uri' => $row['uri'],
646
-			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
647
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
648
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
649
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
650
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
651
-		];
652
-
653
-		foreach ($this->propertyMap as $xmlName => $dbName) {
654
-			$calendar[$xmlName] = $row[$dbName];
655
-		}
656
-
657
-		$this->addOwnerPrincipal($calendar);
658
-
659
-		return $calendar;
660
-	}
661
-
662
-	/**
663
-	 * @param $calendarId
664
-	 * @return array|null
665
-	 */
666
-	public function getCalendarById($calendarId) {
667
-		$fields = array_values($this->propertyMap);
668
-		$fields[] = 'id';
669
-		$fields[] = 'uri';
670
-		$fields[] = 'synctoken';
671
-		$fields[] = 'components';
672
-		$fields[] = 'principaluri';
673
-		$fields[] = 'transparent';
674
-
675
-		// Making fields a comma-delimited list
676
-		$query = $this->db->getQueryBuilder();
677
-		$query->select($fields)->from('calendars')
678
-			->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)))
679
-			->setMaxResults(1);
680
-		$stmt = $query->executeQuery();
681
-
682
-		$row = $stmt->fetch();
683
-		$stmt->closeCursor();
684
-		if ($row === false) {
685
-			return null;
686
-		}
687
-
688
-		$row['principaluri'] = (string) $row['principaluri'];
689
-		$components = [];
690
-		if ($row['components']) {
691
-			$components = explode(',',$row['components']);
692
-		}
693
-
694
-		$calendar = [
695
-			'id' => $row['id'],
696
-			'uri' => $row['uri'],
697
-			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
698
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
699
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
700
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
701
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
702
-		];
703
-
704
-		foreach ($this->propertyMap as $xmlName => $dbName) {
705
-			$calendar[$xmlName] = $row[$dbName];
706
-		}
707
-
708
-		$this->addOwnerPrincipal($calendar);
709
-
710
-		return $calendar;
711
-	}
712
-
713
-	/**
714
-	 * @param $subscriptionId
715
-	 */
716
-	public function getSubscriptionById($subscriptionId) {
717
-		$fields = array_values($this->subscriptionPropertyMap);
718
-		$fields[] = 'id';
719
-		$fields[] = 'uri';
720
-		$fields[] = 'source';
721
-		$fields[] = 'synctoken';
722
-		$fields[] = 'principaluri';
723
-		$fields[] = 'lastmodified';
724
-
725
-		$query = $this->db->getQueryBuilder();
726
-		$query->select($fields)
727
-			->from('calendarsubscriptions')
728
-			->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
729
-			->orderBy('calendarorder', 'asc');
730
-		$stmt = $query->executeQuery();
731
-
732
-		$row = $stmt->fetch();
733
-		$stmt->closeCursor();
734
-		if ($row === false) {
735
-			return null;
736
-		}
737
-
738
-		$row['principaluri'] = (string) $row['principaluri'];
739
-		$subscription = [
740
-			'id' => $row['id'],
741
-			'uri' => $row['uri'],
742
-			'principaluri' => $row['principaluri'],
743
-			'source' => $row['source'],
744
-			'lastmodified' => $row['lastmodified'],
745
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
746
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
747
-		];
748
-
749
-		foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
750
-			if (!is_null($row[$dbName])) {
751
-				$subscription[$xmlName] = $row[$dbName];
752
-			}
753
-		}
754
-
755
-		return $subscription;
756
-	}
757
-
758
-	/**
759
-	 * Creates a new calendar for a principal.
760
-	 *
761
-	 * If the creation was a success, an id must be returned that can be used to reference
762
-	 * this calendar in other methods, such as updateCalendar.
763
-	 *
764
-	 * @param string $principalUri
765
-	 * @param string $calendarUri
766
-	 * @param array $properties
767
-	 * @return int
768
-	 */
769
-	public function createCalendar($principalUri, $calendarUri, array $properties) {
770
-		$values = [
771
-			'principaluri' => $this->convertPrincipal($principalUri, true),
772
-			'uri' => $calendarUri,
773
-			'synctoken' => 1,
774
-			'transparent' => 0,
775
-			'components' => 'VEVENT,VTODO',
776
-			'displayname' => $calendarUri
777
-		];
778
-
779
-		// Default value
780
-		$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
781
-		if (isset($properties[$sccs])) {
782
-			if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) {
783
-				throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
784
-			}
785
-			$values['components'] = implode(',',$properties[$sccs]->getValue());
786
-		} elseif (isset($properties['components'])) {
787
-			// Allow to provide components internally without having
788
-			// to create a SupportedCalendarComponentSet object
789
-			$values['components'] = $properties['components'];
790
-		}
791
-
792
-		$transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
793
-		if (isset($properties[$transp])) {
794
-			$values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
795
-		}
796
-
797
-		foreach ($this->propertyMap as $xmlName => $dbName) {
798
-			if (isset($properties[$xmlName])) {
799
-				$values[$dbName] = $properties[$xmlName];
800
-			}
801
-		}
802
-
803
-		$query = $this->db->getQueryBuilder();
804
-		$query->insert('calendars');
805
-		foreach ($values as $column => $value) {
806
-			$query->setValue($column, $query->createNamedParameter($value));
807
-		}
808
-		$query->executeUpdate();
809
-		$calendarId = $query->getLastInsertId();
810
-
811
-		$calendarData = $this->getCalendarById($calendarId);
812
-		$this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData));
813
-		$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent(
814
-			'\OCA\DAV\CalDAV\CalDavBackend::createCalendar',
815
-			[
816
-				'calendarId' => $calendarId,
817
-				'calendarData' => $calendarData,
818
-			]));
819
-
820
-		return $calendarId;
821
-	}
822
-
823
-	/**
824
-	 * Updates properties for a calendar.
825
-	 *
826
-	 * The list of mutations is stored in a Sabre\DAV\PropPatch object.
827
-	 * To do the actual updates, you must tell this object which properties
828
-	 * you're going to process with the handle() method.
829
-	 *
830
-	 * Calling the handle method is like telling the PropPatch object "I
831
-	 * promise I can handle updating this property".
832
-	 *
833
-	 * Read the PropPatch documentation for more info and examples.
834
-	 *
835
-	 * @param mixed $calendarId
836
-	 * @param PropPatch $propPatch
837
-	 * @return void
838
-	 */
839
-	public function updateCalendar($calendarId, PropPatch $propPatch) {
840
-		$supportedProperties = array_keys($this->propertyMap);
841
-		$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
842
-
843
-		$propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
844
-			$newValues = [];
845
-			foreach ($mutations as $propertyName => $propertyValue) {
846
-				switch ($propertyName) {
847
-					case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp':
848
-						$fieldName = 'transparent';
849
-						$newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent');
850
-						break;
851
-					default:
852
-						$fieldName = $this->propertyMap[$propertyName];
853
-						$newValues[$fieldName] = $propertyValue;
854
-						break;
855
-				}
856
-			}
857
-			$query = $this->db->getQueryBuilder();
858
-			$query->update('calendars');
859
-			foreach ($newValues as $fieldName => $value) {
860
-				$query->set($fieldName, $query->createNamedParameter($value));
861
-			}
862
-			$query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
863
-			$query->executeUpdate();
864
-
865
-			$this->addChange($calendarId, "", 2);
866
-
867
-			$calendarData = $this->getCalendarById($calendarId);
868
-			$shares = $this->getShares($calendarId);
869
-			$this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations));
870
-			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent(
871
-				'\OCA\DAV\CalDAV\CalDavBackend::updateCalendar',
872
-				[
873
-					'calendarId' => $calendarId,
874
-					'calendarData' => $calendarData,
875
-					'shares' => $shares,
876
-					'propertyMutations' => $mutations,
877
-				]));
878
-
879
-			return true;
880
-		});
881
-	}
882
-
883
-	/**
884
-	 * Delete a calendar and all it's objects
885
-	 *
886
-	 * @param mixed $calendarId
887
-	 * @return void
888
-	 */
889
-	public function deleteCalendar($calendarId) {
890
-		$calendarData = $this->getCalendarById($calendarId);
891
-		$shares = $this->getShares($calendarId);
892
-
893
-		$stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `calendartype` = ?');
894
-		$stmt->execute([$calendarId, self::CALENDAR_TYPE_CALENDAR]);
895
-
896
-		$stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendars` WHERE `id` = ?');
897
-		$stmt->execute([$calendarId]);
898
-
899
-		$stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarchanges` WHERE `calendarid` = ? AND `calendartype` = ?');
900
-		$stmt->execute([$calendarId, self::CALENDAR_TYPE_CALENDAR]);
901
-
902
-		$this->calendarSharingBackend->deleteAllShares($calendarId);
903
-
904
-		$query = $this->db->getQueryBuilder();
905
-		$query->delete($this->dbObjectPropertiesTable)
906
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
907
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)))
908
-			->executeUpdate();
909
-
910
-		// Only dispatch if we actually deleted anything
911
-		if ($calendarData) {
912
-			$this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares));
913
-		}
914
-	}
915
-
916
-	/**
917
-	 * Delete all of an user's shares
918
-	 *
919
-	 * @param string $principaluri
920
-	 * @return void
921
-	 */
922
-	public function deleteAllSharesByUser($principaluri) {
923
-		$this->calendarSharingBackend->deleteAllSharesByUser($principaluri);
924
-	}
925
-
926
-	/**
927
-	 * Returns all calendar objects within a calendar.
928
-	 *
929
-	 * Every item contains an array with the following keys:
930
-	 *   * calendardata - The iCalendar-compatible calendar data
931
-	 *   * uri - a unique key which will be used to construct the uri. This can
932
-	 *     be any arbitrary string, but making sure it ends with '.ics' is a
933
-	 *     good idea. This is only the basename, or filename, not the full
934
-	 *     path.
935
-	 *   * lastmodified - a timestamp of the last modification time
936
-	 *   * etag - An arbitrary string, surrounded by double-quotes. (e.g.:
937
-	 *   '"abcdef"')
938
-	 *   * size - The size of the calendar objects, in bytes.
939
-	 *   * component - optional, a string containing the type of object, such
940
-	 *     as 'vevent' or 'vtodo'. If specified, this will be used to populate
941
-	 *     the Content-Type header.
942
-	 *
943
-	 * Note that the etag is optional, but it's highly encouraged to return for
944
-	 * speed reasons.
945
-	 *
946
-	 * The calendardata is also optional. If it's not returned
947
-	 * 'getCalendarObject' will be called later, which *is* expected to return
948
-	 * calendardata.
949
-	 *
950
-	 * If neither etag or size are specified, the calendardata will be
951
-	 * used/fetched to determine these numbers. If both are specified the
952
-	 * amount of times this is needed is reduced by a great degree.
953
-	 *
954
-	 * @param mixed $calendarId
955
-	 * @param int $calendarType
956
-	 * @return array
957
-	 */
958
-	public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
959
-		$query = $this->db->getQueryBuilder();
960
-		$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification'])
961
-			->from('calendarobjects')
962
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
963
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
964
-		$stmt = $query->executeQuery();
965
-
966
-		$result = [];
967
-		foreach ($stmt->fetchAll() as $row) {
968
-			$result[] = [
969
-				'id' => $row['id'],
970
-				'uri' => $row['uri'],
971
-				'lastmodified' => $row['lastmodified'],
972
-				'etag' => '"' . $row['etag'] . '"',
973
-				'calendarid' => $row['calendarid'],
974
-				'size' => (int)$row['size'],
975
-				'component' => strtolower($row['componenttype']),
976
-				'classification' => (int)$row['classification']
977
-			];
978
-		}
979
-		$stmt->closeCursor();
980
-
981
-		return $result;
982
-	}
983
-
984
-	/**
985
-	 * Returns information from a single calendar object, based on it's object
986
-	 * uri.
987
-	 *
988
-	 * The object uri is only the basename, or filename and not a full path.
989
-	 *
990
-	 * The returned array must have the same keys as getCalendarObjects. The
991
-	 * 'calendardata' object is required here though, while it's not required
992
-	 * for getCalendarObjects.
993
-	 *
994
-	 * This method must return null if the object did not exist.
995
-	 *
996
-	 * @param mixed $calendarId
997
-	 * @param string $objectUri
998
-	 * @param int $calendarType
999
-	 * @return array|null
1000
-	 */
1001
-	public function getCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1002
-		$query = $this->db->getQueryBuilder();
1003
-		$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
1004
-			->from('calendarobjects')
1005
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1006
-			->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
1007
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
1008
-		$stmt = $query->executeQuery();
1009
-		$row = $stmt->fetch();
1010
-		$stmt->closeCursor();
1011
-
1012
-		if (!$row) {
1013
-			return null;
1014
-		}
1015
-
1016
-		return [
1017
-			'id' => $row['id'],
1018
-			'uri' => $row['uri'],
1019
-			'lastmodified' => $row['lastmodified'],
1020
-			'etag' => '"' . $row['etag'] . '"',
1021
-			'calendarid' => $row['calendarid'],
1022
-			'size' => (int)$row['size'],
1023
-			'calendardata' => $this->readBlob($row['calendardata']),
1024
-			'component' => strtolower($row['componenttype']),
1025
-			'classification' => (int)$row['classification']
1026
-		];
1027
-	}
1028
-
1029
-	/**
1030
-	 * Returns a list of calendar objects.
1031
-	 *
1032
-	 * This method should work identical to getCalendarObject, but instead
1033
-	 * return all the calendar objects in the list as an array.
1034
-	 *
1035
-	 * If the backend supports this, it may allow for some speed-ups.
1036
-	 *
1037
-	 * @param mixed $calendarId
1038
-	 * @param string[] $uris
1039
-	 * @param int $calendarType
1040
-	 * @return array
1041
-	 */
1042
-	public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1043
-		if (empty($uris)) {
1044
-			return [];
1045
-		}
1046
-
1047
-		$chunks = array_chunk($uris, 100);
1048
-		$objects = [];
1049
-
1050
-		$query = $this->db->getQueryBuilder();
1051
-		$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
1052
-			->from('calendarobjects')
1053
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1054
-			->andWhere($query->expr()->in('uri', $query->createParameter('uri')))
1055
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
1056
-
1057
-		foreach ($chunks as $uris) {
1058
-			$query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY);
1059
-			$result = $query->executeQuery();
1060
-
1061
-			while ($row = $result->fetch()) {
1062
-				$objects[] = [
1063
-					'id' => $row['id'],
1064
-					'uri' => $row['uri'],
1065
-					'lastmodified' => $row['lastmodified'],
1066
-					'etag' => '"' . $row['etag'] . '"',
1067
-					'calendarid' => $row['calendarid'],
1068
-					'size' => (int)$row['size'],
1069
-					'calendardata' => $this->readBlob($row['calendardata']),
1070
-					'component' => strtolower($row['componenttype']),
1071
-					'classification' => (int)$row['classification']
1072
-				];
1073
-			}
1074
-			$result->closeCursor();
1075
-		}
1076
-
1077
-		return $objects;
1078
-	}
1079
-
1080
-	/**
1081
-	 * Creates a new calendar object.
1082
-	 *
1083
-	 * The object uri is only the basename, or filename and not a full path.
1084
-	 *
1085
-	 * It is possible return an etag from this function, which will be used in
1086
-	 * the response to this PUT request. Note that the ETag must be surrounded
1087
-	 * by double-quotes.
1088
-	 *
1089
-	 * However, you should only really return this ETag if you don't mangle the
1090
-	 * calendar-data. If the result of a subsequent GET to this object is not
1091
-	 * the exact same as this request body, you should omit the ETag.
1092
-	 *
1093
-	 * @param mixed $calendarId
1094
-	 * @param string $objectUri
1095
-	 * @param string $calendarData
1096
-	 * @param int $calendarType
1097
-	 * @return string
1098
-	 */
1099
-	public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1100
-		$extraData = $this->getDenormalizedData($calendarData);
1101
-
1102
-		$q = $this->db->getQueryBuilder();
1103
-		$q->select($q->func()->count('*'))
1104
-			->from('calendarobjects')
1105
-			->where($q->expr()->eq('calendarid', $q->createNamedParameter($calendarId)))
1106
-			->andWhere($q->expr()->eq('uid', $q->createNamedParameter($extraData['uid'])))
1107
-			->andWhere($q->expr()->eq('calendartype', $q->createNamedParameter($calendarType)));
1108
-
1109
-		$result = $q->executeQuery();
1110
-		$count = (int) $result->fetchOne();
1111
-		$result->closeCursor();
1112
-
1113
-		if ($count !== 0) {
1114
-			throw new \Sabre\DAV\Exception\BadRequest('Calendar object with uid already exists in this calendar collection.');
1115
-		}
1116
-
1117
-		$query = $this->db->getQueryBuilder();
1118
-		$query->insert('calendarobjects')
1119
-			->values([
1120
-				'calendarid' => $query->createNamedParameter($calendarId),
1121
-				'uri' => $query->createNamedParameter($objectUri),
1122
-				'calendardata' => $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB),
1123
-				'lastmodified' => $query->createNamedParameter(time()),
1124
-				'etag' => $query->createNamedParameter($extraData['etag']),
1125
-				'size' => $query->createNamedParameter($extraData['size']),
1126
-				'componenttype' => $query->createNamedParameter($extraData['componentType']),
1127
-				'firstoccurence' => $query->createNamedParameter($extraData['firstOccurence']),
1128
-				'lastoccurence' => $query->createNamedParameter($extraData['lastOccurence']),
1129
-				'classification' => $query->createNamedParameter($extraData['classification']),
1130
-				'uid' => $query->createNamedParameter($extraData['uid']),
1131
-				'calendartype' => $query->createNamedParameter($calendarType),
1132
-			])
1133
-			->executeUpdate();
1134
-
1135
-		$this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
1136
-		$this->addChange($calendarId, $objectUri, 1, $calendarType);
1137
-
1138
-		$objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1139
-		if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1140
-			$calendarRow = $this->getCalendarById($calendarId);
1141
-			$shares = $this->getShares($calendarId);
1142
-
1143
-			$this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
1144
-			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent(
1145
-				'\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject',
1146
-				[
1147
-					'calendarId' => $calendarId,
1148
-					'calendarData' => $calendarRow,
1149
-					'shares' => $shares,
1150
-					'objectData' => $objectRow,
1151
-				]
1152
-			));
1153
-		} else {
1154
-			$subscriptionRow = $this->getSubscriptionById($calendarId);
1155
-
1156
-			$this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow));
1157
-			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent(
1158
-				'\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject',
1159
-				[
1160
-					'subscriptionId' => $calendarId,
1161
-					'calendarData' => $subscriptionRow,
1162
-					'shares' => [],
1163
-					'objectData' => $objectRow,
1164
-				]
1165
-			));
1166
-		}
1167
-
1168
-		return '"' . $extraData['etag'] . '"';
1169
-	}
1170
-
1171
-	/**
1172
-	 * Updates an existing calendarobject, based on it's uri.
1173
-	 *
1174
-	 * The object uri is only the basename, or filename and not a full path.
1175
-	 *
1176
-	 * It is possible return an etag from this function, which will be used in
1177
-	 * the response to this PUT request. Note that the ETag must be surrounded
1178
-	 * by double-quotes.
1179
-	 *
1180
-	 * However, you should only really return this ETag if you don't mangle the
1181
-	 * calendar-data. If the result of a subsequent GET to this object is not
1182
-	 * the exact same as this request body, you should omit the ETag.
1183
-	 *
1184
-	 * @param mixed $calendarId
1185
-	 * @param string $objectUri
1186
-	 * @param string $calendarData
1187
-	 * @param int $calendarType
1188
-	 * @return string
1189
-	 */
1190
-	public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1191
-		$extraData = $this->getDenormalizedData($calendarData);
1192
-		$query = $this->db->getQueryBuilder();
1193
-		$query->update('calendarobjects')
1194
-				->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB))
1195
-				->set('lastmodified', $query->createNamedParameter(time()))
1196
-				->set('etag', $query->createNamedParameter($extraData['etag']))
1197
-				->set('size', $query->createNamedParameter($extraData['size']))
1198
-				->set('componenttype', $query->createNamedParameter($extraData['componentType']))
1199
-				->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence']))
1200
-				->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence']))
1201
-				->set('classification', $query->createNamedParameter($extraData['classification']))
1202
-				->set('uid', $query->createNamedParameter($extraData['uid']))
1203
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1204
-			->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
1205
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1206
-			->executeUpdate();
1207
-
1208
-		$this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
1209
-		$this->addChange($calendarId, $objectUri, 2, $calendarType);
1210
-
1211
-		$objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1212
-		if (is_array($objectRow)) {
1213
-			if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1214
-				$calendarRow = $this->getCalendarById($calendarId);
1215
-				$shares = $this->getShares($calendarId);
1216
-
1217
-				$this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
1218
-				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent(
1219
-					'\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject',
1220
-					[
1221
-						'calendarId' => $calendarId,
1222
-						'calendarData' => $calendarRow,
1223
-						'shares' => $shares,
1224
-						'objectData' => $objectRow,
1225
-					]
1226
-				));
1227
-			} else {
1228
-				$subscriptionRow = $this->getSubscriptionById($calendarId);
1229
-
1230
-				$this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow));
1231
-				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent(
1232
-					'\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject',
1233
-					[
1234
-						'subscriptionId' => $calendarId,
1235
-						'calendarData' => $subscriptionRow,
1236
-						'shares' => [],
1237
-						'objectData' => $objectRow,
1238
-					]
1239
-				));
1240
-			}
1241
-		}
1242
-
1243
-		return '"' . $extraData['etag'] . '"';
1244
-	}
1245
-
1246
-	/**
1247
-	 * @param int $calendarObjectId
1248
-	 * @param int $classification
1249
-	 */
1250
-	public function setClassification($calendarObjectId, $classification) {
1251
-		if (!in_array($classification, [
1252
-			self::CLASSIFICATION_PUBLIC, self::CLASSIFICATION_PRIVATE, self::CLASSIFICATION_CONFIDENTIAL
1253
-		])) {
1254
-			throw new \InvalidArgumentException();
1255
-		}
1256
-		$query = $this->db->getQueryBuilder();
1257
-		$query->update('calendarobjects')
1258
-			->set('classification', $query->createNamedParameter($classification))
1259
-			->where($query->expr()->eq('id', $query->createNamedParameter($calendarObjectId)))
1260
-			->executeUpdate();
1261
-	}
1262
-
1263
-	/**
1264
-	 * Deletes an existing calendar object.
1265
-	 *
1266
-	 * The object uri is only the basename, or filename and not a full path.
1267
-	 *
1268
-	 * @param mixed $calendarId
1269
-	 * @param string $objectUri
1270
-	 * @param int $calendarType
1271
-	 * @return void
1272
-	 */
1273
-	public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1274
-		$data = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1275
-		if (is_array($data)) {
1276
-			if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1277
-				$calendarRow = $this->getCalendarById($calendarId);
1278
-				$shares = $this->getShares($calendarId);
1279
-
1280
-				$this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data));
1281
-				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent(
1282
-					'\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject',
1283
-					[
1284
-						'calendarId' => $calendarId,
1285
-						'calendarData' => $calendarRow,
1286
-						'shares' => $shares,
1287
-						'objectData' => $data,
1288
-					]
1289
-				));
1290
-			} else {
1291
-				$subscriptionRow = $this->getSubscriptionById($calendarId);
1292
-
1293
-				$this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data));
1294
-				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent(
1295
-					'\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject',
1296
-					[
1297
-						'subscriptionId' => $calendarId,
1298
-						'calendarData' => $subscriptionRow,
1299
-						'shares' => [],
1300
-						'objectData' => $data,
1301
-					]
1302
-				));
1303
-			}
1304
-		}
1305
-
1306
-		$stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `uri` = ? AND `calendartype` = ?');
1307
-		$stmt->execute([$calendarId, $objectUri, $calendarType]);
1308
-
1309
-		if (is_array($data)) {
1310
-			$this->purgeProperties($calendarId, $data['id'], $calendarType);
1311
-		}
1312
-
1313
-		$this->addChange($calendarId, $objectUri, 3, $calendarType);
1314
-	}
1315
-
1316
-	/**
1317
-	 * Performs a calendar-query on the contents of this calendar.
1318
-	 *
1319
-	 * The calendar-query is defined in RFC4791 : CalDAV. Using the
1320
-	 * calendar-query it is possible for a client to request a specific set of
1321
-	 * object, based on contents of iCalendar properties, date-ranges and
1322
-	 * iCalendar component types (VTODO, VEVENT).
1323
-	 *
1324
-	 * This method should just return a list of (relative) urls that match this
1325
-	 * query.
1326
-	 *
1327
-	 * The list of filters are specified as an array. The exact array is
1328
-	 * documented by Sabre\CalDAV\CalendarQueryParser.
1329
-	 *
1330
-	 * Note that it is extremely likely that getCalendarObject for every path
1331
-	 * returned from this method will be called almost immediately after. You
1332
-	 * may want to anticipate this to speed up these requests.
1333
-	 *
1334
-	 * This method provides a default implementation, which parses *all* the
1335
-	 * iCalendar objects in the specified calendar.
1336
-	 *
1337
-	 * This default may well be good enough for personal use, and calendars
1338
-	 * that aren't very large. But if you anticipate high usage, big calendars
1339
-	 * or high loads, you are strongly advised to optimize certain paths.
1340
-	 *
1341
-	 * The best way to do so is override this method and to optimize
1342
-	 * specifically for 'common filters'.
1343
-	 *
1344
-	 * Requests that are extremely common are:
1345
-	 *   * requests for just VEVENTS
1346
-	 *   * requests for just VTODO
1347
-	 *   * requests with a time-range-filter on either VEVENT or VTODO.
1348
-	 *
1349
-	 * ..and combinations of these requests. It may not be worth it to try to
1350
-	 * handle every possible situation and just rely on the (relatively
1351
-	 * easy to use) CalendarQueryValidator to handle the rest.
1352
-	 *
1353
-	 * Note that especially time-range-filters may be difficult to parse. A
1354
-	 * time-range filter specified on a VEVENT must for instance also handle
1355
-	 * recurrence rules correctly.
1356
-	 * A good example of how to interprete all these filters can also simply
1357
-	 * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct
1358
-	 * as possible, so it gives you a good idea on what type of stuff you need
1359
-	 * to think of.
1360
-	 *
1361
-	 * @param mixed $calendarId
1362
-	 * @param array $filters
1363
-	 * @param int $calendarType
1364
-	 * @return array
1365
-	 */
1366
-	public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1367
-		$componentType = null;
1368
-		$requirePostFilter = true;
1369
-		$timeRange = null;
1370
-
1371
-		// if no filters were specified, we don't need to filter after a query
1372
-		if (!$filters['prop-filters'] && !$filters['comp-filters']) {
1373
-			$requirePostFilter = false;
1374
-		}
1375
-
1376
-		// Figuring out if there's a component filter
1377
-		if (count($filters['comp-filters']) > 0 && !$filters['comp-filters'][0]['is-not-defined']) {
1378
-			$componentType = $filters['comp-filters'][0]['name'];
1379
-
1380
-			// Checking if we need post-filters
1381
-			if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['time-range'] && !$filters['comp-filters'][0]['prop-filters']) {
1382
-				$requirePostFilter = false;
1383
-			}
1384
-			// There was a time-range filter
1385
-			if ($componentType === 'VEVENT' && isset($filters['comp-filters'][0]['time-range']) && is_array($filters['comp-filters'][0]['time-range'])) {
1386
-				$timeRange = $filters['comp-filters'][0]['time-range'];
1387
-
1388
-				// If start time OR the end time is not specified, we can do a
1389
-				// 100% accurate mysql query.
1390
-				if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && (!$timeRange['start'] || !$timeRange['end'])) {
1391
-					$requirePostFilter = false;
1392
-				}
1393
-			}
1394
-		}
1395
-		$columns = ['uri'];
1396
-		if ($requirePostFilter) {
1397
-			$columns = ['uri', 'calendardata'];
1398
-		}
1399
-		$query = $this->db->getQueryBuilder();
1400
-		$query->select($columns)
1401
-			->from('calendarobjects')
1402
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1403
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
1404
-
1405
-		if ($componentType) {
1406
-			$query->andWhere($query->expr()->eq('componenttype', $query->createNamedParameter($componentType)));
1407
-		}
1408
-
1409
-		if ($timeRange && $timeRange['start']) {
1410
-			$query->andWhere($query->expr()->gt('lastoccurence', $query->createNamedParameter($timeRange['start']->getTimeStamp())));
1411
-		}
1412
-		if ($timeRange && $timeRange['end']) {
1413
-			$query->andWhere($query->expr()->lt('firstoccurence', $query->createNamedParameter($timeRange['end']->getTimeStamp())));
1414
-		}
1415
-
1416
-		$stmt = $query->executeQuery();
1417
-
1418
-		$result = [];
1419
-		while ($row = $stmt->fetch()) {
1420
-			if ($requirePostFilter) {
1421
-				// validateFilterForObject will parse the calendar data
1422
-				// catch parsing errors
1423
-				try {
1424
-					$matches = $this->validateFilterForObject($row, $filters);
1425
-				} catch (ParseException $ex) {
1426
-					$this->logger->logException($ex, [
1427
-						'app' => 'dav',
1428
-						'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri']
1429
-					]);
1430
-					continue;
1431
-				} catch (InvalidDataException $ex) {
1432
-					$this->logger->logException($ex, [
1433
-						'app' => 'dav',
1434
-						'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri']
1435
-					]);
1436
-					continue;
1437
-				}
1438
-
1439
-				if (!$matches) {
1440
-					continue;
1441
-				}
1442
-			}
1443
-			$result[] = $row['uri'];
1444
-		}
1445
-
1446
-		return $result;
1447
-	}
1448
-
1449
-	/**
1450
-	 * custom Nextcloud search extension for CalDAV
1451
-	 *
1452
-	 * TODO - this should optionally cover cached calendar objects as well
1453
-	 *
1454
-	 * @param string $principalUri
1455
-	 * @param array $filters
1456
-	 * @param integer|null $limit
1457
-	 * @param integer|null $offset
1458
-	 * @return array
1459
-	 */
1460
-	public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) {
1461
-		$calendars = $this->getCalendarsForUser($principalUri);
1462
-		$ownCalendars = [];
1463
-		$sharedCalendars = [];
1464
-
1465
-		$uriMapper = [];
1466
-
1467
-		foreach ($calendars as $calendar) {
1468
-			if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) {
1469
-				$ownCalendars[] = $calendar['id'];
1470
-			} else {
1471
-				$sharedCalendars[] = $calendar['id'];
1472
-			}
1473
-			$uriMapper[$calendar['id']] = $calendar['uri'];
1474
-		}
1475
-		if (count($ownCalendars) === 0 && count($sharedCalendars) === 0) {
1476
-			return [];
1477
-		}
1478
-
1479
-		$query = $this->db->getQueryBuilder();
1480
-		// Calendar id expressions
1481
-		$calendarExpressions = [];
1482
-		foreach ($ownCalendars as $id) {
1483
-			$calendarExpressions[] = $query->expr()->andX(
1484
-				$query->expr()->eq('c.calendarid',
1485
-					$query->createNamedParameter($id)),
1486
-				$query->expr()->eq('c.calendartype',
1487
-						$query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1488
-		}
1489
-		foreach ($sharedCalendars as $id) {
1490
-			$calendarExpressions[] = $query->expr()->andX(
1491
-				$query->expr()->eq('c.calendarid',
1492
-					$query->createNamedParameter($id)),
1493
-				$query->expr()->eq('c.classification',
1494
-					$query->createNamedParameter(self::CLASSIFICATION_PUBLIC)),
1495
-				$query->expr()->eq('c.calendartype',
1496
-					$query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1497
-		}
1498
-
1499
-		if (count($calendarExpressions) === 1) {
1500
-			$calExpr = $calendarExpressions[0];
1501
-		} else {
1502
-			$calExpr = call_user_func_array([$query->expr(), 'orX'], $calendarExpressions);
1503
-		}
1504
-
1505
-		// Component expressions
1506
-		$compExpressions = [];
1507
-		foreach ($filters['comps'] as $comp) {
1508
-			$compExpressions[] = $query->expr()
1509
-				->eq('c.componenttype', $query->createNamedParameter($comp));
1510
-		}
1511
-
1512
-		if (count($compExpressions) === 1) {
1513
-			$compExpr = $compExpressions[0];
1514
-		} else {
1515
-			$compExpr = call_user_func_array([$query->expr(), 'orX'], $compExpressions);
1516
-		}
1517
-
1518
-		if (!isset($filters['props'])) {
1519
-			$filters['props'] = [];
1520
-		}
1521
-		if (!isset($filters['params'])) {
1522
-			$filters['params'] = [];
1523
-		}
1524
-
1525
-		$propParamExpressions = [];
1526
-		foreach ($filters['props'] as $prop) {
1527
-			$propParamExpressions[] = $query->expr()->andX(
1528
-				$query->expr()->eq('i.name', $query->createNamedParameter($prop)),
1529
-				$query->expr()->isNull('i.parameter')
1530
-			);
1531
-		}
1532
-		foreach ($filters['params'] as $param) {
1533
-			$propParamExpressions[] = $query->expr()->andX(
1534
-				$query->expr()->eq('i.name', $query->createNamedParameter($param['property'])),
1535
-				$query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter']))
1536
-			);
1537
-		}
1538
-
1539
-		if (count($propParamExpressions) === 1) {
1540
-			$propParamExpr = $propParamExpressions[0];
1541
-		} else {
1542
-			$propParamExpr = call_user_func_array([$query->expr(), 'orX'], $propParamExpressions);
1543
-		}
1544
-
1545
-		$query->select(['c.calendarid', 'c.uri'])
1546
-			->from($this->dbObjectPropertiesTable, 'i')
1547
-			->join('i', 'calendarobjects', 'c', $query->expr()->eq('i.objectid', 'c.id'))
1548
-			->where($calExpr)
1549
-			->andWhere($compExpr)
1550
-			->andWhere($propParamExpr)
1551
-			->andWhere($query->expr()->iLike('i.value',
1552
-				$query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%')));
1553
-
1554
-		if ($offset) {
1555
-			$query->setFirstResult($offset);
1556
-		}
1557
-		if ($limit) {
1558
-			$query->setMaxResults($limit);
1559
-		}
1560
-
1561
-		$stmt = $query->executeQuery();
1562
-
1563
-		$result = [];
1564
-		while ($row = $stmt->fetch()) {
1565
-			$path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
1566
-			if (!in_array($path, $result)) {
1567
-				$result[] = $path;
1568
-			}
1569
-		}
1570
-
1571
-		return $result;
1572
-	}
1573
-
1574
-	/**
1575
-	 * used for Nextcloud's calendar API
1576
-	 *
1577
-	 * @param array $calendarInfo
1578
-	 * @param string $pattern
1579
-	 * @param array $searchProperties
1580
-	 * @param array $options
1581
-	 * @param integer|null $limit
1582
-	 * @param integer|null $offset
1583
-	 *
1584
-	 * @return array
1585
-	 */
1586
-	public function search(array $calendarInfo, $pattern, array $searchProperties,
1587
-						   array $options, $limit, $offset) {
1588
-		$outerQuery = $this->db->getQueryBuilder();
1589
-		$innerQuery = $this->db->getQueryBuilder();
1590
-
1591
-		$innerQuery->selectDistinct('op.objectid')
1592
-			->from($this->dbObjectPropertiesTable, 'op')
1593
-			->andWhere($innerQuery->expr()->eq('op.calendarid',
1594
-				$outerQuery->createNamedParameter($calendarInfo['id'])))
1595
-			->andWhere($innerQuery->expr()->eq('op.calendartype',
1596
-				$outerQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1597
-
1598
-		// only return public items for shared calendars for now
1599
-		if ($calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) {
1600
-			$innerQuery->andWhere($innerQuery->expr()->eq('c.classification',
1601
-				$outerQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
1602
-		}
1603
-
1604
-		$or = $innerQuery->expr()->orX();
1605
-		foreach ($searchProperties as $searchProperty) {
1606
-			$or->add($innerQuery->expr()->eq('op.name',
1607
-				$outerQuery->createNamedParameter($searchProperty)));
1608
-		}
1609
-		$innerQuery->andWhere($or);
1610
-
1611
-		if ($pattern !== '') {
1612
-			$innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
1613
-				$outerQuery->createNamedParameter('%' .
1614
-					$this->db->escapeLikeParameter($pattern) . '%')));
1615
-		}
1616
-
1617
-		$outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
1618
-			->from('calendarobjects', 'c');
1619
-
1620
-		if (isset($options['timerange'])) {
1621
-			if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTime) {
1622
-				$outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence',
1623
-					$outerQuery->createNamedParameter($options['timerange']['start']->getTimeStamp())));
1624
-			}
1625
-			if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTime) {
1626
-				$outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence',
1627
-					$outerQuery->createNamedParameter($options['timerange']['end']->getTimeStamp())));
1628
-			}
1629
-		}
1630
-
1631
-		if (isset($options['types'])) {
1632
-			$or = $outerQuery->expr()->orX();
1633
-			foreach ($options['types'] as $type) {
1634
-				$or->add($outerQuery->expr()->eq('componenttype',
1635
-					$outerQuery->createNamedParameter($type)));
1636
-			}
1637
-			$outerQuery->andWhere($or);
1638
-		}
1639
-
1640
-		$outerQuery->andWhere($outerQuery->expr()->in('c.id',
1641
-			$outerQuery->createFunction($innerQuery->getSQL())));
1642
-
1643
-		if ($offset) {
1644
-			$outerQuery->setFirstResult($offset);
1645
-		}
1646
-		if ($limit) {
1647
-			$outerQuery->setMaxResults($limit);
1648
-		}
1649
-
1650
-		$result = $outerQuery->executeQuery();
1651
-		$calendarObjects = $result->fetchAll();
1652
-
1653
-		return array_map(function ($o) {
1654
-			$calendarData = Reader::read($o['calendardata']);
1655
-			$comps = $calendarData->getComponents();
1656
-			$objects = [];
1657
-			$timezones = [];
1658
-			foreach ($comps as $comp) {
1659
-				if ($comp instanceof VTimeZone) {
1660
-					$timezones[] = $comp;
1661
-				} else {
1662
-					$objects[] = $comp;
1663
-				}
1664
-			}
1665
-
1666
-			return [
1667
-				'id' => $o['id'],
1668
-				'type' => $o['componenttype'],
1669
-				'uid' => $o['uid'],
1670
-				'uri' => $o['uri'],
1671
-				'objects' => array_map(function ($c) {
1672
-					return $this->transformSearchData($c);
1673
-				}, $objects),
1674
-				'timezones' => array_map(function ($c) {
1675
-					return $this->transformSearchData($c);
1676
-				}, $timezones),
1677
-			];
1678
-		}, $calendarObjects);
1679
-	}
1680
-
1681
-	/**
1682
-	 * @param Component $comp
1683
-	 * @return array
1684
-	 */
1685
-	private function transformSearchData(Component $comp) {
1686
-		$data = [];
1687
-		/** @var Component[] $subComponents */
1688
-		$subComponents = $comp->getComponents();
1689
-		/** @var Property[] $properties */
1690
-		$properties = array_filter($comp->children(), function ($c) {
1691
-			return $c instanceof Property;
1692
-		});
1693
-		$validationRules = $comp->getValidationRules();
1694
-
1695
-		foreach ($subComponents as $subComponent) {
1696
-			$name = $subComponent->name;
1697
-			if (!isset($data[$name])) {
1698
-				$data[$name] = [];
1699
-			}
1700
-			$data[$name][] = $this->transformSearchData($subComponent);
1701
-		}
1702
-
1703
-		foreach ($properties as $property) {
1704
-			$name = $property->name;
1705
-			if (!isset($validationRules[$name])) {
1706
-				$validationRules[$name] = '*';
1707
-			}
1708
-
1709
-			$rule = $validationRules[$property->name];
1710
-			if ($rule === '+' || $rule === '*') { // multiple
1711
-				if (!isset($data[$name])) {
1712
-					$data[$name] = [];
1713
-				}
1714
-
1715
-				$data[$name][] = $this->transformSearchProperty($property);
1716
-			} else { // once
1717
-				$data[$name] = $this->transformSearchProperty($property);
1718
-			}
1719
-		}
1720
-
1721
-		return $data;
1722
-	}
1723
-
1724
-	/**
1725
-	 * @param Property $prop
1726
-	 * @return array
1727
-	 */
1728
-	private function transformSearchProperty(Property $prop) {
1729
-		// No need to check Date, as it extends DateTime
1730
-		if ($prop instanceof Property\ICalendar\DateTime) {
1731
-			$value = $prop->getDateTime();
1732
-		} else {
1733
-			$value = $prop->getValue();
1734
-		}
1735
-
1736
-		return [
1737
-			$value,
1738
-			$prop->parameters()
1739
-		];
1740
-	}
1741
-
1742
-	/**
1743
-	 * @param string $principalUri
1744
-	 * @param string $pattern
1745
-	 * @param array $componentTypes
1746
-	 * @param array $searchProperties
1747
-	 * @param array $searchParameters
1748
-	 * @param array $options
1749
-	 * @return array
1750
-	 */
1751
-	public function searchPrincipalUri(string $principalUri,
1752
-									   string $pattern,
1753
-									   array $componentTypes,
1754
-									   array $searchProperties,
1755
-									   array $searchParameters,
1756
-									   array $options = []): array {
1757
-		$escapePattern = !\array_key_exists('escape_like_param', $options) || $options['escape_like_param'] !== false;
1758
-
1759
-		$calendarObjectIdQuery = $this->db->getQueryBuilder();
1760
-		$calendarOr = $calendarObjectIdQuery->expr()->orX();
1761
-		$searchOr = $calendarObjectIdQuery->expr()->orX();
1762
-
1763
-		// Fetch calendars and subscription
1764
-		$calendars = $this->getCalendarsForUser($principalUri);
1765
-		$subscriptions = $this->getSubscriptionsForUser($principalUri);
1766
-		foreach ($calendars as $calendar) {
1767
-			$calendarAnd = $calendarObjectIdQuery->expr()->andX();
1768
-			$calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])));
1769
-			$calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1770
-
1771
-			// If it's shared, limit search to public events
1772
-			if (isset($calendar['{http://owncloud.org/ns}owner-principal'])
1773
-				&& $calendar['principaluri'] !== $calendar['{http://owncloud.org/ns}owner-principal']) {
1774
-				$calendarAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
1775
-			}
1776
-
1777
-			$calendarOr->add($calendarAnd);
1778
-		}
1779
-		foreach ($subscriptions as $subscription) {
1780
-			$subscriptionAnd = $calendarObjectIdQuery->expr()->andX();
1781
-			$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])));
1782
-			$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)));
1783
-
1784
-			// If it's shared, limit search to public events
1785
-			if (isset($subscription['{http://owncloud.org/ns}owner-principal'])
1786
-				&& $subscription['principaluri'] !== $subscription['{http://owncloud.org/ns}owner-principal']) {
1787
-				$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
1788
-			}
1789
-
1790
-			$calendarOr->add($subscriptionAnd);
1791
-		}
1792
-
1793
-		foreach ($searchProperties as $property) {
1794
-			$propertyAnd = $calendarObjectIdQuery->expr()->andX();
1795
-			$propertyAnd->add($calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR)));
1796
-			$propertyAnd->add($calendarObjectIdQuery->expr()->isNull('cob.parameter'));
1797
-
1798
-			$searchOr->add($propertyAnd);
1799
-		}
1800
-		foreach ($searchParameters as $property => $parameter) {
1801
-			$parameterAnd = $calendarObjectIdQuery->expr()->andX();
1802
-			$parameterAnd->add($calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR)));
1803
-			$parameterAnd->add($calendarObjectIdQuery->expr()->eq('cob.parameter', $calendarObjectIdQuery->createNamedParameter($parameter, IQueryBuilder::PARAM_STR_ARRAY)));
1804
-
1805
-			$searchOr->add($parameterAnd);
1806
-		}
1807
-
1808
-		if ($calendarOr->count() === 0) {
1809
-			return [];
1810
-		}
1811
-		if ($searchOr->count() === 0) {
1812
-			return [];
1813
-		}
1814
-
1815
-		$calendarObjectIdQuery->selectDistinct('cob.objectid')
1816
-			->from($this->dbObjectPropertiesTable, 'cob')
1817
-			->leftJoin('cob', 'calendarobjects', 'co', $calendarObjectIdQuery->expr()->eq('co.id', 'cob.objectid'))
1818
-			->andWhere($calendarObjectIdQuery->expr()->in('co.componenttype', $calendarObjectIdQuery->createNamedParameter($componentTypes, IQueryBuilder::PARAM_STR_ARRAY)))
1819
-			->andWhere($calendarOr)
1820
-			->andWhere($searchOr);
1821
-
1822
-		if ('' !== $pattern) {
1823
-			if (!$escapePattern) {
1824
-				$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern)));
1825
-			} else {
1826
-				$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
1827
-			}
1828
-		}
1829
-
1830
-		if (isset($options['limit'])) {
1831
-			$calendarObjectIdQuery->setMaxResults($options['limit']);
1832
-		}
1833
-		if (isset($options['offset'])) {
1834
-			$calendarObjectIdQuery->setFirstResult($options['offset']);
1835
-		}
1836
-
1837
-		$result = $calendarObjectIdQuery->executeQuery();
1838
-		$matches = $result->fetchAll();
1839
-		$result->closeCursor();
1840
-		$matches = array_map(static function (array $match):int {
1841
-			return (int) $match['objectid'];
1842
-		}, $matches);
1843
-
1844
-		$query = $this->db->getQueryBuilder();
1845
-		$query->select('calendardata', 'uri', 'calendarid', 'calendartype')
1846
-			->from('calendarobjects')
1847
-			->where($query->expr()->in('id', $query->createNamedParameter($matches, IQueryBuilder::PARAM_INT_ARRAY)));
1848
-
1849
-		$result = $query->executeQuery();
1850
-		$calendarObjects = $result->fetchAll();
1851
-		$result->closeCursor();
1852
-
1853
-		return array_map(function (array $array): array {
1854
-			$array['calendarid'] = (int)$array['calendarid'];
1855
-			$array['calendartype'] = (int)$array['calendartype'];
1856
-			$array['calendardata'] = $this->readBlob($array['calendardata']);
1857
-
1858
-			return $array;
1859
-		}, $calendarObjects);
1860
-	}
1861
-
1862
-	/**
1863
-	 * Searches through all of a users calendars and calendar objects to find
1864
-	 * an object with a specific UID.
1865
-	 *
1866
-	 * This method should return the path to this object, relative to the
1867
-	 * calendar home, so this path usually only contains two parts:
1868
-	 *
1869
-	 * calendarpath/objectpath.ics
1870
-	 *
1871
-	 * If the uid is not found, return null.
1872
-	 *
1873
-	 * This method should only consider * objects that the principal owns, so
1874
-	 * any calendars owned by other principals that also appear in this
1875
-	 * collection should be ignored.
1876
-	 *
1877
-	 * @param string $principalUri
1878
-	 * @param string $uid
1879
-	 * @return string|null
1880
-	 */
1881
-	public function getCalendarObjectByUID($principalUri, $uid) {
1882
-		$query = $this->db->getQueryBuilder();
1883
-		$query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi')
1884
-			->from('calendarobjects', 'co')
1885
-			->leftJoin('co', 'calendars', 'c', $query->expr()->eq('co.calendarid', 'c.id'))
1886
-			->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri)))
1887
-			->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid)));
1888
-
1889
-		$stmt = $query->executeQuery();
1890
-		$row = $stmt->fetch();
1891
-		$stmt->closeCursor();
1892
-		if ($row) {
1893
-			return $row['calendaruri'] . '/' . $row['objecturi'];
1894
-		}
1895
-
1896
-		return null;
1897
-	}
1898
-
1899
-	/**
1900
-	 * The getChanges method returns all the changes that have happened, since
1901
-	 * the specified syncToken in the specified calendar.
1902
-	 *
1903
-	 * This function should return an array, such as the following:
1904
-	 *
1905
-	 * [
1906
-	 *   'syncToken' => 'The current synctoken',
1907
-	 *   'added'   => [
1908
-	 *      'new.txt',
1909
-	 *   ],
1910
-	 *   'modified'   => [
1911
-	 *      'modified.txt',
1912
-	 *   ],
1913
-	 *   'deleted' => [
1914
-	 *      'foo.php.bak',
1915
-	 *      'old.txt'
1916
-	 *   ]
1917
-	 * );
1918
-	 *
1919
-	 * The returned syncToken property should reflect the *current* syncToken
1920
-	 * of the calendar, as reported in the {http://sabredav.org/ns}sync-token
1921
-	 * property This is * needed here too, to ensure the operation is atomic.
1922
-	 *
1923
-	 * If the $syncToken argument is specified as null, this is an initial
1924
-	 * sync, and all members should be reported.
1925
-	 *
1926
-	 * The modified property is an array of nodenames that have changed since
1927
-	 * the last token.
1928
-	 *
1929
-	 * The deleted property is an array with nodenames, that have been deleted
1930
-	 * from collection.
1931
-	 *
1932
-	 * The $syncLevel argument is basically the 'depth' of the report. If it's
1933
-	 * 1, you only have to report changes that happened only directly in
1934
-	 * immediate descendants. If it's 2, it should also include changes from
1935
-	 * the nodes below the child collections. (grandchildren)
1936
-	 *
1937
-	 * The $limit argument allows a client to specify how many results should
1938
-	 * be returned at most. If the limit is not specified, it should be treated
1939
-	 * as infinite.
1940
-	 *
1941
-	 * If the limit (infinite or not) is higher than you're willing to return,
1942
-	 * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception.
1943
-	 *
1944
-	 * If the syncToken is expired (due to data cleanup) or unknown, you must
1945
-	 * return null.
1946
-	 *
1947
-	 * The limit is 'suggestive'. You are free to ignore it.
1948
-	 *
1949
-	 * @param string $calendarId
1950
-	 * @param string $syncToken
1951
-	 * @param int $syncLevel
1952
-	 * @param int|null $limit
1953
-	 * @param int $calendarType
1954
-	 * @return array
1955
-	 */
1956
-	public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1957
-		// Current synctoken
1958
-		$qb = $this->db->getQueryBuilder();
1959
-		$qb->select('synctoken')
1960
-			->from('calendars')
1961
-			->where(
1962
-				$qb->expr()->eq('id', $qb->createNamedParameter($calendarId))
1963
-			);
1964
-		$stmt = $qb->executeQuery();
1965
-		$currentToken = $stmt->fetchOne();
1966
-
1967
-		if ($currentToken === false) {
1968
-			return null;
1969
-		}
1970
-
1971
-		$result = [
1972
-			'syncToken' => $currentToken,
1973
-			'added' => [],
1974
-			'modified' => [],
1975
-			'deleted' => [],
1976
-		];
1977
-
1978
-		if ($syncToken) {
1979
-			$qb = $this->db->getQueryBuilder();
1980
-
1981
-			$qb->select('uri', 'operation')
1982
-				->from('calendarchanges')
1983
-				->where(
1984
-					$qb->expr()->andX(
1985
-						$qb->expr()->gte('synctoken', $qb->createNamedParameter($syncToken)),
1986
-						$qb->expr()->lt('synctoken', $qb->createNamedParameter($currentToken)),
1987
-						$qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)),
1988
-						$qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))
1989
-					)
1990
-				)->orderBy('synctoken');
1991
-			if (is_int($limit) && $limit > 0) {
1992
-				$qb->setMaxResults($limit);
1993
-			}
1994
-
1995
-			// Fetching all changes
1996
-			$stmt = $qb->executeQuery();
1997
-			$changes = [];
1998
-
1999
-			// This loop ensures that any duplicates are overwritten, only the
2000
-			// last change on a node is relevant.
2001
-			while ($row = $stmt->fetch()) {
2002
-				$changes[$row['uri']] = $row['operation'];
2003
-			}
2004
-			$stmt->closeCursor();
2005
-
2006
-			foreach ($changes as $uri => $operation) {
2007
-				switch ($operation) {
2008
-					case 1:
2009
-						$result['added'][] = $uri;
2010
-						break;
2011
-					case 2:
2012
-						$result['modified'][] = $uri;
2013
-						break;
2014
-					case 3:
2015
-						$result['deleted'][] = $uri;
2016
-						break;
2017
-				}
2018
-			}
2019
-		} else {
2020
-			// No synctoken supplied, this is the initial sync.
2021
-			$qb = $this->db->getQueryBuilder();
2022
-			$qb->select('uri')
2023
-				->from('calendarobjects')
2024
-				->where(
2025
-					$qb->expr()->andX(
2026
-						$qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)),
2027
-						$qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))
2028
-					)
2029
-				);
2030
-			$stmt = $qb->executeQuery();
2031
-			$result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
2032
-			$stmt->closeCursor();
2033
-		}
2034
-		return $result;
2035
-	}
2036
-
2037
-	/**
2038
-	 * Returns a list of subscriptions for a principal.
2039
-	 *
2040
-	 * Every subscription is an array with the following keys:
2041
-	 *  * id, a unique id that will be used by other functions to modify the
2042
-	 *    subscription. This can be the same as the uri or a database key.
2043
-	 *  * uri. This is just the 'base uri' or 'filename' of the subscription.
2044
-	 *  * principaluri. The owner of the subscription. Almost always the same as
2045
-	 *    principalUri passed to this method.
2046
-	 *
2047
-	 * Furthermore, all the subscription info must be returned too:
2048
-	 *
2049
-	 * 1. {DAV:}displayname
2050
-	 * 2. {http://apple.com/ns/ical/}refreshrate
2051
-	 * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos
2052
-	 *    should not be stripped).
2053
-	 * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms
2054
-	 *    should not be stripped).
2055
-	 * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if
2056
-	 *    attachments should not be stripped).
2057
-	 * 6. {http://calendarserver.org/ns/}source (Must be a
2058
-	 *     Sabre\DAV\Property\Href).
2059
-	 * 7. {http://apple.com/ns/ical/}calendar-color
2060
-	 * 8. {http://apple.com/ns/ical/}calendar-order
2061
-	 * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
2062
-	 *    (should just be an instance of
2063
-	 *    Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of
2064
-	 *    default components).
2065
-	 *
2066
-	 * @param string $principalUri
2067
-	 * @return array
2068
-	 */
2069
-	public function getSubscriptionsForUser($principalUri) {
2070
-		$fields = array_values($this->subscriptionPropertyMap);
2071
-		$fields[] = 'id';
2072
-		$fields[] = 'uri';
2073
-		$fields[] = 'source';
2074
-		$fields[] = 'principaluri';
2075
-		$fields[] = 'lastmodified';
2076
-		$fields[] = 'synctoken';
2077
-
2078
-		$query = $this->db->getQueryBuilder();
2079
-		$query->select($fields)
2080
-			->from('calendarsubscriptions')
2081
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2082
-			->orderBy('calendarorder', 'asc');
2083
-		$stmt = $query->executeQuery();
2084
-
2085
-		$subscriptions = [];
2086
-		while ($row = $stmt->fetch()) {
2087
-			$subscription = [
2088
-				'id' => $row['id'],
2089
-				'uri' => $row['uri'],
2090
-				'principaluri' => $row['principaluri'],
2091
-				'source' => $row['source'],
2092
-				'lastmodified' => $row['lastmodified'],
2093
-
2094
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
2095
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
2096
-			];
2097
-
2098
-			foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
2099
-				if (!is_null($row[$dbName])) {
2100
-					$subscription[$xmlName] = $row[$dbName];
2101
-				}
2102
-			}
2103
-
2104
-			$subscriptions[] = $subscription;
2105
-		}
2106
-
2107
-		return $subscriptions;
2108
-	}
2109
-
2110
-	/**
2111
-	 * Creates a new subscription for a principal.
2112
-	 *
2113
-	 * If the creation was a success, an id must be returned that can be used to reference
2114
-	 * this subscription in other methods, such as updateSubscription.
2115
-	 *
2116
-	 * @param string $principalUri
2117
-	 * @param string $uri
2118
-	 * @param array $properties
2119
-	 * @return mixed
2120
-	 */
2121
-	public function createSubscription($principalUri, $uri, array $properties) {
2122
-		if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
2123
-			throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
2124
-		}
2125
-
2126
-		$values = [
2127
-			'principaluri' => $principalUri,
2128
-			'uri' => $uri,
2129
-			'source' => $properties['{http://calendarserver.org/ns/}source']->getHref(),
2130
-			'lastmodified' => time(),
2131
-		];
2132
-
2133
-		$propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
2134
-
2135
-		foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
2136
-			if (array_key_exists($xmlName, $properties)) {
2137
-				$values[$dbName] = $properties[$xmlName];
2138
-				if (in_array($dbName, $propertiesBoolean)) {
2139
-					$values[$dbName] = true;
2140
-				}
2141
-			}
2142
-		}
2143
-
2144
-		$valuesToInsert = [];
2145
-
2146
-		$query = $this->db->getQueryBuilder();
2147
-
2148
-		foreach (array_keys($values) as $name) {
2149
-			$valuesToInsert[$name] = $query->createNamedParameter($values[$name]);
2150
-		}
2151
-
2152
-		$query->insert('calendarsubscriptions')
2153
-			->values($valuesToInsert)
2154
-			->executeUpdate();
2155
-
2156
-		$subscriptionId = $query->getLastInsertId();
2157
-
2158
-		$subscriptionRow = $this->getSubscriptionById($subscriptionId);
2159
-		$this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent($subscriptionId, $subscriptionRow));
2160
-		$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent(
2161
-			'\OCA\DAV\CalDAV\CalDavBackend::createSubscription',
2162
-			[
2163
-				'subscriptionId' => $subscriptionId,
2164
-				'subscriptionData' => $subscriptionRow,
2165
-			]));
2166
-
2167
-		return $subscriptionId;
2168
-	}
2169
-
2170
-	/**
2171
-	 * Updates a subscription
2172
-	 *
2173
-	 * The list of mutations is stored in a Sabre\DAV\PropPatch object.
2174
-	 * To do the actual updates, you must tell this object which properties
2175
-	 * you're going to process with the handle() method.
2176
-	 *
2177
-	 * Calling the handle method is like telling the PropPatch object "I
2178
-	 * promise I can handle updating this property".
2179
-	 *
2180
-	 * Read the PropPatch documentation for more info and examples.
2181
-	 *
2182
-	 * @param mixed $subscriptionId
2183
-	 * @param PropPatch $propPatch
2184
-	 * @return void
2185
-	 */
2186
-	public function updateSubscription($subscriptionId, PropPatch $propPatch) {
2187
-		$supportedProperties = array_keys($this->subscriptionPropertyMap);
2188
-		$supportedProperties[] = '{http://calendarserver.org/ns/}source';
2189
-
2190
-		$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
2191
-			$newValues = [];
2192
-
2193
-			foreach ($mutations as $propertyName => $propertyValue) {
2194
-				if ($propertyName === '{http://calendarserver.org/ns/}source') {
2195
-					$newValues['source'] = $propertyValue->getHref();
2196
-				} else {
2197
-					$fieldName = $this->subscriptionPropertyMap[$propertyName];
2198
-					$newValues[$fieldName] = $propertyValue;
2199
-				}
2200
-			}
2201
-
2202
-			$query = $this->db->getQueryBuilder();
2203
-			$query->update('calendarsubscriptions')
2204
-				->set('lastmodified', $query->createNamedParameter(time()));
2205
-			foreach ($newValues as $fieldName => $value) {
2206
-				$query->set($fieldName, $query->createNamedParameter($value));
2207
-			}
2208
-			$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
2209
-				->executeUpdate();
2210
-
2211
-			$subscriptionRow = $this->getSubscriptionById($subscriptionId);
2212
-			$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations));
2213
-			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent(
2214
-				'\OCA\DAV\CalDAV\CalDavBackend::updateSubscription',
2215
-				[
2216
-					'subscriptionId' => $subscriptionId,
2217
-					'subscriptionData' => $subscriptionRow,
2218
-					'propertyMutations' => $mutations,
2219
-				]));
2220
-
2221
-			return true;
2222
-		});
2223
-	}
2224
-
2225
-	/**
2226
-	 * Deletes a subscription.
2227
-	 *
2228
-	 * @param mixed $subscriptionId
2229
-	 * @return void
2230
-	 */
2231
-	public function deleteSubscription($subscriptionId) {
2232
-		$subscriptionRow = $this->getSubscriptionById($subscriptionId);
2233
-
2234
-		$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', new GenericEvent(
2235
-			'\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription',
2236
-			[
2237
-				'subscriptionId' => $subscriptionId,
2238
-				'subscriptionData' => $this->getSubscriptionById($subscriptionId),
2239
-			]));
2240
-
2241
-		$query = $this->db->getQueryBuilder();
2242
-		$query->delete('calendarsubscriptions')
2243
-			->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
2244
-			->executeUpdate();
2245
-
2246
-		$query = $this->db->getQueryBuilder();
2247
-		$query->delete('calendarobjects')
2248
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2249
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2250
-			->executeUpdate();
2251
-
2252
-		$query->delete('calendarchanges')
2253
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2254
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2255
-			->executeUpdate();
2256
-
2257
-		$query->delete($this->dbObjectPropertiesTable)
2258
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2259
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2260
-			->executeUpdate();
2261
-
2262
-		if ($subscriptionRow) {
2263
-			$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, []));
2264
-		}
2265
-	}
2266
-
2267
-	/**
2268
-	 * Returns a single scheduling object for the inbox collection.
2269
-	 *
2270
-	 * The returned array should contain the following elements:
2271
-	 *   * uri - A unique basename for the object. This will be used to
2272
-	 *           construct a full uri.
2273
-	 *   * calendardata - The iCalendar object
2274
-	 *   * lastmodified - The last modification date. Can be an int for a unix
2275
-	 *                    timestamp, or a PHP DateTime object.
2276
-	 *   * etag - A unique token that must change if the object changed.
2277
-	 *   * size - The size of the object, in bytes.
2278
-	 *
2279
-	 * @param string $principalUri
2280
-	 * @param string $objectUri
2281
-	 * @return array
2282
-	 */
2283
-	public function getSchedulingObject($principalUri, $objectUri) {
2284
-		$query = $this->db->getQueryBuilder();
2285
-		$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
2286
-			->from('schedulingobjects')
2287
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2288
-			->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
2289
-			->executeQuery();
2290
-
2291
-		$row = $stmt->fetch();
2292
-
2293
-		if (!$row) {
2294
-			return null;
2295
-		}
2296
-
2297
-		return [
2298
-			'uri' => $row['uri'],
2299
-			'calendardata' => $row['calendardata'],
2300
-			'lastmodified' => $row['lastmodified'],
2301
-			'etag' => '"' . $row['etag'] . '"',
2302
-			'size' => (int)$row['size'],
2303
-		];
2304
-	}
2305
-
2306
-	/**
2307
-	 * Returns all scheduling objects for the inbox collection.
2308
-	 *
2309
-	 * These objects should be returned as an array. Every item in the array
2310
-	 * should follow the same structure as returned from getSchedulingObject.
2311
-	 *
2312
-	 * The main difference is that 'calendardata' is optional.
2313
-	 *
2314
-	 * @param string $principalUri
2315
-	 * @return array
2316
-	 */
2317
-	public function getSchedulingObjects($principalUri) {
2318
-		$query = $this->db->getQueryBuilder();
2319
-		$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
2320
-				->from('schedulingobjects')
2321
-				->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2322
-				->executeQuery();
2323
-
2324
-		$result = [];
2325
-		foreach ($stmt->fetchAll() as $row) {
2326
-			$result[] = [
2327
-				'calendardata' => $row['calendardata'],
2328
-				'uri' => $row['uri'],
2329
-				'lastmodified' => $row['lastmodified'],
2330
-				'etag' => '"' . $row['etag'] . '"',
2331
-				'size' => (int)$row['size'],
2332
-			];
2333
-		}
2334
-
2335
-		return $result;
2336
-	}
2337
-
2338
-	/**
2339
-	 * Deletes a scheduling object from the inbox collection.
2340
-	 *
2341
-	 * @param string $principalUri
2342
-	 * @param string $objectUri
2343
-	 * @return void
2344
-	 */
2345
-	public function deleteSchedulingObject($principalUri, $objectUri) {
2346
-		$query = $this->db->getQueryBuilder();
2347
-		$query->delete('schedulingobjects')
2348
-				->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2349
-				->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
2350
-				->executeUpdate();
2351
-	}
2352
-
2353
-	/**
2354
-	 * Creates a new scheduling object. This should land in a users' inbox.
2355
-	 *
2356
-	 * @param string $principalUri
2357
-	 * @param string $objectUri
2358
-	 * @param string $objectData
2359
-	 * @return void
2360
-	 */
2361
-	public function createSchedulingObject($principalUri, $objectUri, $objectData) {
2362
-		$query = $this->db->getQueryBuilder();
2363
-		$query->insert('schedulingobjects')
2364
-			->values([
2365
-				'principaluri' => $query->createNamedParameter($principalUri),
2366
-				'calendardata' => $query->createNamedParameter($objectData, IQueryBuilder::PARAM_LOB),
2367
-				'uri' => $query->createNamedParameter($objectUri),
2368
-				'lastmodified' => $query->createNamedParameter(time()),
2369
-				'etag' => $query->createNamedParameter(md5($objectData)),
2370
-				'size' => $query->createNamedParameter(strlen($objectData))
2371
-			])
2372
-			->executeUpdate();
2373
-	}
2374
-
2375
-	/**
2376
-	 * Adds a change record to the calendarchanges table.
2377
-	 *
2378
-	 * @param mixed $calendarId
2379
-	 * @param string $objectUri
2380
-	 * @param int $operation 1 = add, 2 = modify, 3 = delete.
2381
-	 * @param int $calendarType
2382
-	 * @return void
2383
-	 */
2384
-	protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2385
-		$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
2386
-
2387
-		$query = $this->db->getQueryBuilder();
2388
-		$query->select('synctoken')
2389
-			->from($table)
2390
-			->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
2391
-		$result = $query->executeQuery();
2392
-		$syncToken = (int)$result->fetchOne();
2393
-		$result->closeCursor();
2394
-
2395
-		$query = $this->db->getQueryBuilder();
2396
-		$query->insert('calendarchanges')
2397
-			->values([
2398
-				'uri' => $query->createNamedParameter($objectUri),
2399
-				'synctoken' => $query->createNamedParameter($syncToken),
2400
-				'calendarid' => $query->createNamedParameter($calendarId),
2401
-				'operation' => $query->createNamedParameter($operation),
2402
-				'calendartype' => $query->createNamedParameter($calendarType),
2403
-			])
2404
-			->executeUpdate();
2405
-
2406
-		$stmt = $this->db->prepare("UPDATE `*PREFIX*$table` SET `synctoken` = `synctoken` + 1 WHERE `id` = ?");
2407
-		$stmt->execute([
2408
-			$calendarId
2409
-		]);
2410
-	}
2411
-
2412
-	/**
2413
-	 * Parses some information from calendar objects, used for optimized
2414
-	 * calendar-queries.
2415
-	 *
2416
-	 * Returns an array with the following keys:
2417
-	 *   * etag - An md5 checksum of the object without the quotes.
2418
-	 *   * size - Size of the object in bytes
2419
-	 *   * componentType - VEVENT, VTODO or VJOURNAL
2420
-	 *   * firstOccurence
2421
-	 *   * lastOccurence
2422
-	 *   * uid - value of the UID property
2423
-	 *
2424
-	 * @param string $calendarData
2425
-	 * @return array
2426
-	 */
2427
-	public function getDenormalizedData($calendarData) {
2428
-		$vObject = Reader::read($calendarData);
2429
-		$vEvents = [];
2430
-		$componentType = null;
2431
-		$component = null;
2432
-		$firstOccurrence = null;
2433
-		$lastOccurrence = null;
2434
-		$uid = null;
2435
-		$classification = self::CLASSIFICATION_PUBLIC;
2436
-		$hasDTSTART = false;
2437
-		foreach ($vObject->getComponents() as $component) {
2438
-			if ($component->name !== 'VTIMEZONE') {
2439
-				// Finding all VEVENTs, and track them
2440
-				if ($component->name === 'VEVENT') {
2441
-					array_push($vEvents, $component);
2442
-					if ($component->DTSTART) {
2443
-						$hasDTSTART = true;
2444
-					}
2445
-				}
2446
-				// Track first component type and uid
2447
-				if ($uid === null) {
2448
-					$componentType = $component->name;
2449
-					$uid = (string)$component->UID;
2450
-				}
2451
-			}
2452
-		}
2453
-		if (!$componentType) {
2454
-			throw new \Sabre\DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');
2455
-		}
2456
-
2457
-		if ($hasDTSTART) {
2458
-			$component = $vEvents[0];
2459
-
2460
-			// Finding the last occurrence is a bit harder
2461
-			if (!isset($component->RRULE) && count($vEvents) === 1) {
2462
-				$firstOccurrence = $component->DTSTART->getDateTime()->getTimeStamp();
2463
-				if (isset($component->DTEND)) {
2464
-					$lastOccurrence = $component->DTEND->getDateTime()->getTimeStamp();
2465
-				} elseif (isset($component->DURATION)) {
2466
-					$endDate = clone $component->DTSTART->getDateTime();
2467
-					$endDate->add(DateTimeParser::parse($component->DURATION->getValue()));
2468
-					$lastOccurrence = $endDate->getTimeStamp();
2469
-				} elseif (!$component->DTSTART->hasTime()) {
2470
-					$endDate = clone $component->DTSTART->getDateTime();
2471
-					$endDate->modify('+1 day');
2472
-					$lastOccurrence = $endDate->getTimeStamp();
2473
-				} else {
2474
-					$lastOccurrence = $firstOccurrence;
2475
-				}
2476
-			} else {
2477
-				$it = new EventIterator($vEvents);
2478
-				$maxDate = new DateTime(self::MAX_DATE);
2479
-				$firstOccurrence = $it->getDtStart()->getTimestamp();
2480
-				if ($it->isInfinite()) {
2481
-					$lastOccurrence = $maxDate->getTimestamp();
2482
-				} else {
2483
-					$end = $it->getDtEnd();
2484
-					while ($it->valid() && $end < $maxDate) {
2485
-						$end = $it->getDtEnd();
2486
-						$it->next();
2487
-					}
2488
-					$lastOccurrence = $end->getTimestamp();
2489
-				}
2490
-			}
2491
-		}
2492
-
2493
-		if ($component->CLASS) {
2494
-			$classification = CalDavBackend::CLASSIFICATION_PRIVATE;
2495
-			switch ($component->CLASS->getValue()) {
2496
-				case 'PUBLIC':
2497
-					$classification = CalDavBackend::CLASSIFICATION_PUBLIC;
2498
-					break;
2499
-				case 'CONFIDENTIAL':
2500
-					$classification = CalDavBackend::CLASSIFICATION_CONFIDENTIAL;
2501
-					break;
2502
-			}
2503
-		}
2504
-		return [
2505
-			'etag' => md5($calendarData),
2506
-			'size' => strlen($calendarData),
2507
-			'componentType' => $componentType,
2508
-			'firstOccurence' => is_null($firstOccurrence) ? null : max(0, $firstOccurrence),
2509
-			'lastOccurence' => $lastOccurrence,
2510
-			'uid' => $uid,
2511
-			'classification' => $classification
2512
-		];
2513
-	}
2514
-
2515
-	/**
2516
-	 * @param $cardData
2517
-	 * @return bool|string
2518
-	 */
2519
-	private function readBlob($cardData) {
2520
-		if (is_resource($cardData)) {
2521
-			return stream_get_contents($cardData);
2522
-		}
2523
-
2524
-		return $cardData;
2525
-	}
2526
-
2527
-	/**
2528
-	 * @param IShareable $shareable
2529
-	 * @param array $add
2530
-	 * @param array $remove
2531
-	 */
2532
-	public function updateShares($shareable, $add, $remove) {
2533
-		$calendarId = $shareable->getResourceId();
2534
-		$calendarRow = $this->getCalendarById($calendarId);
2535
-		$oldShares = $this->getShares($calendarId);
2536
-
2537
-		$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateShares', new GenericEvent(
2538
-			'\OCA\DAV\CalDAV\CalDavBackend::updateShares',
2539
-			[
2540
-				'calendarId' => $calendarId,
2541
-				'calendarData' => $calendarRow,
2542
-				'shares' => $oldShares,
2543
-				'add' => $add,
2544
-				'remove' => $remove,
2545
-			]));
2546
-		$this->calendarSharingBackend->updateShares($shareable, $add, $remove);
2547
-
2548
-		$this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove));
2549
-	}
2550
-
2551
-	/**
2552
-	 * @param int $resourceId
2553
-	 * @param int $calendarType
2554
-	 * @return array
2555
-	 */
2556
-	public function getShares($resourceId, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2557
-		return $this->calendarSharingBackend->getShares($resourceId);
2558
-	}
2559
-
2560
-	/**
2561
-	 * @param boolean $value
2562
-	 * @param \OCA\DAV\CalDAV\Calendar $calendar
2563
-	 * @return string|null
2564
-	 */
2565
-	public function setPublishStatus($value, $calendar) {
2566
-		$calendarId = $calendar->getResourceId();
2567
-		$calendarData = $this->getCalendarById($calendarId);
2568
-		$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', new GenericEvent(
2569
-			'\OCA\DAV\CalDAV\CalDavBackend::updateShares',
2570
-			[
2571
-				'calendarId' => $calendarId,
2572
-				'calendarData' => $calendarData,
2573
-				'public' => $value,
2574
-			]));
2575
-
2576
-		$query = $this->db->getQueryBuilder();
2577
-		if ($value) {
2578
-			$publicUri = $this->random->generate(16, ISecureRandom::CHAR_HUMAN_READABLE);
2579
-			$query->insert('dav_shares')
2580
-				->values([
2581
-					'principaluri' => $query->createNamedParameter($calendar->getPrincipalURI()),
2582
-					'type' => $query->createNamedParameter('calendar'),
2583
-					'access' => $query->createNamedParameter(self::ACCESS_PUBLIC),
2584
-					'resourceid' => $query->createNamedParameter($calendar->getResourceId()),
2585
-					'publicuri' => $query->createNamedParameter($publicUri)
2586
-				]);
2587
-			$query->executeUpdate();
2588
-
2589
-			$this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri));
2590
-			return $publicUri;
2591
-		}
2592
-		$query->delete('dav_shares')
2593
-			->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
2594
-			->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)));
2595
-		$query->executeUpdate();
2596
-
2597
-		$this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData));
2598
-		return null;
2599
-	}
2600
-
2601
-	/**
2602
-	 * @param \OCA\DAV\CalDAV\Calendar $calendar
2603
-	 * @return mixed
2604
-	 */
2605
-	public function getPublishStatus($calendar) {
2606
-		$query = $this->db->getQueryBuilder();
2607
-		$result = $query->select('publicuri')
2608
-			->from('dav_shares')
2609
-			->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
2610
-			->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
2611
-			->executeQuery();
2612
-
2613
-		$row = $result->fetch();
2614
-		$result->closeCursor();
2615
-		return $row ? reset($row) : false;
2616
-	}
2617
-
2618
-	/**
2619
-	 * @param int $resourceId
2620
-	 * @param array $acl
2621
-	 * @return array
2622
-	 */
2623
-	public function applyShareAcl($resourceId, $acl) {
2624
-		return $this->calendarSharingBackend->applyShareAcl($resourceId, $acl);
2625
-	}
2626
-
2627
-
2628
-
2629
-	/**
2630
-	 * update properties table
2631
-	 *
2632
-	 * @param int $calendarId
2633
-	 * @param string $objectUri
2634
-	 * @param string $calendarData
2635
-	 * @param int $calendarType
2636
-	 */
2637
-	public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2638
-		$objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType);
2639
-
2640
-		try {
2641
-			$vCalendar = $this->readCalendarData($calendarData);
2642
-		} catch (\Exception $ex) {
2643
-			return;
2644
-		}
2645
-
2646
-		$this->purgeProperties($calendarId, $objectId);
2647
-
2648
-		$query = $this->db->getQueryBuilder();
2649
-		$query->insert($this->dbObjectPropertiesTable)
2650
-			->values(
2651
-				[
2652
-					'calendarid' => $query->createNamedParameter($calendarId),
2653
-					'calendartype' => $query->createNamedParameter($calendarType),
2654
-					'objectid' => $query->createNamedParameter($objectId),
2655
-					'name' => $query->createParameter('name'),
2656
-					'parameter' => $query->createParameter('parameter'),
2657
-					'value' => $query->createParameter('value'),
2658
-				]
2659
-			);
2660
-
2661
-		$indexComponents = ['VEVENT', 'VJOURNAL', 'VTODO'];
2662
-		foreach ($vCalendar->getComponents() as $component) {
2663
-			if (!in_array($component->name, $indexComponents)) {
2664
-				continue;
2665
-			}
2666
-
2667
-			foreach ($component->children() as $property) {
2668
-				if (in_array($property->name, self::$indexProperties)) {
2669
-					$value = $property->getValue();
2670
-					// is this a shitty db?
2671
-					if (!$this->db->supports4ByteText()) {
2672
-						$value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value);
2673
-					}
2674
-					$value = mb_strcut($value, 0, 254);
2675
-
2676
-					$query->setParameter('name', $property->name);
2677
-					$query->setParameter('parameter', null);
2678
-					$query->setParameter('value', $value);
2679
-					$query->executeUpdate();
2680
-				}
2681
-
2682
-				if (array_key_exists($property->name, self::$indexParameters)) {
2683
-					$parameters = $property->parameters();
2684
-					$indexedParametersForProperty = self::$indexParameters[$property->name];
2685
-
2686
-					foreach ($parameters as $key => $value) {
2687
-						if (in_array($key, $indexedParametersForProperty)) {
2688
-							// is this a shitty db?
2689
-							if ($this->db->supports4ByteText()) {
2690
-								$value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value);
2691
-							}
2692
-
2693
-							$query->setParameter('name', $property->name);
2694
-							$query->setParameter('parameter', mb_strcut($key, 0, 254));
2695
-							$query->setParameter('value', mb_strcut($value, 0, 254));
2696
-							$query->executeUpdate();
2697
-						}
2698
-					}
2699
-				}
2700
-			}
2701
-		}
2702
-	}
2703
-
2704
-	/**
2705
-	 * deletes all birthday calendars
2706
-	 */
2707
-	public function deleteAllBirthdayCalendars() {
2708
-		$query = $this->db->getQueryBuilder();
2709
-		$result = $query->select(['id'])->from('calendars')
2710
-			->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
2711
-			->executeQuery();
2712
-
2713
-		$ids = $result->fetchAll();
2714
-		foreach ($ids as $id) {
2715
-			$this->deleteCalendar($id['id']);
2716
-		}
2717
-	}
2718
-
2719
-	/**
2720
-	 * @param $subscriptionId
2721
-	 */
2722
-	public function purgeAllCachedEventsForSubscription($subscriptionId) {
2723
-		$query = $this->db->getQueryBuilder();
2724
-		$query->select('uri')
2725
-			->from('calendarobjects')
2726
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2727
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)));
2728
-		$stmt = $query->executeQuery();
2729
-
2730
-		$uris = [];
2731
-		foreach ($stmt->fetchAll() as $row) {
2732
-			$uris[] = $row['uri'];
2733
-		}
2734
-		$stmt->closeCursor();
2735
-
2736
-		$query = $this->db->getQueryBuilder();
2737
-		$query->delete('calendarobjects')
2738
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2739
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2740
-			->executeUpdate();
2741
-
2742
-		$query->delete('calendarchanges')
2743
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2744
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2745
-			->executeUpdate();
2746
-
2747
-		$query->delete($this->dbObjectPropertiesTable)
2748
-			->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2749
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2750
-			->executeUpdate();
2751
-
2752
-		foreach ($uris as $uri) {
2753
-			$this->addChange($subscriptionId, $uri, 3, self::CALENDAR_TYPE_SUBSCRIPTION);
2754
-		}
2755
-	}
2756
-
2757
-	/**
2758
-	 * Move a calendar from one user to another
2759
-	 *
2760
-	 * @param string $uriName
2761
-	 * @param string $uriOrigin
2762
-	 * @param string $uriDestination
2763
-	 * @param string $newUriName (optional) the new uriName
2764
-	 */
2765
-	public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName = null) {
2766
-		$query = $this->db->getQueryBuilder();
2767
-		$query->update('calendars')
2768
-			->set('principaluri', $query->createNamedParameter($uriDestination))
2769
-			->set('uri', $query->createNamedParameter($newUriName ?: $uriName))
2770
-			->where($query->expr()->eq('principaluri', $query->createNamedParameter($uriOrigin)))
2771
-			->andWhere($query->expr()->eq('uri', $query->createNamedParameter($uriName)))
2772
-			->executeUpdate();
2773
-	}
2774
-
2775
-	/**
2776
-	 * read VCalendar data into a VCalendar object
2777
-	 *
2778
-	 * @param string $objectData
2779
-	 * @return VCalendar
2780
-	 */
2781
-	protected function readCalendarData($objectData) {
2782
-		return Reader::read($objectData);
2783
-	}
2784
-
2785
-	/**
2786
-	 * delete all properties from a given calendar object
2787
-	 *
2788
-	 * @param int $calendarId
2789
-	 * @param int $objectId
2790
-	 */
2791
-	protected function purgeProperties($calendarId, $objectId) {
2792
-		$query = $this->db->getQueryBuilder();
2793
-		$query->delete($this->dbObjectPropertiesTable)
2794
-			->where($query->expr()->eq('objectid', $query->createNamedParameter($objectId)))
2795
-			->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)));
2796
-		$query->executeUpdate();
2797
-	}
2798
-
2799
-	/**
2800
-	 * get ID from a given calendar object
2801
-	 *
2802
-	 * @param int $calendarId
2803
-	 * @param string $uri
2804
-	 * @param int $calendarType
2805
-	 * @return int
2806
-	 */
2807
-	protected function getCalendarObjectId($calendarId, $uri, $calendarType):int {
2808
-		$query = $this->db->getQueryBuilder();
2809
-		$query->select('id')
2810
-			->from('calendarobjects')
2811
-			->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
2812
-			->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
2813
-			->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
2814
-
2815
-		$result = $query->executeQuery();
2816
-		$objectIds = $result->fetch();
2817
-		$result->closeCursor();
2818
-
2819
-		if (!isset($objectIds['id'])) {
2820
-			throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
2821
-		}
2822
-
2823
-		return (int)$objectIds['id'];
2824
-	}
2825
-
2826
-	/**
2827
-	 * return legacy endpoint principal name to new principal name
2828
-	 *
2829
-	 * @param $principalUri
2830
-	 * @param $toV2
2831
-	 * @return string
2832
-	 */
2833
-	private function convertPrincipal($principalUri, $toV2) {
2834
-		if ($this->principalBackend->getPrincipalPrefix() === 'principals') {
2835
-			[, $name] = Uri\split($principalUri);
2836
-			if ($toV2 === true) {
2837
-				return "principals/users/$name";
2838
-			}
2839
-			return "principals/$name";
2840
-		}
2841
-		return $principalUri;
2842
-	}
2843
-
2844
-	/**
2845
-	 * adds information about an owner to the calendar data
2846
-	 *
2847
-	 * @param $calendarInfo
2848
-	 */
2849
-	private function addOwnerPrincipal(&$calendarInfo) {
2850
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
2851
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
2852
-		if (isset($calendarInfo[$ownerPrincipalKey])) {
2853
-			$uri = $calendarInfo[$ownerPrincipalKey];
2854
-		} else {
2855
-			$uri = $calendarInfo['principaluri'];
2856
-		}
2857
-
2858
-		$principalInformation = $this->principalBackend->getPrincipalByPath($uri);
2859
-		if (isset($principalInformation['{DAV:}displayname'])) {
2860
-			$calendarInfo[$displaynameKey] = $principalInformation['{DAV:}displayname'];
2861
-		}
2862
-	}
99
+    public const CALENDAR_TYPE_CALENDAR = 0;
100
+    public const CALENDAR_TYPE_SUBSCRIPTION = 1;
101
+
102
+    public const PERSONAL_CALENDAR_URI = 'personal';
103
+    public const PERSONAL_CALENDAR_NAME = 'Personal';
104
+
105
+    public const RESOURCE_BOOKING_CALENDAR_URI = 'calendar';
106
+    public const RESOURCE_BOOKING_CALENDAR_NAME = 'Calendar';
107
+
108
+    /**
109
+     * We need to specify a max date, because we need to stop *somewhere*
110
+     *
111
+     * On 32 bit system the maximum for a signed integer is 2147483647, so
112
+     * MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results
113
+     * in 2038-01-19 to avoid problems when the date is converted
114
+     * to a unix timestamp.
115
+     */
116
+    public const MAX_DATE = '2038-01-01';
117
+
118
+    public const ACCESS_PUBLIC = 4;
119
+    public const CLASSIFICATION_PUBLIC = 0;
120
+    public const CLASSIFICATION_PRIVATE = 1;
121
+    public const CLASSIFICATION_CONFIDENTIAL = 2;
122
+
123
+    /**
124
+     * List of CalDAV properties, and how they map to database field names
125
+     * Add your own properties by simply adding on to this array.
126
+     *
127
+     * Note that only string-based properties are supported here.
128
+     *
129
+     * @var array
130
+     */
131
+    public $propertyMap = [
132
+        '{DAV:}displayname' => 'displayname',
133
+        '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description',
134
+        '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone',
135
+        '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
136
+        '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
137
+    ];
138
+
139
+    /**
140
+     * List of subscription properties, and how they map to database field names.
141
+     *
142
+     * @var array
143
+     */
144
+    public $subscriptionPropertyMap = [
145
+        '{DAV:}displayname' => 'displayname',
146
+        '{http://apple.com/ns/ical/}refreshrate' => 'refreshrate',
147
+        '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
148
+        '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
149
+        '{http://calendarserver.org/ns/}subscribed-strip-todos' => 'striptodos',
150
+        '{http://calendarserver.org/ns/}subscribed-strip-alarms' => 'stripalarms',
151
+        '{http://calendarserver.org/ns/}subscribed-strip-attachments' => 'stripattachments',
152
+    ];
153
+
154
+    /** @var array properties to index */
155
+    public static $indexProperties = ['CATEGORIES', 'COMMENT', 'DESCRIPTION',
156
+        'LOCATION', 'RESOURCES', 'STATUS', 'SUMMARY', 'ATTENDEE', 'CONTACT',
157
+        'ORGANIZER'];
158
+
159
+    /** @var array parameters to index */
160
+    public static $indexParameters = [
161
+        'ATTENDEE' => ['CN'],
162
+        'ORGANIZER' => ['CN'],
163
+    ];
164
+
165
+    /**
166
+     * @var string[] Map of uid => display name
167
+     */
168
+    protected $userDisplayNames;
169
+
170
+    /** @var IDBConnection */
171
+    private $db;
172
+
173
+    /** @var Backend */
174
+    private $calendarSharingBackend;
175
+
176
+    /** @var Principal */
177
+    private $principalBackend;
178
+
179
+    /** @var IUserManager */
180
+    private $userManager;
181
+
182
+    /** @var ISecureRandom */
183
+    private $random;
184
+
185
+    /** @var ILogger */
186
+    private $logger;
187
+
188
+    /** @var IEventDispatcher */
189
+    private $dispatcher;
190
+
191
+    /** @var EventDispatcherInterface */
192
+    private $legacyDispatcher;
193
+
194
+    /** @var bool */
195
+    private $legacyEndpoint;
196
+
197
+    /** @var string */
198
+    private $dbObjectPropertiesTable = 'calendarobjects_props';
199
+
200
+    /**
201
+     * CalDavBackend constructor.
202
+     *
203
+     * @param IDBConnection $db
204
+     * @param Principal $principalBackend
205
+     * @param IUserManager $userManager
206
+     * @param IGroupManager $groupManager
207
+     * @param ISecureRandom $random
208
+     * @param ILogger $logger
209
+     * @param IEventDispatcher $dispatcher
210
+     * @param EventDispatcherInterface $legacyDispatcher
211
+     * @param bool $legacyEndpoint
212
+     */
213
+    public function __construct(IDBConnection $db,
214
+                                Principal $principalBackend,
215
+                                IUserManager $userManager,
216
+                                IGroupManager $groupManager,
217
+                                ISecureRandom $random,
218
+                                ILogger $logger,
219
+                                IEventDispatcher $dispatcher,
220
+                                EventDispatcherInterface $legacyDispatcher,
221
+                                bool $legacyEndpoint = false) {
222
+        $this->db = $db;
223
+        $this->principalBackend = $principalBackend;
224
+        $this->userManager = $userManager;
225
+        $this->calendarSharingBackend = new Backend($this->db, $this->userManager, $groupManager, $principalBackend, 'calendar');
226
+        $this->random = $random;
227
+        $this->logger = $logger;
228
+        $this->dispatcher = $dispatcher;
229
+        $this->legacyDispatcher = $legacyDispatcher;
230
+        $this->legacyEndpoint = $legacyEndpoint;
231
+    }
232
+
233
+    /**
234
+     * Return the number of calendars for a principal
235
+     *
236
+     * By default this excludes the automatically generated birthday calendar
237
+     *
238
+     * @param $principalUri
239
+     * @param bool $excludeBirthday
240
+     * @return int
241
+     */
242
+    public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) {
243
+        $principalUri = $this->convertPrincipal($principalUri, true);
244
+        $query = $this->db->getQueryBuilder();
245
+        $query->select($query->func()->count('*'))
246
+            ->from('calendars');
247
+
248
+        if ($principalUri === '') {
249
+            $query->where($query->expr()->emptyString('principaluri'));
250
+        } else {
251
+            $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
252
+        }
253
+
254
+        if ($excludeBirthday) {
255
+            $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)));
256
+        }
257
+
258
+        $result = $query->executeQuery();
259
+        $column = (int)$result->fetchOne();
260
+        $result->closeCursor();
261
+        return $column;
262
+    }
263
+
264
+    /**
265
+     * Returns a list of calendars for a principal.
266
+     *
267
+     * Every project is an array with the following keys:
268
+     *  * id, a unique id that will be used by other functions to modify the
269
+     *    calendar. This can be the same as the uri or a database key.
270
+     *  * uri, which the basename of the uri with which the calendar is
271
+     *    accessed.
272
+     *  * principaluri. The owner of the calendar. Almost always the same as
273
+     *    principalUri passed to this method.
274
+     *
275
+     * Furthermore it can contain webdav properties in clark notation. A very
276
+     * common one is '{DAV:}displayname'.
277
+     *
278
+     * Many clients also require:
279
+     * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
280
+     * For this property, you can just return an instance of
281
+     * Sabre\CalDAV\Property\SupportedCalendarComponentSet.
282
+     *
283
+     * If you return {http://sabredav.org/ns}read-only and set the value to 1,
284
+     * ACL will automatically be put in read-only mode.
285
+     *
286
+     * @param string $principalUri
287
+     * @return array
288
+     */
289
+    public function getCalendarsForUser($principalUri) {
290
+        $principalUriOriginal = $principalUri;
291
+        $principalUri = $this->convertPrincipal($principalUri, true);
292
+        $fields = array_values($this->propertyMap);
293
+        $fields[] = 'id';
294
+        $fields[] = 'uri';
295
+        $fields[] = 'synctoken';
296
+        $fields[] = 'components';
297
+        $fields[] = 'principaluri';
298
+        $fields[] = 'transparent';
299
+
300
+        // Making fields a comma-delimited list
301
+        $query = $this->db->getQueryBuilder();
302
+        $query->select($fields)
303
+            ->from('calendars')
304
+            ->orderBy('calendarorder', 'ASC');
305
+
306
+        if ($principalUri === '') {
307
+            $query->where($query->expr()->emptyString('principaluri'));
308
+        } else {
309
+            $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
310
+        }
311
+
312
+        $result = $query->executeQuery();
313
+
314
+        $calendars = [];
315
+        while ($row = $result->fetch()) {
316
+            $row['principaluri'] = (string) $row['principaluri'];
317
+            $components = [];
318
+            if ($row['components']) {
319
+                $components = explode(',',$row['components']);
320
+            }
321
+
322
+            $calendar = [
323
+                'id' => $row['id'],
324
+                'uri' => $row['uri'],
325
+                'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
326
+                '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
327
+                '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
328
+                '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
329
+                '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
330
+                '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
331
+            ];
332
+
333
+            foreach ($this->propertyMap as $xmlName => $dbName) {
334
+                $calendar[$xmlName] = $row[$dbName];
335
+            }
336
+
337
+            $this->addOwnerPrincipal($calendar);
338
+
339
+            if (!isset($calendars[$calendar['id']])) {
340
+                $calendars[$calendar['id']] = $calendar;
341
+            }
342
+        }
343
+        $result->closeCursor();
344
+
345
+        // query for shared calendars
346
+        $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
347
+        $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal));
348
+
349
+        $principals[] = $principalUri;
350
+
351
+        $fields = array_values($this->propertyMap);
352
+        $fields[] = 'a.id';
353
+        $fields[] = 'a.uri';
354
+        $fields[] = 'a.synctoken';
355
+        $fields[] = 'a.components';
356
+        $fields[] = 'a.principaluri';
357
+        $fields[] = 'a.transparent';
358
+        $fields[] = 's.access';
359
+        $query = $this->db->getQueryBuilder();
360
+        $query->select($fields)
361
+            ->from('dav_shares', 's')
362
+            ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
363
+            ->where($query->expr()->in('s.principaluri', $query->createParameter('principaluri')))
364
+            ->andWhere($query->expr()->eq('s.type', $query->createParameter('type')))
365
+            ->setParameter('type', 'calendar')
366
+            ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY);
367
+
368
+        $result = $query->executeQuery();
369
+
370
+        $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
371
+        while ($row = $result->fetch()) {
372
+            $row['principaluri'] = (string) $row['principaluri'];
373
+            if ($row['principaluri'] === $principalUri) {
374
+                continue;
375
+            }
376
+
377
+            $readOnly = (int) $row['access'] === Backend::ACCESS_READ;
378
+            if (isset($calendars[$row['id']])) {
379
+                if ($readOnly) {
380
+                    // New share can not have more permissions then the old one.
381
+                    continue;
382
+                }
383
+                if (isset($calendars[$row['id']][$readOnlyPropertyName]) &&
384
+                    $calendars[$row['id']][$readOnlyPropertyName] === 0) {
385
+                    // Old share is already read-write, no more permissions can be gained
386
+                    continue;
387
+                }
388
+            }
389
+
390
+            [, $name] = Uri\split($row['principaluri']);
391
+            $uri = $row['uri'] . '_shared_by_' . $name;
392
+            $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
393
+            $components = [];
394
+            if ($row['components']) {
395
+                $components = explode(',',$row['components']);
396
+            }
397
+            $calendar = [
398
+                'id' => $row['id'],
399
+                'uri' => $uri,
400
+                'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
401
+                '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
402
+                '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
403
+                '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
404
+                '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
405
+                '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
406
+                $readOnlyPropertyName => $readOnly,
407
+            ];
408
+
409
+            foreach ($this->propertyMap as $xmlName => $dbName) {
410
+                $calendar[$xmlName] = $row[$dbName];
411
+            }
412
+
413
+            $this->addOwnerPrincipal($calendar);
414
+
415
+            $calendars[$calendar['id']] = $calendar;
416
+        }
417
+        $result->closeCursor();
418
+
419
+        return array_values($calendars);
420
+    }
421
+
422
+    /**
423
+     * @param $principalUri
424
+     * @return array
425
+     */
426
+    public function getUsersOwnCalendars($principalUri) {
427
+        $principalUri = $this->convertPrincipal($principalUri, true);
428
+        $fields = array_values($this->propertyMap);
429
+        $fields[] = 'id';
430
+        $fields[] = 'uri';
431
+        $fields[] = 'synctoken';
432
+        $fields[] = 'components';
433
+        $fields[] = 'principaluri';
434
+        $fields[] = 'transparent';
435
+        // Making fields a comma-delimited list
436
+        $query = $this->db->getQueryBuilder();
437
+        $query->select($fields)->from('calendars')
438
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
439
+            ->orderBy('calendarorder', 'ASC');
440
+        $stmt = $query->executeQuery();
441
+        $calendars = [];
442
+        while ($row = $stmt->fetch()) {
443
+            $row['principaluri'] = (string) $row['principaluri'];
444
+            $components = [];
445
+            if ($row['components']) {
446
+                $components = explode(',',$row['components']);
447
+            }
448
+            $calendar = [
449
+                'id' => $row['id'],
450
+                'uri' => $row['uri'],
451
+                'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
452
+                '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
453
+                '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
454
+                '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
455
+                '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
456
+            ];
457
+            foreach ($this->propertyMap as $xmlName => $dbName) {
458
+                $calendar[$xmlName] = $row[$dbName];
459
+            }
460
+
461
+            $this->addOwnerPrincipal($calendar);
462
+
463
+            if (!isset($calendars[$calendar['id']])) {
464
+                $calendars[$calendar['id']] = $calendar;
465
+            }
466
+        }
467
+        $stmt->closeCursor();
468
+        return array_values($calendars);
469
+    }
470
+
471
+
472
+    /**
473
+     * @param $uid
474
+     * @return string
475
+     */
476
+    private function getUserDisplayName($uid) {
477
+        if (!isset($this->userDisplayNames[$uid])) {
478
+            $user = $this->userManager->get($uid);
479
+
480
+            if ($user instanceof IUser) {
481
+                $this->userDisplayNames[$uid] = $user->getDisplayName();
482
+            } else {
483
+                $this->userDisplayNames[$uid] = $uid;
484
+            }
485
+        }
486
+
487
+        return $this->userDisplayNames[$uid];
488
+    }
489
+
490
+    /**
491
+     * @return array
492
+     */
493
+    public function getPublicCalendars() {
494
+        $fields = array_values($this->propertyMap);
495
+        $fields[] = 'a.id';
496
+        $fields[] = 'a.uri';
497
+        $fields[] = 'a.synctoken';
498
+        $fields[] = 'a.components';
499
+        $fields[] = 'a.principaluri';
500
+        $fields[] = 'a.transparent';
501
+        $fields[] = 's.access';
502
+        $fields[] = 's.publicuri';
503
+        $calendars = [];
504
+        $query = $this->db->getQueryBuilder();
505
+        $result = $query->select($fields)
506
+            ->from('dav_shares', 's')
507
+            ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
508
+            ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
509
+            ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
510
+            ->executeQuery();
511
+
512
+        while ($row = $result->fetch()) {
513
+            $row['principaluri'] = (string) $row['principaluri'];
514
+            [, $name] = Uri\split($row['principaluri']);
515
+            $row['displayname'] = $row['displayname'] . "($name)";
516
+            $components = [];
517
+            if ($row['components']) {
518
+                $components = explode(',',$row['components']);
519
+            }
520
+            $calendar = [
521
+                'id' => $row['id'],
522
+                'uri' => $row['publicuri'],
523
+                'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
524
+                '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
525
+                '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
526
+                '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
527
+                '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
528
+                '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
529
+                '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
530
+                '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
531
+            ];
532
+
533
+            foreach ($this->propertyMap as $xmlName => $dbName) {
534
+                $calendar[$xmlName] = $row[$dbName];
535
+            }
536
+
537
+            $this->addOwnerPrincipal($calendar);
538
+
539
+            if (!isset($calendars[$calendar['id']])) {
540
+                $calendars[$calendar['id']] = $calendar;
541
+            }
542
+        }
543
+        $result->closeCursor();
544
+
545
+        return array_values($calendars);
546
+    }
547
+
548
+    /**
549
+     * @param string $uri
550
+     * @return array
551
+     * @throws NotFound
552
+     */
553
+    public function getPublicCalendar($uri) {
554
+        $fields = array_values($this->propertyMap);
555
+        $fields[] = 'a.id';
556
+        $fields[] = 'a.uri';
557
+        $fields[] = 'a.synctoken';
558
+        $fields[] = 'a.components';
559
+        $fields[] = 'a.principaluri';
560
+        $fields[] = 'a.transparent';
561
+        $fields[] = 's.access';
562
+        $fields[] = 's.publicuri';
563
+        $query = $this->db->getQueryBuilder();
564
+        $result = $query->select($fields)
565
+            ->from('dav_shares', 's')
566
+            ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
567
+            ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
568
+            ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
569
+            ->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri)))
570
+            ->executeQuery();
571
+
572
+        $row = $result->fetch();
573
+
574
+        $result->closeCursor();
575
+
576
+        if ($row === false) {
577
+            throw new NotFound('Node with name \'' . $uri . '\' could not be found');
578
+        }
579
+
580
+        $row['principaluri'] = (string) $row['principaluri'];
581
+        [, $name] = Uri\split($row['principaluri']);
582
+        $row['displayname'] = $row['displayname'] . ' ' . "($name)";
583
+        $components = [];
584
+        if ($row['components']) {
585
+            $components = explode(',',$row['components']);
586
+        }
587
+        $calendar = [
588
+            'id' => $row['id'],
589
+            'uri' => $row['publicuri'],
590
+            'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
591
+            '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
592
+            '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
593
+            '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
594
+            '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
595
+            '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
596
+            '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
597
+            '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
598
+        ];
599
+
600
+        foreach ($this->propertyMap as $xmlName => $dbName) {
601
+            $calendar[$xmlName] = $row[$dbName];
602
+        }
603
+
604
+        $this->addOwnerPrincipal($calendar);
605
+
606
+        return $calendar;
607
+    }
608
+
609
+    /**
610
+     * @param string $principal
611
+     * @param string $uri
612
+     * @return array|null
613
+     */
614
+    public function getCalendarByUri($principal, $uri) {
615
+        $fields = array_values($this->propertyMap);
616
+        $fields[] = 'id';
617
+        $fields[] = 'uri';
618
+        $fields[] = 'synctoken';
619
+        $fields[] = 'components';
620
+        $fields[] = 'principaluri';
621
+        $fields[] = 'transparent';
622
+
623
+        // Making fields a comma-delimited list
624
+        $query = $this->db->getQueryBuilder();
625
+        $query->select($fields)->from('calendars')
626
+            ->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
627
+            ->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal)))
628
+            ->setMaxResults(1);
629
+        $stmt = $query->executeQuery();
630
+
631
+        $row = $stmt->fetch();
632
+        $stmt->closeCursor();
633
+        if ($row === false) {
634
+            return null;
635
+        }
636
+
637
+        $row['principaluri'] = (string) $row['principaluri'];
638
+        $components = [];
639
+        if ($row['components']) {
640
+            $components = explode(',',$row['components']);
641
+        }
642
+
643
+        $calendar = [
644
+            'id' => $row['id'],
645
+            'uri' => $row['uri'],
646
+            'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
647
+            '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
648
+            '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
649
+            '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
650
+            '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
651
+        ];
652
+
653
+        foreach ($this->propertyMap as $xmlName => $dbName) {
654
+            $calendar[$xmlName] = $row[$dbName];
655
+        }
656
+
657
+        $this->addOwnerPrincipal($calendar);
658
+
659
+        return $calendar;
660
+    }
661
+
662
+    /**
663
+     * @param $calendarId
664
+     * @return array|null
665
+     */
666
+    public function getCalendarById($calendarId) {
667
+        $fields = array_values($this->propertyMap);
668
+        $fields[] = 'id';
669
+        $fields[] = 'uri';
670
+        $fields[] = 'synctoken';
671
+        $fields[] = 'components';
672
+        $fields[] = 'principaluri';
673
+        $fields[] = 'transparent';
674
+
675
+        // Making fields a comma-delimited list
676
+        $query = $this->db->getQueryBuilder();
677
+        $query->select($fields)->from('calendars')
678
+            ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)))
679
+            ->setMaxResults(1);
680
+        $stmt = $query->executeQuery();
681
+
682
+        $row = $stmt->fetch();
683
+        $stmt->closeCursor();
684
+        if ($row === false) {
685
+            return null;
686
+        }
687
+
688
+        $row['principaluri'] = (string) $row['principaluri'];
689
+        $components = [];
690
+        if ($row['components']) {
691
+            $components = explode(',',$row['components']);
692
+        }
693
+
694
+        $calendar = [
695
+            'id' => $row['id'],
696
+            'uri' => $row['uri'],
697
+            'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
698
+            '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
699
+            '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
700
+            '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
701
+            '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
702
+        ];
703
+
704
+        foreach ($this->propertyMap as $xmlName => $dbName) {
705
+            $calendar[$xmlName] = $row[$dbName];
706
+        }
707
+
708
+        $this->addOwnerPrincipal($calendar);
709
+
710
+        return $calendar;
711
+    }
712
+
713
+    /**
714
+     * @param $subscriptionId
715
+     */
716
+    public function getSubscriptionById($subscriptionId) {
717
+        $fields = array_values($this->subscriptionPropertyMap);
718
+        $fields[] = 'id';
719
+        $fields[] = 'uri';
720
+        $fields[] = 'source';
721
+        $fields[] = 'synctoken';
722
+        $fields[] = 'principaluri';
723
+        $fields[] = 'lastmodified';
724
+
725
+        $query = $this->db->getQueryBuilder();
726
+        $query->select($fields)
727
+            ->from('calendarsubscriptions')
728
+            ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
729
+            ->orderBy('calendarorder', 'asc');
730
+        $stmt = $query->executeQuery();
731
+
732
+        $row = $stmt->fetch();
733
+        $stmt->closeCursor();
734
+        if ($row === false) {
735
+            return null;
736
+        }
737
+
738
+        $row['principaluri'] = (string) $row['principaluri'];
739
+        $subscription = [
740
+            'id' => $row['id'],
741
+            'uri' => $row['uri'],
742
+            'principaluri' => $row['principaluri'],
743
+            'source' => $row['source'],
744
+            'lastmodified' => $row['lastmodified'],
745
+            '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
746
+            '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
747
+        ];
748
+
749
+        foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
750
+            if (!is_null($row[$dbName])) {
751
+                $subscription[$xmlName] = $row[$dbName];
752
+            }
753
+        }
754
+
755
+        return $subscription;
756
+    }
757
+
758
+    /**
759
+     * Creates a new calendar for a principal.
760
+     *
761
+     * If the creation was a success, an id must be returned that can be used to reference
762
+     * this calendar in other methods, such as updateCalendar.
763
+     *
764
+     * @param string $principalUri
765
+     * @param string $calendarUri
766
+     * @param array $properties
767
+     * @return int
768
+     */
769
+    public function createCalendar($principalUri, $calendarUri, array $properties) {
770
+        $values = [
771
+            'principaluri' => $this->convertPrincipal($principalUri, true),
772
+            'uri' => $calendarUri,
773
+            'synctoken' => 1,
774
+            'transparent' => 0,
775
+            'components' => 'VEVENT,VTODO',
776
+            'displayname' => $calendarUri
777
+        ];
778
+
779
+        // Default value
780
+        $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
781
+        if (isset($properties[$sccs])) {
782
+            if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) {
783
+                throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
784
+            }
785
+            $values['components'] = implode(',',$properties[$sccs]->getValue());
786
+        } elseif (isset($properties['components'])) {
787
+            // Allow to provide components internally without having
788
+            // to create a SupportedCalendarComponentSet object
789
+            $values['components'] = $properties['components'];
790
+        }
791
+
792
+        $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
793
+        if (isset($properties[$transp])) {
794
+            $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
795
+        }
796
+
797
+        foreach ($this->propertyMap as $xmlName => $dbName) {
798
+            if (isset($properties[$xmlName])) {
799
+                $values[$dbName] = $properties[$xmlName];
800
+            }
801
+        }
802
+
803
+        $query = $this->db->getQueryBuilder();
804
+        $query->insert('calendars');
805
+        foreach ($values as $column => $value) {
806
+            $query->setValue($column, $query->createNamedParameter($value));
807
+        }
808
+        $query->executeUpdate();
809
+        $calendarId = $query->getLastInsertId();
810
+
811
+        $calendarData = $this->getCalendarById($calendarId);
812
+        $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData));
813
+        $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent(
814
+            '\OCA\DAV\CalDAV\CalDavBackend::createCalendar',
815
+            [
816
+                'calendarId' => $calendarId,
817
+                'calendarData' => $calendarData,
818
+            ]));
819
+
820
+        return $calendarId;
821
+    }
822
+
823
+    /**
824
+     * Updates properties for a calendar.
825
+     *
826
+     * The list of mutations is stored in a Sabre\DAV\PropPatch object.
827
+     * To do the actual updates, you must tell this object which properties
828
+     * you're going to process with the handle() method.
829
+     *
830
+     * Calling the handle method is like telling the PropPatch object "I
831
+     * promise I can handle updating this property".
832
+     *
833
+     * Read the PropPatch documentation for more info and examples.
834
+     *
835
+     * @param mixed $calendarId
836
+     * @param PropPatch $propPatch
837
+     * @return void
838
+     */
839
+    public function updateCalendar($calendarId, PropPatch $propPatch) {
840
+        $supportedProperties = array_keys($this->propertyMap);
841
+        $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
842
+
843
+        $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
844
+            $newValues = [];
845
+            foreach ($mutations as $propertyName => $propertyValue) {
846
+                switch ($propertyName) {
847
+                    case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp':
848
+                        $fieldName = 'transparent';
849
+                        $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent');
850
+                        break;
851
+                    default:
852
+                        $fieldName = $this->propertyMap[$propertyName];
853
+                        $newValues[$fieldName] = $propertyValue;
854
+                        break;
855
+                }
856
+            }
857
+            $query = $this->db->getQueryBuilder();
858
+            $query->update('calendars');
859
+            foreach ($newValues as $fieldName => $value) {
860
+                $query->set($fieldName, $query->createNamedParameter($value));
861
+            }
862
+            $query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
863
+            $query->executeUpdate();
864
+
865
+            $this->addChange($calendarId, "", 2);
866
+
867
+            $calendarData = $this->getCalendarById($calendarId);
868
+            $shares = $this->getShares($calendarId);
869
+            $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations));
870
+            $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent(
871
+                '\OCA\DAV\CalDAV\CalDavBackend::updateCalendar',
872
+                [
873
+                    'calendarId' => $calendarId,
874
+                    'calendarData' => $calendarData,
875
+                    'shares' => $shares,
876
+                    'propertyMutations' => $mutations,
877
+                ]));
878
+
879
+            return true;
880
+        });
881
+    }
882
+
883
+    /**
884
+     * Delete a calendar and all it's objects
885
+     *
886
+     * @param mixed $calendarId
887
+     * @return void
888
+     */
889
+    public function deleteCalendar($calendarId) {
890
+        $calendarData = $this->getCalendarById($calendarId);
891
+        $shares = $this->getShares($calendarId);
892
+
893
+        $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `calendartype` = ?');
894
+        $stmt->execute([$calendarId, self::CALENDAR_TYPE_CALENDAR]);
895
+
896
+        $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendars` WHERE `id` = ?');
897
+        $stmt->execute([$calendarId]);
898
+
899
+        $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarchanges` WHERE `calendarid` = ? AND `calendartype` = ?');
900
+        $stmt->execute([$calendarId, self::CALENDAR_TYPE_CALENDAR]);
901
+
902
+        $this->calendarSharingBackend->deleteAllShares($calendarId);
903
+
904
+        $query = $this->db->getQueryBuilder();
905
+        $query->delete($this->dbObjectPropertiesTable)
906
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
907
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)))
908
+            ->executeUpdate();
909
+
910
+        // Only dispatch if we actually deleted anything
911
+        if ($calendarData) {
912
+            $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares));
913
+        }
914
+    }
915
+
916
+    /**
917
+     * Delete all of an user's shares
918
+     *
919
+     * @param string $principaluri
920
+     * @return void
921
+     */
922
+    public function deleteAllSharesByUser($principaluri) {
923
+        $this->calendarSharingBackend->deleteAllSharesByUser($principaluri);
924
+    }
925
+
926
+    /**
927
+     * Returns all calendar objects within a calendar.
928
+     *
929
+     * Every item contains an array with the following keys:
930
+     *   * calendardata - The iCalendar-compatible calendar data
931
+     *   * uri - a unique key which will be used to construct the uri. This can
932
+     *     be any arbitrary string, but making sure it ends with '.ics' is a
933
+     *     good idea. This is only the basename, or filename, not the full
934
+     *     path.
935
+     *   * lastmodified - a timestamp of the last modification time
936
+     *   * etag - An arbitrary string, surrounded by double-quotes. (e.g.:
937
+     *   '"abcdef"')
938
+     *   * size - The size of the calendar objects, in bytes.
939
+     *   * component - optional, a string containing the type of object, such
940
+     *     as 'vevent' or 'vtodo'. If specified, this will be used to populate
941
+     *     the Content-Type header.
942
+     *
943
+     * Note that the etag is optional, but it's highly encouraged to return for
944
+     * speed reasons.
945
+     *
946
+     * The calendardata is also optional. If it's not returned
947
+     * 'getCalendarObject' will be called later, which *is* expected to return
948
+     * calendardata.
949
+     *
950
+     * If neither etag or size are specified, the calendardata will be
951
+     * used/fetched to determine these numbers. If both are specified the
952
+     * amount of times this is needed is reduced by a great degree.
953
+     *
954
+     * @param mixed $calendarId
955
+     * @param int $calendarType
956
+     * @return array
957
+     */
958
+    public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
959
+        $query = $this->db->getQueryBuilder();
960
+        $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification'])
961
+            ->from('calendarobjects')
962
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
963
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
964
+        $stmt = $query->executeQuery();
965
+
966
+        $result = [];
967
+        foreach ($stmt->fetchAll() as $row) {
968
+            $result[] = [
969
+                'id' => $row['id'],
970
+                'uri' => $row['uri'],
971
+                'lastmodified' => $row['lastmodified'],
972
+                'etag' => '"' . $row['etag'] . '"',
973
+                'calendarid' => $row['calendarid'],
974
+                'size' => (int)$row['size'],
975
+                'component' => strtolower($row['componenttype']),
976
+                'classification' => (int)$row['classification']
977
+            ];
978
+        }
979
+        $stmt->closeCursor();
980
+
981
+        return $result;
982
+    }
983
+
984
+    /**
985
+     * Returns information from a single calendar object, based on it's object
986
+     * uri.
987
+     *
988
+     * The object uri is only the basename, or filename and not a full path.
989
+     *
990
+     * The returned array must have the same keys as getCalendarObjects. The
991
+     * 'calendardata' object is required here though, while it's not required
992
+     * for getCalendarObjects.
993
+     *
994
+     * This method must return null if the object did not exist.
995
+     *
996
+     * @param mixed $calendarId
997
+     * @param string $objectUri
998
+     * @param int $calendarType
999
+     * @return array|null
1000
+     */
1001
+    public function getCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1002
+        $query = $this->db->getQueryBuilder();
1003
+        $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
1004
+            ->from('calendarobjects')
1005
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1006
+            ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
1007
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
1008
+        $stmt = $query->executeQuery();
1009
+        $row = $stmt->fetch();
1010
+        $stmt->closeCursor();
1011
+
1012
+        if (!$row) {
1013
+            return null;
1014
+        }
1015
+
1016
+        return [
1017
+            'id' => $row['id'],
1018
+            'uri' => $row['uri'],
1019
+            'lastmodified' => $row['lastmodified'],
1020
+            'etag' => '"' . $row['etag'] . '"',
1021
+            'calendarid' => $row['calendarid'],
1022
+            'size' => (int)$row['size'],
1023
+            'calendardata' => $this->readBlob($row['calendardata']),
1024
+            'component' => strtolower($row['componenttype']),
1025
+            'classification' => (int)$row['classification']
1026
+        ];
1027
+    }
1028
+
1029
+    /**
1030
+     * Returns a list of calendar objects.
1031
+     *
1032
+     * This method should work identical to getCalendarObject, but instead
1033
+     * return all the calendar objects in the list as an array.
1034
+     *
1035
+     * If the backend supports this, it may allow for some speed-ups.
1036
+     *
1037
+     * @param mixed $calendarId
1038
+     * @param string[] $uris
1039
+     * @param int $calendarType
1040
+     * @return array
1041
+     */
1042
+    public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1043
+        if (empty($uris)) {
1044
+            return [];
1045
+        }
1046
+
1047
+        $chunks = array_chunk($uris, 100);
1048
+        $objects = [];
1049
+
1050
+        $query = $this->db->getQueryBuilder();
1051
+        $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
1052
+            ->from('calendarobjects')
1053
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1054
+            ->andWhere($query->expr()->in('uri', $query->createParameter('uri')))
1055
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
1056
+
1057
+        foreach ($chunks as $uris) {
1058
+            $query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY);
1059
+            $result = $query->executeQuery();
1060
+
1061
+            while ($row = $result->fetch()) {
1062
+                $objects[] = [
1063
+                    'id' => $row['id'],
1064
+                    'uri' => $row['uri'],
1065
+                    'lastmodified' => $row['lastmodified'],
1066
+                    'etag' => '"' . $row['etag'] . '"',
1067
+                    'calendarid' => $row['calendarid'],
1068
+                    'size' => (int)$row['size'],
1069
+                    'calendardata' => $this->readBlob($row['calendardata']),
1070
+                    'component' => strtolower($row['componenttype']),
1071
+                    'classification' => (int)$row['classification']
1072
+                ];
1073
+            }
1074
+            $result->closeCursor();
1075
+        }
1076
+
1077
+        return $objects;
1078
+    }
1079
+
1080
+    /**
1081
+     * Creates a new calendar object.
1082
+     *
1083
+     * The object uri is only the basename, or filename and not a full path.
1084
+     *
1085
+     * It is possible return an etag from this function, which will be used in
1086
+     * the response to this PUT request. Note that the ETag must be surrounded
1087
+     * by double-quotes.
1088
+     *
1089
+     * However, you should only really return this ETag if you don't mangle the
1090
+     * calendar-data. If the result of a subsequent GET to this object is not
1091
+     * the exact same as this request body, you should omit the ETag.
1092
+     *
1093
+     * @param mixed $calendarId
1094
+     * @param string $objectUri
1095
+     * @param string $calendarData
1096
+     * @param int $calendarType
1097
+     * @return string
1098
+     */
1099
+    public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1100
+        $extraData = $this->getDenormalizedData($calendarData);
1101
+
1102
+        $q = $this->db->getQueryBuilder();
1103
+        $q->select($q->func()->count('*'))
1104
+            ->from('calendarobjects')
1105
+            ->where($q->expr()->eq('calendarid', $q->createNamedParameter($calendarId)))
1106
+            ->andWhere($q->expr()->eq('uid', $q->createNamedParameter($extraData['uid'])))
1107
+            ->andWhere($q->expr()->eq('calendartype', $q->createNamedParameter($calendarType)));
1108
+
1109
+        $result = $q->executeQuery();
1110
+        $count = (int) $result->fetchOne();
1111
+        $result->closeCursor();
1112
+
1113
+        if ($count !== 0) {
1114
+            throw new \Sabre\DAV\Exception\BadRequest('Calendar object with uid already exists in this calendar collection.');
1115
+        }
1116
+
1117
+        $query = $this->db->getQueryBuilder();
1118
+        $query->insert('calendarobjects')
1119
+            ->values([
1120
+                'calendarid' => $query->createNamedParameter($calendarId),
1121
+                'uri' => $query->createNamedParameter($objectUri),
1122
+                'calendardata' => $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB),
1123
+                'lastmodified' => $query->createNamedParameter(time()),
1124
+                'etag' => $query->createNamedParameter($extraData['etag']),
1125
+                'size' => $query->createNamedParameter($extraData['size']),
1126
+                'componenttype' => $query->createNamedParameter($extraData['componentType']),
1127
+                'firstoccurence' => $query->createNamedParameter($extraData['firstOccurence']),
1128
+                'lastoccurence' => $query->createNamedParameter($extraData['lastOccurence']),
1129
+                'classification' => $query->createNamedParameter($extraData['classification']),
1130
+                'uid' => $query->createNamedParameter($extraData['uid']),
1131
+                'calendartype' => $query->createNamedParameter($calendarType),
1132
+            ])
1133
+            ->executeUpdate();
1134
+
1135
+        $this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
1136
+        $this->addChange($calendarId, $objectUri, 1, $calendarType);
1137
+
1138
+        $objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1139
+        if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1140
+            $calendarRow = $this->getCalendarById($calendarId);
1141
+            $shares = $this->getShares($calendarId);
1142
+
1143
+            $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
1144
+            $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent(
1145
+                '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject',
1146
+                [
1147
+                    'calendarId' => $calendarId,
1148
+                    'calendarData' => $calendarRow,
1149
+                    'shares' => $shares,
1150
+                    'objectData' => $objectRow,
1151
+                ]
1152
+            ));
1153
+        } else {
1154
+            $subscriptionRow = $this->getSubscriptionById($calendarId);
1155
+
1156
+            $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow));
1157
+            $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent(
1158
+                '\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject',
1159
+                [
1160
+                    'subscriptionId' => $calendarId,
1161
+                    'calendarData' => $subscriptionRow,
1162
+                    'shares' => [],
1163
+                    'objectData' => $objectRow,
1164
+                ]
1165
+            ));
1166
+        }
1167
+
1168
+        return '"' . $extraData['etag'] . '"';
1169
+    }
1170
+
1171
+    /**
1172
+     * Updates an existing calendarobject, based on it's uri.
1173
+     *
1174
+     * The object uri is only the basename, or filename and not a full path.
1175
+     *
1176
+     * It is possible return an etag from this function, which will be used in
1177
+     * the response to this PUT request. Note that the ETag must be surrounded
1178
+     * by double-quotes.
1179
+     *
1180
+     * However, you should only really return this ETag if you don't mangle the
1181
+     * calendar-data. If the result of a subsequent GET to this object is not
1182
+     * the exact same as this request body, you should omit the ETag.
1183
+     *
1184
+     * @param mixed $calendarId
1185
+     * @param string $objectUri
1186
+     * @param string $calendarData
1187
+     * @param int $calendarType
1188
+     * @return string
1189
+     */
1190
+    public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1191
+        $extraData = $this->getDenormalizedData($calendarData);
1192
+        $query = $this->db->getQueryBuilder();
1193
+        $query->update('calendarobjects')
1194
+                ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB))
1195
+                ->set('lastmodified', $query->createNamedParameter(time()))
1196
+                ->set('etag', $query->createNamedParameter($extraData['etag']))
1197
+                ->set('size', $query->createNamedParameter($extraData['size']))
1198
+                ->set('componenttype', $query->createNamedParameter($extraData['componentType']))
1199
+                ->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence']))
1200
+                ->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence']))
1201
+                ->set('classification', $query->createNamedParameter($extraData['classification']))
1202
+                ->set('uid', $query->createNamedParameter($extraData['uid']))
1203
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1204
+            ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
1205
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
1206
+            ->executeUpdate();
1207
+
1208
+        $this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
1209
+        $this->addChange($calendarId, $objectUri, 2, $calendarType);
1210
+
1211
+        $objectRow = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1212
+        if (is_array($objectRow)) {
1213
+            if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1214
+                $calendarRow = $this->getCalendarById($calendarId);
1215
+                $shares = $this->getShares($calendarId);
1216
+
1217
+                $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
1218
+                $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent(
1219
+                    '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject',
1220
+                    [
1221
+                        'calendarId' => $calendarId,
1222
+                        'calendarData' => $calendarRow,
1223
+                        'shares' => $shares,
1224
+                        'objectData' => $objectRow,
1225
+                    ]
1226
+                ));
1227
+            } else {
1228
+                $subscriptionRow = $this->getSubscriptionById($calendarId);
1229
+
1230
+                $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow));
1231
+                $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent(
1232
+                    '\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject',
1233
+                    [
1234
+                        'subscriptionId' => $calendarId,
1235
+                        'calendarData' => $subscriptionRow,
1236
+                        'shares' => [],
1237
+                        'objectData' => $objectRow,
1238
+                    ]
1239
+                ));
1240
+            }
1241
+        }
1242
+
1243
+        return '"' . $extraData['etag'] . '"';
1244
+    }
1245
+
1246
+    /**
1247
+     * @param int $calendarObjectId
1248
+     * @param int $classification
1249
+     */
1250
+    public function setClassification($calendarObjectId, $classification) {
1251
+        if (!in_array($classification, [
1252
+            self::CLASSIFICATION_PUBLIC, self::CLASSIFICATION_PRIVATE, self::CLASSIFICATION_CONFIDENTIAL
1253
+        ])) {
1254
+            throw new \InvalidArgumentException();
1255
+        }
1256
+        $query = $this->db->getQueryBuilder();
1257
+        $query->update('calendarobjects')
1258
+            ->set('classification', $query->createNamedParameter($classification))
1259
+            ->where($query->expr()->eq('id', $query->createNamedParameter($calendarObjectId)))
1260
+            ->executeUpdate();
1261
+    }
1262
+
1263
+    /**
1264
+     * Deletes an existing calendar object.
1265
+     *
1266
+     * The object uri is only the basename, or filename and not a full path.
1267
+     *
1268
+     * @param mixed $calendarId
1269
+     * @param string $objectUri
1270
+     * @param int $calendarType
1271
+     * @return void
1272
+     */
1273
+    public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1274
+        $data = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
1275
+        if (is_array($data)) {
1276
+            if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
1277
+                $calendarRow = $this->getCalendarById($calendarId);
1278
+                $shares = $this->getShares($calendarId);
1279
+
1280
+                $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data));
1281
+                $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent(
1282
+                    '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject',
1283
+                    [
1284
+                        'calendarId' => $calendarId,
1285
+                        'calendarData' => $calendarRow,
1286
+                        'shares' => $shares,
1287
+                        'objectData' => $data,
1288
+                    ]
1289
+                ));
1290
+            } else {
1291
+                $subscriptionRow = $this->getSubscriptionById($calendarId);
1292
+
1293
+                $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data));
1294
+                $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent(
1295
+                    '\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject',
1296
+                    [
1297
+                        'subscriptionId' => $calendarId,
1298
+                        'calendarData' => $subscriptionRow,
1299
+                        'shares' => [],
1300
+                        'objectData' => $data,
1301
+                    ]
1302
+                ));
1303
+            }
1304
+        }
1305
+
1306
+        $stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `uri` = ? AND `calendartype` = ?');
1307
+        $stmt->execute([$calendarId, $objectUri, $calendarType]);
1308
+
1309
+        if (is_array($data)) {
1310
+            $this->purgeProperties($calendarId, $data['id'], $calendarType);
1311
+        }
1312
+
1313
+        $this->addChange($calendarId, $objectUri, 3, $calendarType);
1314
+    }
1315
+
1316
+    /**
1317
+     * Performs a calendar-query on the contents of this calendar.
1318
+     *
1319
+     * The calendar-query is defined in RFC4791 : CalDAV. Using the
1320
+     * calendar-query it is possible for a client to request a specific set of
1321
+     * object, based on contents of iCalendar properties, date-ranges and
1322
+     * iCalendar component types (VTODO, VEVENT).
1323
+     *
1324
+     * This method should just return a list of (relative) urls that match this
1325
+     * query.
1326
+     *
1327
+     * The list of filters are specified as an array. The exact array is
1328
+     * documented by Sabre\CalDAV\CalendarQueryParser.
1329
+     *
1330
+     * Note that it is extremely likely that getCalendarObject for every path
1331
+     * returned from this method will be called almost immediately after. You
1332
+     * may want to anticipate this to speed up these requests.
1333
+     *
1334
+     * This method provides a default implementation, which parses *all* the
1335
+     * iCalendar objects in the specified calendar.
1336
+     *
1337
+     * This default may well be good enough for personal use, and calendars
1338
+     * that aren't very large. But if you anticipate high usage, big calendars
1339
+     * or high loads, you are strongly advised to optimize certain paths.
1340
+     *
1341
+     * The best way to do so is override this method and to optimize
1342
+     * specifically for 'common filters'.
1343
+     *
1344
+     * Requests that are extremely common are:
1345
+     *   * requests for just VEVENTS
1346
+     *   * requests for just VTODO
1347
+     *   * requests with a time-range-filter on either VEVENT or VTODO.
1348
+     *
1349
+     * ..and combinations of these requests. It may not be worth it to try to
1350
+     * handle every possible situation and just rely on the (relatively
1351
+     * easy to use) CalendarQueryValidator to handle the rest.
1352
+     *
1353
+     * Note that especially time-range-filters may be difficult to parse. A
1354
+     * time-range filter specified on a VEVENT must for instance also handle
1355
+     * recurrence rules correctly.
1356
+     * A good example of how to interprete all these filters can also simply
1357
+     * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct
1358
+     * as possible, so it gives you a good idea on what type of stuff you need
1359
+     * to think of.
1360
+     *
1361
+     * @param mixed $calendarId
1362
+     * @param array $filters
1363
+     * @param int $calendarType
1364
+     * @return array
1365
+     */
1366
+    public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
1367
+        $componentType = null;
1368
+        $requirePostFilter = true;
1369
+        $timeRange = null;
1370
+
1371
+        // if no filters were specified, we don't need to filter after a query
1372
+        if (!$filters['prop-filters'] && !$filters['comp-filters']) {
1373
+            $requirePostFilter = false;
1374
+        }
1375
+
1376
+        // Figuring out if there's a component filter
1377
+        if (count($filters['comp-filters']) > 0 && !$filters['comp-filters'][0]['is-not-defined']) {
1378
+            $componentType = $filters['comp-filters'][0]['name'];
1379
+
1380
+            // Checking if we need post-filters
1381
+            if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['time-range'] && !$filters['comp-filters'][0]['prop-filters']) {
1382
+                $requirePostFilter = false;
1383
+            }
1384
+            // There was a time-range filter
1385
+            if ($componentType === 'VEVENT' && isset($filters['comp-filters'][0]['time-range']) && is_array($filters['comp-filters'][0]['time-range'])) {
1386
+                $timeRange = $filters['comp-filters'][0]['time-range'];
1387
+
1388
+                // If start time OR the end time is not specified, we can do a
1389
+                // 100% accurate mysql query.
1390
+                if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && (!$timeRange['start'] || !$timeRange['end'])) {
1391
+                    $requirePostFilter = false;
1392
+                }
1393
+            }
1394
+        }
1395
+        $columns = ['uri'];
1396
+        if ($requirePostFilter) {
1397
+            $columns = ['uri', 'calendardata'];
1398
+        }
1399
+        $query = $this->db->getQueryBuilder();
1400
+        $query->select($columns)
1401
+            ->from('calendarobjects')
1402
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
1403
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
1404
+
1405
+        if ($componentType) {
1406
+            $query->andWhere($query->expr()->eq('componenttype', $query->createNamedParameter($componentType)));
1407
+        }
1408
+
1409
+        if ($timeRange && $timeRange['start']) {
1410
+            $query->andWhere($query->expr()->gt('lastoccurence', $query->createNamedParameter($timeRange['start']->getTimeStamp())));
1411
+        }
1412
+        if ($timeRange && $timeRange['end']) {
1413
+            $query->andWhere($query->expr()->lt('firstoccurence', $query->createNamedParameter($timeRange['end']->getTimeStamp())));
1414
+        }
1415
+
1416
+        $stmt = $query->executeQuery();
1417
+
1418
+        $result = [];
1419
+        while ($row = $stmt->fetch()) {
1420
+            if ($requirePostFilter) {
1421
+                // validateFilterForObject will parse the calendar data
1422
+                // catch parsing errors
1423
+                try {
1424
+                    $matches = $this->validateFilterForObject($row, $filters);
1425
+                } catch (ParseException $ex) {
1426
+                    $this->logger->logException($ex, [
1427
+                        'app' => 'dav',
1428
+                        'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri']
1429
+                    ]);
1430
+                    continue;
1431
+                } catch (InvalidDataException $ex) {
1432
+                    $this->logger->logException($ex, [
1433
+                        'app' => 'dav',
1434
+                        'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri']
1435
+                    ]);
1436
+                    continue;
1437
+                }
1438
+
1439
+                if (!$matches) {
1440
+                    continue;
1441
+                }
1442
+            }
1443
+            $result[] = $row['uri'];
1444
+        }
1445
+
1446
+        return $result;
1447
+    }
1448
+
1449
+    /**
1450
+     * custom Nextcloud search extension for CalDAV
1451
+     *
1452
+     * TODO - this should optionally cover cached calendar objects as well
1453
+     *
1454
+     * @param string $principalUri
1455
+     * @param array $filters
1456
+     * @param integer|null $limit
1457
+     * @param integer|null $offset
1458
+     * @return array
1459
+     */
1460
+    public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) {
1461
+        $calendars = $this->getCalendarsForUser($principalUri);
1462
+        $ownCalendars = [];
1463
+        $sharedCalendars = [];
1464
+
1465
+        $uriMapper = [];
1466
+
1467
+        foreach ($calendars as $calendar) {
1468
+            if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) {
1469
+                $ownCalendars[] = $calendar['id'];
1470
+            } else {
1471
+                $sharedCalendars[] = $calendar['id'];
1472
+            }
1473
+            $uriMapper[$calendar['id']] = $calendar['uri'];
1474
+        }
1475
+        if (count($ownCalendars) === 0 && count($sharedCalendars) === 0) {
1476
+            return [];
1477
+        }
1478
+
1479
+        $query = $this->db->getQueryBuilder();
1480
+        // Calendar id expressions
1481
+        $calendarExpressions = [];
1482
+        foreach ($ownCalendars as $id) {
1483
+            $calendarExpressions[] = $query->expr()->andX(
1484
+                $query->expr()->eq('c.calendarid',
1485
+                    $query->createNamedParameter($id)),
1486
+                $query->expr()->eq('c.calendartype',
1487
+                        $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1488
+        }
1489
+        foreach ($sharedCalendars as $id) {
1490
+            $calendarExpressions[] = $query->expr()->andX(
1491
+                $query->expr()->eq('c.calendarid',
1492
+                    $query->createNamedParameter($id)),
1493
+                $query->expr()->eq('c.classification',
1494
+                    $query->createNamedParameter(self::CLASSIFICATION_PUBLIC)),
1495
+                $query->expr()->eq('c.calendartype',
1496
+                    $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1497
+        }
1498
+
1499
+        if (count($calendarExpressions) === 1) {
1500
+            $calExpr = $calendarExpressions[0];
1501
+        } else {
1502
+            $calExpr = call_user_func_array([$query->expr(), 'orX'], $calendarExpressions);
1503
+        }
1504
+
1505
+        // Component expressions
1506
+        $compExpressions = [];
1507
+        foreach ($filters['comps'] as $comp) {
1508
+            $compExpressions[] = $query->expr()
1509
+                ->eq('c.componenttype', $query->createNamedParameter($comp));
1510
+        }
1511
+
1512
+        if (count($compExpressions) === 1) {
1513
+            $compExpr = $compExpressions[0];
1514
+        } else {
1515
+            $compExpr = call_user_func_array([$query->expr(), 'orX'], $compExpressions);
1516
+        }
1517
+
1518
+        if (!isset($filters['props'])) {
1519
+            $filters['props'] = [];
1520
+        }
1521
+        if (!isset($filters['params'])) {
1522
+            $filters['params'] = [];
1523
+        }
1524
+
1525
+        $propParamExpressions = [];
1526
+        foreach ($filters['props'] as $prop) {
1527
+            $propParamExpressions[] = $query->expr()->andX(
1528
+                $query->expr()->eq('i.name', $query->createNamedParameter($prop)),
1529
+                $query->expr()->isNull('i.parameter')
1530
+            );
1531
+        }
1532
+        foreach ($filters['params'] as $param) {
1533
+            $propParamExpressions[] = $query->expr()->andX(
1534
+                $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])),
1535
+                $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter']))
1536
+            );
1537
+        }
1538
+
1539
+        if (count($propParamExpressions) === 1) {
1540
+            $propParamExpr = $propParamExpressions[0];
1541
+        } else {
1542
+            $propParamExpr = call_user_func_array([$query->expr(), 'orX'], $propParamExpressions);
1543
+        }
1544
+
1545
+        $query->select(['c.calendarid', 'c.uri'])
1546
+            ->from($this->dbObjectPropertiesTable, 'i')
1547
+            ->join('i', 'calendarobjects', 'c', $query->expr()->eq('i.objectid', 'c.id'))
1548
+            ->where($calExpr)
1549
+            ->andWhere($compExpr)
1550
+            ->andWhere($propParamExpr)
1551
+            ->andWhere($query->expr()->iLike('i.value',
1552
+                $query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%')));
1553
+
1554
+        if ($offset) {
1555
+            $query->setFirstResult($offset);
1556
+        }
1557
+        if ($limit) {
1558
+            $query->setMaxResults($limit);
1559
+        }
1560
+
1561
+        $stmt = $query->executeQuery();
1562
+
1563
+        $result = [];
1564
+        while ($row = $stmt->fetch()) {
1565
+            $path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
1566
+            if (!in_array($path, $result)) {
1567
+                $result[] = $path;
1568
+            }
1569
+        }
1570
+
1571
+        return $result;
1572
+    }
1573
+
1574
+    /**
1575
+     * used for Nextcloud's calendar API
1576
+     *
1577
+     * @param array $calendarInfo
1578
+     * @param string $pattern
1579
+     * @param array $searchProperties
1580
+     * @param array $options
1581
+     * @param integer|null $limit
1582
+     * @param integer|null $offset
1583
+     *
1584
+     * @return array
1585
+     */
1586
+    public function search(array $calendarInfo, $pattern, array $searchProperties,
1587
+                            array $options, $limit, $offset) {
1588
+        $outerQuery = $this->db->getQueryBuilder();
1589
+        $innerQuery = $this->db->getQueryBuilder();
1590
+
1591
+        $innerQuery->selectDistinct('op.objectid')
1592
+            ->from($this->dbObjectPropertiesTable, 'op')
1593
+            ->andWhere($innerQuery->expr()->eq('op.calendarid',
1594
+                $outerQuery->createNamedParameter($calendarInfo['id'])))
1595
+            ->andWhere($innerQuery->expr()->eq('op.calendartype',
1596
+                $outerQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1597
+
1598
+        // only return public items for shared calendars for now
1599
+        if ($calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) {
1600
+            $innerQuery->andWhere($innerQuery->expr()->eq('c.classification',
1601
+                $outerQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
1602
+        }
1603
+
1604
+        $or = $innerQuery->expr()->orX();
1605
+        foreach ($searchProperties as $searchProperty) {
1606
+            $or->add($innerQuery->expr()->eq('op.name',
1607
+                $outerQuery->createNamedParameter($searchProperty)));
1608
+        }
1609
+        $innerQuery->andWhere($or);
1610
+
1611
+        if ($pattern !== '') {
1612
+            $innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
1613
+                $outerQuery->createNamedParameter('%' .
1614
+                    $this->db->escapeLikeParameter($pattern) . '%')));
1615
+        }
1616
+
1617
+        $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
1618
+            ->from('calendarobjects', 'c');
1619
+
1620
+        if (isset($options['timerange'])) {
1621
+            if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTime) {
1622
+                $outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence',
1623
+                    $outerQuery->createNamedParameter($options['timerange']['start']->getTimeStamp())));
1624
+            }
1625
+            if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTime) {
1626
+                $outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence',
1627
+                    $outerQuery->createNamedParameter($options['timerange']['end']->getTimeStamp())));
1628
+            }
1629
+        }
1630
+
1631
+        if (isset($options['types'])) {
1632
+            $or = $outerQuery->expr()->orX();
1633
+            foreach ($options['types'] as $type) {
1634
+                $or->add($outerQuery->expr()->eq('componenttype',
1635
+                    $outerQuery->createNamedParameter($type)));
1636
+            }
1637
+            $outerQuery->andWhere($or);
1638
+        }
1639
+
1640
+        $outerQuery->andWhere($outerQuery->expr()->in('c.id',
1641
+            $outerQuery->createFunction($innerQuery->getSQL())));
1642
+
1643
+        if ($offset) {
1644
+            $outerQuery->setFirstResult($offset);
1645
+        }
1646
+        if ($limit) {
1647
+            $outerQuery->setMaxResults($limit);
1648
+        }
1649
+
1650
+        $result = $outerQuery->executeQuery();
1651
+        $calendarObjects = $result->fetchAll();
1652
+
1653
+        return array_map(function ($o) {
1654
+            $calendarData = Reader::read($o['calendardata']);
1655
+            $comps = $calendarData->getComponents();
1656
+            $objects = [];
1657
+            $timezones = [];
1658
+            foreach ($comps as $comp) {
1659
+                if ($comp instanceof VTimeZone) {
1660
+                    $timezones[] = $comp;
1661
+                } else {
1662
+                    $objects[] = $comp;
1663
+                }
1664
+            }
1665
+
1666
+            return [
1667
+                'id' => $o['id'],
1668
+                'type' => $o['componenttype'],
1669
+                'uid' => $o['uid'],
1670
+                'uri' => $o['uri'],
1671
+                'objects' => array_map(function ($c) {
1672
+                    return $this->transformSearchData($c);
1673
+                }, $objects),
1674
+                'timezones' => array_map(function ($c) {
1675
+                    return $this->transformSearchData($c);
1676
+                }, $timezones),
1677
+            ];
1678
+        }, $calendarObjects);
1679
+    }
1680
+
1681
+    /**
1682
+     * @param Component $comp
1683
+     * @return array
1684
+     */
1685
+    private function transformSearchData(Component $comp) {
1686
+        $data = [];
1687
+        /** @var Component[] $subComponents */
1688
+        $subComponents = $comp->getComponents();
1689
+        /** @var Property[] $properties */
1690
+        $properties = array_filter($comp->children(), function ($c) {
1691
+            return $c instanceof Property;
1692
+        });
1693
+        $validationRules = $comp->getValidationRules();
1694
+
1695
+        foreach ($subComponents as $subComponent) {
1696
+            $name = $subComponent->name;
1697
+            if (!isset($data[$name])) {
1698
+                $data[$name] = [];
1699
+            }
1700
+            $data[$name][] = $this->transformSearchData($subComponent);
1701
+        }
1702
+
1703
+        foreach ($properties as $property) {
1704
+            $name = $property->name;
1705
+            if (!isset($validationRules[$name])) {
1706
+                $validationRules[$name] = '*';
1707
+            }
1708
+
1709
+            $rule = $validationRules[$property->name];
1710
+            if ($rule === '+' || $rule === '*') { // multiple
1711
+                if (!isset($data[$name])) {
1712
+                    $data[$name] = [];
1713
+                }
1714
+
1715
+                $data[$name][] = $this->transformSearchProperty($property);
1716
+            } else { // once
1717
+                $data[$name] = $this->transformSearchProperty($property);
1718
+            }
1719
+        }
1720
+
1721
+        return $data;
1722
+    }
1723
+
1724
+    /**
1725
+     * @param Property $prop
1726
+     * @return array
1727
+     */
1728
+    private function transformSearchProperty(Property $prop) {
1729
+        // No need to check Date, as it extends DateTime
1730
+        if ($prop instanceof Property\ICalendar\DateTime) {
1731
+            $value = $prop->getDateTime();
1732
+        } else {
1733
+            $value = $prop->getValue();
1734
+        }
1735
+
1736
+        return [
1737
+            $value,
1738
+            $prop->parameters()
1739
+        ];
1740
+    }
1741
+
1742
+    /**
1743
+     * @param string $principalUri
1744
+     * @param string $pattern
1745
+     * @param array $componentTypes
1746
+     * @param array $searchProperties
1747
+     * @param array $searchParameters
1748
+     * @param array $options
1749
+     * @return array
1750
+     */
1751
+    public function searchPrincipalUri(string $principalUri,
1752
+                                        string $pattern,
1753
+                                        array $componentTypes,
1754
+                                        array $searchProperties,
1755
+                                        array $searchParameters,
1756
+                                        array $options = []): array {
1757
+        $escapePattern = !\array_key_exists('escape_like_param', $options) || $options['escape_like_param'] !== false;
1758
+
1759
+        $calendarObjectIdQuery = $this->db->getQueryBuilder();
1760
+        $calendarOr = $calendarObjectIdQuery->expr()->orX();
1761
+        $searchOr = $calendarObjectIdQuery->expr()->orX();
1762
+
1763
+        // Fetch calendars and subscription
1764
+        $calendars = $this->getCalendarsForUser($principalUri);
1765
+        $subscriptions = $this->getSubscriptionsForUser($principalUri);
1766
+        foreach ($calendars as $calendar) {
1767
+            $calendarAnd = $calendarObjectIdQuery->expr()->andX();
1768
+            $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])));
1769
+            $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1770
+
1771
+            // If it's shared, limit search to public events
1772
+            if (isset($calendar['{http://owncloud.org/ns}owner-principal'])
1773
+                && $calendar['principaluri'] !== $calendar['{http://owncloud.org/ns}owner-principal']) {
1774
+                $calendarAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
1775
+            }
1776
+
1777
+            $calendarOr->add($calendarAnd);
1778
+        }
1779
+        foreach ($subscriptions as $subscription) {
1780
+            $subscriptionAnd = $calendarObjectIdQuery->expr()->andX();
1781
+            $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])));
1782
+            $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)));
1783
+
1784
+            // If it's shared, limit search to public events
1785
+            if (isset($subscription['{http://owncloud.org/ns}owner-principal'])
1786
+                && $subscription['principaluri'] !== $subscription['{http://owncloud.org/ns}owner-principal']) {
1787
+                $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('co.classification', $calendarObjectIdQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
1788
+            }
1789
+
1790
+            $calendarOr->add($subscriptionAnd);
1791
+        }
1792
+
1793
+        foreach ($searchProperties as $property) {
1794
+            $propertyAnd = $calendarObjectIdQuery->expr()->andX();
1795
+            $propertyAnd->add($calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR)));
1796
+            $propertyAnd->add($calendarObjectIdQuery->expr()->isNull('cob.parameter'));
1797
+
1798
+            $searchOr->add($propertyAnd);
1799
+        }
1800
+        foreach ($searchParameters as $property => $parameter) {
1801
+            $parameterAnd = $calendarObjectIdQuery->expr()->andX();
1802
+            $parameterAnd->add($calendarObjectIdQuery->expr()->eq('cob.name', $calendarObjectIdQuery->createNamedParameter($property, IQueryBuilder::PARAM_STR)));
1803
+            $parameterAnd->add($calendarObjectIdQuery->expr()->eq('cob.parameter', $calendarObjectIdQuery->createNamedParameter($parameter, IQueryBuilder::PARAM_STR_ARRAY)));
1804
+
1805
+            $searchOr->add($parameterAnd);
1806
+        }
1807
+
1808
+        if ($calendarOr->count() === 0) {
1809
+            return [];
1810
+        }
1811
+        if ($searchOr->count() === 0) {
1812
+            return [];
1813
+        }
1814
+
1815
+        $calendarObjectIdQuery->selectDistinct('cob.objectid')
1816
+            ->from($this->dbObjectPropertiesTable, 'cob')
1817
+            ->leftJoin('cob', 'calendarobjects', 'co', $calendarObjectIdQuery->expr()->eq('co.id', 'cob.objectid'))
1818
+            ->andWhere($calendarObjectIdQuery->expr()->in('co.componenttype', $calendarObjectIdQuery->createNamedParameter($componentTypes, IQueryBuilder::PARAM_STR_ARRAY)))
1819
+            ->andWhere($calendarOr)
1820
+            ->andWhere($searchOr);
1821
+
1822
+        if ('' !== $pattern) {
1823
+            if (!$escapePattern) {
1824
+                $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern)));
1825
+            } else {
1826
+                $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
1827
+            }
1828
+        }
1829
+
1830
+        if (isset($options['limit'])) {
1831
+            $calendarObjectIdQuery->setMaxResults($options['limit']);
1832
+        }
1833
+        if (isset($options['offset'])) {
1834
+            $calendarObjectIdQuery->setFirstResult($options['offset']);
1835
+        }
1836
+
1837
+        $result = $calendarObjectIdQuery->executeQuery();
1838
+        $matches = $result->fetchAll();
1839
+        $result->closeCursor();
1840
+        $matches = array_map(static function (array $match):int {
1841
+            return (int) $match['objectid'];
1842
+        }, $matches);
1843
+
1844
+        $query = $this->db->getQueryBuilder();
1845
+        $query->select('calendardata', 'uri', 'calendarid', 'calendartype')
1846
+            ->from('calendarobjects')
1847
+            ->where($query->expr()->in('id', $query->createNamedParameter($matches, IQueryBuilder::PARAM_INT_ARRAY)));
1848
+
1849
+        $result = $query->executeQuery();
1850
+        $calendarObjects = $result->fetchAll();
1851
+        $result->closeCursor();
1852
+
1853
+        return array_map(function (array $array): array {
1854
+            $array['calendarid'] = (int)$array['calendarid'];
1855
+            $array['calendartype'] = (int)$array['calendartype'];
1856
+            $array['calendardata'] = $this->readBlob($array['calendardata']);
1857
+
1858
+            return $array;
1859
+        }, $calendarObjects);
1860
+    }
1861
+
1862
+    /**
1863
+     * Searches through all of a users calendars and calendar objects to find
1864
+     * an object with a specific UID.
1865
+     *
1866
+     * This method should return the path to this object, relative to the
1867
+     * calendar home, so this path usually only contains two parts:
1868
+     *
1869
+     * calendarpath/objectpath.ics
1870
+     *
1871
+     * If the uid is not found, return null.
1872
+     *
1873
+     * This method should only consider * objects that the principal owns, so
1874
+     * any calendars owned by other principals that also appear in this
1875
+     * collection should be ignored.
1876
+     *
1877
+     * @param string $principalUri
1878
+     * @param string $uid
1879
+     * @return string|null
1880
+     */
1881
+    public function getCalendarObjectByUID($principalUri, $uid) {
1882
+        $query = $this->db->getQueryBuilder();
1883
+        $query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi')
1884
+            ->from('calendarobjects', 'co')
1885
+            ->leftJoin('co', 'calendars', 'c', $query->expr()->eq('co.calendarid', 'c.id'))
1886
+            ->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri)))
1887
+            ->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid)));
1888
+
1889
+        $stmt = $query->executeQuery();
1890
+        $row = $stmt->fetch();
1891
+        $stmt->closeCursor();
1892
+        if ($row) {
1893
+            return $row['calendaruri'] . '/' . $row['objecturi'];
1894
+        }
1895
+
1896
+        return null;
1897
+    }
1898
+
1899
+    /**
1900
+     * The getChanges method returns all the changes that have happened, since
1901
+     * the specified syncToken in the specified calendar.
1902
+     *
1903
+     * This function should return an array, such as the following:
1904
+     *
1905
+     * [
1906
+     *   'syncToken' => 'The current synctoken',
1907
+     *   'added'   => [
1908
+     *      'new.txt',
1909
+     *   ],
1910
+     *   'modified'   => [
1911
+     *      'modified.txt',
1912
+     *   ],
1913
+     *   'deleted' => [
1914
+     *      'foo.php.bak',
1915
+     *      'old.txt'
1916
+     *   ]
1917
+     * );
1918
+     *
1919
+     * The returned syncToken property should reflect the *current* syncToken
1920
+     * of the calendar, as reported in the {http://sabredav.org/ns}sync-token
1921
+     * property This is * needed here too, to ensure the operation is atomic.
1922
+     *
1923
+     * If the $syncToken argument is specified as null, this is an initial
1924
+     * sync, and all members should be reported.
1925
+     *
1926
+     * The modified property is an array of nodenames that have changed since
1927
+     * the last token.
1928
+     *
1929
+     * The deleted property is an array with nodenames, that have been deleted
1930
+     * from collection.
1931
+     *
1932
+     * The $syncLevel argument is basically the 'depth' of the report. If it's
1933
+     * 1, you only have to report changes that happened only directly in
1934
+     * immediate descendants. If it's 2, it should also include changes from
1935
+     * the nodes below the child collections. (grandchildren)
1936
+     *
1937
+     * The $limit argument allows a client to specify how many results should
1938
+     * be returned at most. If the limit is not specified, it should be treated
1939
+     * as infinite.
1940
+     *
1941
+     * If the limit (infinite or not) is higher than you're willing to return,
1942
+     * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception.
1943
+     *
1944
+     * If the syncToken is expired (due to data cleanup) or unknown, you must
1945
+     * return null.
1946
+     *
1947
+     * The limit is 'suggestive'. You are free to ignore it.
1948
+     *
1949
+     * @param string $calendarId
1950
+     * @param string $syncToken
1951
+     * @param int $syncLevel
1952
+     * @param int|null $limit
1953
+     * @param int $calendarType
1954
+     * @return array
1955
+     */
1956
+    public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1957
+        // Current synctoken
1958
+        $qb = $this->db->getQueryBuilder();
1959
+        $qb->select('synctoken')
1960
+            ->from('calendars')
1961
+            ->where(
1962
+                $qb->expr()->eq('id', $qb->createNamedParameter($calendarId))
1963
+            );
1964
+        $stmt = $qb->executeQuery();
1965
+        $currentToken = $stmt->fetchOne();
1966
+
1967
+        if ($currentToken === false) {
1968
+            return null;
1969
+        }
1970
+
1971
+        $result = [
1972
+            'syncToken' => $currentToken,
1973
+            'added' => [],
1974
+            'modified' => [],
1975
+            'deleted' => [],
1976
+        ];
1977
+
1978
+        if ($syncToken) {
1979
+            $qb = $this->db->getQueryBuilder();
1980
+
1981
+            $qb->select('uri', 'operation')
1982
+                ->from('calendarchanges')
1983
+                ->where(
1984
+                    $qb->expr()->andX(
1985
+                        $qb->expr()->gte('synctoken', $qb->createNamedParameter($syncToken)),
1986
+                        $qb->expr()->lt('synctoken', $qb->createNamedParameter($currentToken)),
1987
+                        $qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)),
1988
+                        $qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))
1989
+                    )
1990
+                )->orderBy('synctoken');
1991
+            if (is_int($limit) && $limit > 0) {
1992
+                $qb->setMaxResults($limit);
1993
+            }
1994
+
1995
+            // Fetching all changes
1996
+            $stmt = $qb->executeQuery();
1997
+            $changes = [];
1998
+
1999
+            // This loop ensures that any duplicates are overwritten, only the
2000
+            // last change on a node is relevant.
2001
+            while ($row = $stmt->fetch()) {
2002
+                $changes[$row['uri']] = $row['operation'];
2003
+            }
2004
+            $stmt->closeCursor();
2005
+
2006
+            foreach ($changes as $uri => $operation) {
2007
+                switch ($operation) {
2008
+                    case 1:
2009
+                        $result['added'][] = $uri;
2010
+                        break;
2011
+                    case 2:
2012
+                        $result['modified'][] = $uri;
2013
+                        break;
2014
+                    case 3:
2015
+                        $result['deleted'][] = $uri;
2016
+                        break;
2017
+                }
2018
+            }
2019
+        } else {
2020
+            // No synctoken supplied, this is the initial sync.
2021
+            $qb = $this->db->getQueryBuilder();
2022
+            $qb->select('uri')
2023
+                ->from('calendarobjects')
2024
+                ->where(
2025
+                    $qb->expr()->andX(
2026
+                        $qb->expr()->eq('calendarid', $qb->createNamedParameter($calendarId)),
2027
+                        $qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))
2028
+                    )
2029
+                );
2030
+            $stmt = $qb->executeQuery();
2031
+            $result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
2032
+            $stmt->closeCursor();
2033
+        }
2034
+        return $result;
2035
+    }
2036
+
2037
+    /**
2038
+     * Returns a list of subscriptions for a principal.
2039
+     *
2040
+     * Every subscription is an array with the following keys:
2041
+     *  * id, a unique id that will be used by other functions to modify the
2042
+     *    subscription. This can be the same as the uri or a database key.
2043
+     *  * uri. This is just the 'base uri' or 'filename' of the subscription.
2044
+     *  * principaluri. The owner of the subscription. Almost always the same as
2045
+     *    principalUri passed to this method.
2046
+     *
2047
+     * Furthermore, all the subscription info must be returned too:
2048
+     *
2049
+     * 1. {DAV:}displayname
2050
+     * 2. {http://apple.com/ns/ical/}refreshrate
2051
+     * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos
2052
+     *    should not be stripped).
2053
+     * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms
2054
+     *    should not be stripped).
2055
+     * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if
2056
+     *    attachments should not be stripped).
2057
+     * 6. {http://calendarserver.org/ns/}source (Must be a
2058
+     *     Sabre\DAV\Property\Href).
2059
+     * 7. {http://apple.com/ns/ical/}calendar-color
2060
+     * 8. {http://apple.com/ns/ical/}calendar-order
2061
+     * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
2062
+     *    (should just be an instance of
2063
+     *    Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of
2064
+     *    default components).
2065
+     *
2066
+     * @param string $principalUri
2067
+     * @return array
2068
+     */
2069
+    public function getSubscriptionsForUser($principalUri) {
2070
+        $fields = array_values($this->subscriptionPropertyMap);
2071
+        $fields[] = 'id';
2072
+        $fields[] = 'uri';
2073
+        $fields[] = 'source';
2074
+        $fields[] = 'principaluri';
2075
+        $fields[] = 'lastmodified';
2076
+        $fields[] = 'synctoken';
2077
+
2078
+        $query = $this->db->getQueryBuilder();
2079
+        $query->select($fields)
2080
+            ->from('calendarsubscriptions')
2081
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2082
+            ->orderBy('calendarorder', 'asc');
2083
+        $stmt = $query->executeQuery();
2084
+
2085
+        $subscriptions = [];
2086
+        while ($row = $stmt->fetch()) {
2087
+            $subscription = [
2088
+                'id' => $row['id'],
2089
+                'uri' => $row['uri'],
2090
+                'principaluri' => $row['principaluri'],
2091
+                'source' => $row['source'],
2092
+                'lastmodified' => $row['lastmodified'],
2093
+
2094
+                '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
2095
+                '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
2096
+            ];
2097
+
2098
+            foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
2099
+                if (!is_null($row[$dbName])) {
2100
+                    $subscription[$xmlName] = $row[$dbName];
2101
+                }
2102
+            }
2103
+
2104
+            $subscriptions[] = $subscription;
2105
+        }
2106
+
2107
+        return $subscriptions;
2108
+    }
2109
+
2110
+    /**
2111
+     * Creates a new subscription for a principal.
2112
+     *
2113
+     * If the creation was a success, an id must be returned that can be used to reference
2114
+     * this subscription in other methods, such as updateSubscription.
2115
+     *
2116
+     * @param string $principalUri
2117
+     * @param string $uri
2118
+     * @param array $properties
2119
+     * @return mixed
2120
+     */
2121
+    public function createSubscription($principalUri, $uri, array $properties) {
2122
+        if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
2123
+            throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
2124
+        }
2125
+
2126
+        $values = [
2127
+            'principaluri' => $principalUri,
2128
+            'uri' => $uri,
2129
+            'source' => $properties['{http://calendarserver.org/ns/}source']->getHref(),
2130
+            'lastmodified' => time(),
2131
+        ];
2132
+
2133
+        $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
2134
+
2135
+        foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
2136
+            if (array_key_exists($xmlName, $properties)) {
2137
+                $values[$dbName] = $properties[$xmlName];
2138
+                if (in_array($dbName, $propertiesBoolean)) {
2139
+                    $values[$dbName] = true;
2140
+                }
2141
+            }
2142
+        }
2143
+
2144
+        $valuesToInsert = [];
2145
+
2146
+        $query = $this->db->getQueryBuilder();
2147
+
2148
+        foreach (array_keys($values) as $name) {
2149
+            $valuesToInsert[$name] = $query->createNamedParameter($values[$name]);
2150
+        }
2151
+
2152
+        $query->insert('calendarsubscriptions')
2153
+            ->values($valuesToInsert)
2154
+            ->executeUpdate();
2155
+
2156
+        $subscriptionId = $query->getLastInsertId();
2157
+
2158
+        $subscriptionRow = $this->getSubscriptionById($subscriptionId);
2159
+        $this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent($subscriptionId, $subscriptionRow));
2160
+        $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent(
2161
+            '\OCA\DAV\CalDAV\CalDavBackend::createSubscription',
2162
+            [
2163
+                'subscriptionId' => $subscriptionId,
2164
+                'subscriptionData' => $subscriptionRow,
2165
+            ]));
2166
+
2167
+        return $subscriptionId;
2168
+    }
2169
+
2170
+    /**
2171
+     * Updates a subscription
2172
+     *
2173
+     * The list of mutations is stored in a Sabre\DAV\PropPatch object.
2174
+     * To do the actual updates, you must tell this object which properties
2175
+     * you're going to process with the handle() method.
2176
+     *
2177
+     * Calling the handle method is like telling the PropPatch object "I
2178
+     * promise I can handle updating this property".
2179
+     *
2180
+     * Read the PropPatch documentation for more info and examples.
2181
+     *
2182
+     * @param mixed $subscriptionId
2183
+     * @param PropPatch $propPatch
2184
+     * @return void
2185
+     */
2186
+    public function updateSubscription($subscriptionId, PropPatch $propPatch) {
2187
+        $supportedProperties = array_keys($this->subscriptionPropertyMap);
2188
+        $supportedProperties[] = '{http://calendarserver.org/ns/}source';
2189
+
2190
+        $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
2191
+            $newValues = [];
2192
+
2193
+            foreach ($mutations as $propertyName => $propertyValue) {
2194
+                if ($propertyName === '{http://calendarserver.org/ns/}source') {
2195
+                    $newValues['source'] = $propertyValue->getHref();
2196
+                } else {
2197
+                    $fieldName = $this->subscriptionPropertyMap[$propertyName];
2198
+                    $newValues[$fieldName] = $propertyValue;
2199
+                }
2200
+            }
2201
+
2202
+            $query = $this->db->getQueryBuilder();
2203
+            $query->update('calendarsubscriptions')
2204
+                ->set('lastmodified', $query->createNamedParameter(time()));
2205
+            foreach ($newValues as $fieldName => $value) {
2206
+                $query->set($fieldName, $query->createNamedParameter($value));
2207
+            }
2208
+            $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
2209
+                ->executeUpdate();
2210
+
2211
+            $subscriptionRow = $this->getSubscriptionById($subscriptionId);
2212
+            $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations));
2213
+            $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent(
2214
+                '\OCA\DAV\CalDAV\CalDavBackend::updateSubscription',
2215
+                [
2216
+                    'subscriptionId' => $subscriptionId,
2217
+                    'subscriptionData' => $subscriptionRow,
2218
+                    'propertyMutations' => $mutations,
2219
+                ]));
2220
+
2221
+            return true;
2222
+        });
2223
+    }
2224
+
2225
+    /**
2226
+     * Deletes a subscription.
2227
+     *
2228
+     * @param mixed $subscriptionId
2229
+     * @return void
2230
+     */
2231
+    public function deleteSubscription($subscriptionId) {
2232
+        $subscriptionRow = $this->getSubscriptionById($subscriptionId);
2233
+
2234
+        $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', new GenericEvent(
2235
+            '\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription',
2236
+            [
2237
+                'subscriptionId' => $subscriptionId,
2238
+                'subscriptionData' => $this->getSubscriptionById($subscriptionId),
2239
+            ]));
2240
+
2241
+        $query = $this->db->getQueryBuilder();
2242
+        $query->delete('calendarsubscriptions')
2243
+            ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
2244
+            ->executeUpdate();
2245
+
2246
+        $query = $this->db->getQueryBuilder();
2247
+        $query->delete('calendarobjects')
2248
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2249
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2250
+            ->executeUpdate();
2251
+
2252
+        $query->delete('calendarchanges')
2253
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2254
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2255
+            ->executeUpdate();
2256
+
2257
+        $query->delete($this->dbObjectPropertiesTable)
2258
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2259
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2260
+            ->executeUpdate();
2261
+
2262
+        if ($subscriptionRow) {
2263
+            $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, []));
2264
+        }
2265
+    }
2266
+
2267
+    /**
2268
+     * Returns a single scheduling object for the inbox collection.
2269
+     *
2270
+     * The returned array should contain the following elements:
2271
+     *   * uri - A unique basename for the object. This will be used to
2272
+     *           construct a full uri.
2273
+     *   * calendardata - The iCalendar object
2274
+     *   * lastmodified - The last modification date. Can be an int for a unix
2275
+     *                    timestamp, or a PHP DateTime object.
2276
+     *   * etag - A unique token that must change if the object changed.
2277
+     *   * size - The size of the object, in bytes.
2278
+     *
2279
+     * @param string $principalUri
2280
+     * @param string $objectUri
2281
+     * @return array
2282
+     */
2283
+    public function getSchedulingObject($principalUri, $objectUri) {
2284
+        $query = $this->db->getQueryBuilder();
2285
+        $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
2286
+            ->from('schedulingobjects')
2287
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2288
+            ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
2289
+            ->executeQuery();
2290
+
2291
+        $row = $stmt->fetch();
2292
+
2293
+        if (!$row) {
2294
+            return null;
2295
+        }
2296
+
2297
+        return [
2298
+            'uri' => $row['uri'],
2299
+            'calendardata' => $row['calendardata'],
2300
+            'lastmodified' => $row['lastmodified'],
2301
+            'etag' => '"' . $row['etag'] . '"',
2302
+            'size' => (int)$row['size'],
2303
+        ];
2304
+    }
2305
+
2306
+    /**
2307
+     * Returns all scheduling objects for the inbox collection.
2308
+     *
2309
+     * These objects should be returned as an array. Every item in the array
2310
+     * should follow the same structure as returned from getSchedulingObject.
2311
+     *
2312
+     * The main difference is that 'calendardata' is optional.
2313
+     *
2314
+     * @param string $principalUri
2315
+     * @return array
2316
+     */
2317
+    public function getSchedulingObjects($principalUri) {
2318
+        $query = $this->db->getQueryBuilder();
2319
+        $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
2320
+                ->from('schedulingobjects')
2321
+                ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2322
+                ->executeQuery();
2323
+
2324
+        $result = [];
2325
+        foreach ($stmt->fetchAll() as $row) {
2326
+            $result[] = [
2327
+                'calendardata' => $row['calendardata'],
2328
+                'uri' => $row['uri'],
2329
+                'lastmodified' => $row['lastmodified'],
2330
+                'etag' => '"' . $row['etag'] . '"',
2331
+                'size' => (int)$row['size'],
2332
+            ];
2333
+        }
2334
+
2335
+        return $result;
2336
+    }
2337
+
2338
+    /**
2339
+     * Deletes a scheduling object from the inbox collection.
2340
+     *
2341
+     * @param string $principalUri
2342
+     * @param string $objectUri
2343
+     * @return void
2344
+     */
2345
+    public function deleteSchedulingObject($principalUri, $objectUri) {
2346
+        $query = $this->db->getQueryBuilder();
2347
+        $query->delete('schedulingobjects')
2348
+                ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
2349
+                ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
2350
+                ->executeUpdate();
2351
+    }
2352
+
2353
+    /**
2354
+     * Creates a new scheduling object. This should land in a users' inbox.
2355
+     *
2356
+     * @param string $principalUri
2357
+     * @param string $objectUri
2358
+     * @param string $objectData
2359
+     * @return void
2360
+     */
2361
+    public function createSchedulingObject($principalUri, $objectUri, $objectData) {
2362
+        $query = $this->db->getQueryBuilder();
2363
+        $query->insert('schedulingobjects')
2364
+            ->values([
2365
+                'principaluri' => $query->createNamedParameter($principalUri),
2366
+                'calendardata' => $query->createNamedParameter($objectData, IQueryBuilder::PARAM_LOB),
2367
+                'uri' => $query->createNamedParameter($objectUri),
2368
+                'lastmodified' => $query->createNamedParameter(time()),
2369
+                'etag' => $query->createNamedParameter(md5($objectData)),
2370
+                'size' => $query->createNamedParameter(strlen($objectData))
2371
+            ])
2372
+            ->executeUpdate();
2373
+    }
2374
+
2375
+    /**
2376
+     * Adds a change record to the calendarchanges table.
2377
+     *
2378
+     * @param mixed $calendarId
2379
+     * @param string $objectUri
2380
+     * @param int $operation 1 = add, 2 = modify, 3 = delete.
2381
+     * @param int $calendarType
2382
+     * @return void
2383
+     */
2384
+    protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2385
+        $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
2386
+
2387
+        $query = $this->db->getQueryBuilder();
2388
+        $query->select('synctoken')
2389
+            ->from($table)
2390
+            ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
2391
+        $result = $query->executeQuery();
2392
+        $syncToken = (int)$result->fetchOne();
2393
+        $result->closeCursor();
2394
+
2395
+        $query = $this->db->getQueryBuilder();
2396
+        $query->insert('calendarchanges')
2397
+            ->values([
2398
+                'uri' => $query->createNamedParameter($objectUri),
2399
+                'synctoken' => $query->createNamedParameter($syncToken),
2400
+                'calendarid' => $query->createNamedParameter($calendarId),
2401
+                'operation' => $query->createNamedParameter($operation),
2402
+                'calendartype' => $query->createNamedParameter($calendarType),
2403
+            ])
2404
+            ->executeUpdate();
2405
+
2406
+        $stmt = $this->db->prepare("UPDATE `*PREFIX*$table` SET `synctoken` = `synctoken` + 1 WHERE `id` = ?");
2407
+        $stmt->execute([
2408
+            $calendarId
2409
+        ]);
2410
+    }
2411
+
2412
+    /**
2413
+     * Parses some information from calendar objects, used for optimized
2414
+     * calendar-queries.
2415
+     *
2416
+     * Returns an array with the following keys:
2417
+     *   * etag - An md5 checksum of the object without the quotes.
2418
+     *   * size - Size of the object in bytes
2419
+     *   * componentType - VEVENT, VTODO or VJOURNAL
2420
+     *   * firstOccurence
2421
+     *   * lastOccurence
2422
+     *   * uid - value of the UID property
2423
+     *
2424
+     * @param string $calendarData
2425
+     * @return array
2426
+     */
2427
+    public function getDenormalizedData($calendarData) {
2428
+        $vObject = Reader::read($calendarData);
2429
+        $vEvents = [];
2430
+        $componentType = null;
2431
+        $component = null;
2432
+        $firstOccurrence = null;
2433
+        $lastOccurrence = null;
2434
+        $uid = null;
2435
+        $classification = self::CLASSIFICATION_PUBLIC;
2436
+        $hasDTSTART = false;
2437
+        foreach ($vObject->getComponents() as $component) {
2438
+            if ($component->name !== 'VTIMEZONE') {
2439
+                // Finding all VEVENTs, and track them
2440
+                if ($component->name === 'VEVENT') {
2441
+                    array_push($vEvents, $component);
2442
+                    if ($component->DTSTART) {
2443
+                        $hasDTSTART = true;
2444
+                    }
2445
+                }
2446
+                // Track first component type and uid
2447
+                if ($uid === null) {
2448
+                    $componentType = $component->name;
2449
+                    $uid = (string)$component->UID;
2450
+                }
2451
+            }
2452
+        }
2453
+        if (!$componentType) {
2454
+            throw new \Sabre\DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');
2455
+        }
2456
+
2457
+        if ($hasDTSTART) {
2458
+            $component = $vEvents[0];
2459
+
2460
+            // Finding the last occurrence is a bit harder
2461
+            if (!isset($component->RRULE) && count($vEvents) === 1) {
2462
+                $firstOccurrence = $component->DTSTART->getDateTime()->getTimeStamp();
2463
+                if (isset($component->DTEND)) {
2464
+                    $lastOccurrence = $component->DTEND->getDateTime()->getTimeStamp();
2465
+                } elseif (isset($component->DURATION)) {
2466
+                    $endDate = clone $component->DTSTART->getDateTime();
2467
+                    $endDate->add(DateTimeParser::parse($component->DURATION->getValue()));
2468
+                    $lastOccurrence = $endDate->getTimeStamp();
2469
+                } elseif (!$component->DTSTART->hasTime()) {
2470
+                    $endDate = clone $component->DTSTART->getDateTime();
2471
+                    $endDate->modify('+1 day');
2472
+                    $lastOccurrence = $endDate->getTimeStamp();
2473
+                } else {
2474
+                    $lastOccurrence = $firstOccurrence;
2475
+                }
2476
+            } else {
2477
+                $it = new EventIterator($vEvents);
2478
+                $maxDate = new DateTime(self::MAX_DATE);
2479
+                $firstOccurrence = $it->getDtStart()->getTimestamp();
2480
+                if ($it->isInfinite()) {
2481
+                    $lastOccurrence = $maxDate->getTimestamp();
2482
+                } else {
2483
+                    $end = $it->getDtEnd();
2484
+                    while ($it->valid() && $end < $maxDate) {
2485
+                        $end = $it->getDtEnd();
2486
+                        $it->next();
2487
+                    }
2488
+                    $lastOccurrence = $end->getTimestamp();
2489
+                }
2490
+            }
2491
+        }
2492
+
2493
+        if ($component->CLASS) {
2494
+            $classification = CalDavBackend::CLASSIFICATION_PRIVATE;
2495
+            switch ($component->CLASS->getValue()) {
2496
+                case 'PUBLIC':
2497
+                    $classification = CalDavBackend::CLASSIFICATION_PUBLIC;
2498
+                    break;
2499
+                case 'CONFIDENTIAL':
2500
+                    $classification = CalDavBackend::CLASSIFICATION_CONFIDENTIAL;
2501
+                    break;
2502
+            }
2503
+        }
2504
+        return [
2505
+            'etag' => md5($calendarData),
2506
+            'size' => strlen($calendarData),
2507
+            'componentType' => $componentType,
2508
+            'firstOccurence' => is_null($firstOccurrence) ? null : max(0, $firstOccurrence),
2509
+            'lastOccurence' => $lastOccurrence,
2510
+            'uid' => $uid,
2511
+            'classification' => $classification
2512
+        ];
2513
+    }
2514
+
2515
+    /**
2516
+     * @param $cardData
2517
+     * @return bool|string
2518
+     */
2519
+    private function readBlob($cardData) {
2520
+        if (is_resource($cardData)) {
2521
+            return stream_get_contents($cardData);
2522
+        }
2523
+
2524
+        return $cardData;
2525
+    }
2526
+
2527
+    /**
2528
+     * @param IShareable $shareable
2529
+     * @param array $add
2530
+     * @param array $remove
2531
+     */
2532
+    public function updateShares($shareable, $add, $remove) {
2533
+        $calendarId = $shareable->getResourceId();
2534
+        $calendarRow = $this->getCalendarById($calendarId);
2535
+        $oldShares = $this->getShares($calendarId);
2536
+
2537
+        $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateShares', new GenericEvent(
2538
+            '\OCA\DAV\CalDAV\CalDavBackend::updateShares',
2539
+            [
2540
+                'calendarId' => $calendarId,
2541
+                'calendarData' => $calendarRow,
2542
+                'shares' => $oldShares,
2543
+                'add' => $add,
2544
+                'remove' => $remove,
2545
+            ]));
2546
+        $this->calendarSharingBackend->updateShares($shareable, $add, $remove);
2547
+
2548
+        $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove));
2549
+    }
2550
+
2551
+    /**
2552
+     * @param int $resourceId
2553
+     * @param int $calendarType
2554
+     * @return array
2555
+     */
2556
+    public function getShares($resourceId, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2557
+        return $this->calendarSharingBackend->getShares($resourceId);
2558
+    }
2559
+
2560
+    /**
2561
+     * @param boolean $value
2562
+     * @param \OCA\DAV\CalDAV\Calendar $calendar
2563
+     * @return string|null
2564
+     */
2565
+    public function setPublishStatus($value, $calendar) {
2566
+        $calendarId = $calendar->getResourceId();
2567
+        $calendarData = $this->getCalendarById($calendarId);
2568
+        $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', new GenericEvent(
2569
+            '\OCA\DAV\CalDAV\CalDavBackend::updateShares',
2570
+            [
2571
+                'calendarId' => $calendarId,
2572
+                'calendarData' => $calendarData,
2573
+                'public' => $value,
2574
+            ]));
2575
+
2576
+        $query = $this->db->getQueryBuilder();
2577
+        if ($value) {
2578
+            $publicUri = $this->random->generate(16, ISecureRandom::CHAR_HUMAN_READABLE);
2579
+            $query->insert('dav_shares')
2580
+                ->values([
2581
+                    'principaluri' => $query->createNamedParameter($calendar->getPrincipalURI()),
2582
+                    'type' => $query->createNamedParameter('calendar'),
2583
+                    'access' => $query->createNamedParameter(self::ACCESS_PUBLIC),
2584
+                    'resourceid' => $query->createNamedParameter($calendar->getResourceId()),
2585
+                    'publicuri' => $query->createNamedParameter($publicUri)
2586
+                ]);
2587
+            $query->executeUpdate();
2588
+
2589
+            $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri));
2590
+            return $publicUri;
2591
+        }
2592
+        $query->delete('dav_shares')
2593
+            ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
2594
+            ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)));
2595
+        $query->executeUpdate();
2596
+
2597
+        $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData));
2598
+        return null;
2599
+    }
2600
+
2601
+    /**
2602
+     * @param \OCA\DAV\CalDAV\Calendar $calendar
2603
+     * @return mixed
2604
+     */
2605
+    public function getPublishStatus($calendar) {
2606
+        $query = $this->db->getQueryBuilder();
2607
+        $result = $query->select('publicuri')
2608
+            ->from('dav_shares')
2609
+            ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
2610
+            ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
2611
+            ->executeQuery();
2612
+
2613
+        $row = $result->fetch();
2614
+        $result->closeCursor();
2615
+        return $row ? reset($row) : false;
2616
+    }
2617
+
2618
+    /**
2619
+     * @param int $resourceId
2620
+     * @param array $acl
2621
+     * @return array
2622
+     */
2623
+    public function applyShareAcl($resourceId, $acl) {
2624
+        return $this->calendarSharingBackend->applyShareAcl($resourceId, $acl);
2625
+    }
2626
+
2627
+
2628
+
2629
+    /**
2630
+     * update properties table
2631
+     *
2632
+     * @param int $calendarId
2633
+     * @param string $objectUri
2634
+     * @param string $calendarData
2635
+     * @param int $calendarType
2636
+     */
2637
+    public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2638
+        $objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType);
2639
+
2640
+        try {
2641
+            $vCalendar = $this->readCalendarData($calendarData);
2642
+        } catch (\Exception $ex) {
2643
+            return;
2644
+        }
2645
+
2646
+        $this->purgeProperties($calendarId, $objectId);
2647
+
2648
+        $query = $this->db->getQueryBuilder();
2649
+        $query->insert($this->dbObjectPropertiesTable)
2650
+            ->values(
2651
+                [
2652
+                    'calendarid' => $query->createNamedParameter($calendarId),
2653
+                    'calendartype' => $query->createNamedParameter($calendarType),
2654
+                    'objectid' => $query->createNamedParameter($objectId),
2655
+                    'name' => $query->createParameter('name'),
2656
+                    'parameter' => $query->createParameter('parameter'),
2657
+                    'value' => $query->createParameter('value'),
2658
+                ]
2659
+            );
2660
+
2661
+        $indexComponents = ['VEVENT', 'VJOURNAL', 'VTODO'];
2662
+        foreach ($vCalendar->getComponents() as $component) {
2663
+            if (!in_array($component->name, $indexComponents)) {
2664
+                continue;
2665
+            }
2666
+
2667
+            foreach ($component->children() as $property) {
2668
+                if (in_array($property->name, self::$indexProperties)) {
2669
+                    $value = $property->getValue();
2670
+                    // is this a shitty db?
2671
+                    if (!$this->db->supports4ByteText()) {
2672
+                        $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value);
2673
+                    }
2674
+                    $value = mb_strcut($value, 0, 254);
2675
+
2676
+                    $query->setParameter('name', $property->name);
2677
+                    $query->setParameter('parameter', null);
2678
+                    $query->setParameter('value', $value);
2679
+                    $query->executeUpdate();
2680
+                }
2681
+
2682
+                if (array_key_exists($property->name, self::$indexParameters)) {
2683
+                    $parameters = $property->parameters();
2684
+                    $indexedParametersForProperty = self::$indexParameters[$property->name];
2685
+
2686
+                    foreach ($parameters as $key => $value) {
2687
+                        if (in_array($key, $indexedParametersForProperty)) {
2688
+                            // is this a shitty db?
2689
+                            if ($this->db->supports4ByteText()) {
2690
+                                $value = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value);
2691
+                            }
2692
+
2693
+                            $query->setParameter('name', $property->name);
2694
+                            $query->setParameter('parameter', mb_strcut($key, 0, 254));
2695
+                            $query->setParameter('value', mb_strcut($value, 0, 254));
2696
+                            $query->executeUpdate();
2697
+                        }
2698
+                    }
2699
+                }
2700
+            }
2701
+        }
2702
+    }
2703
+
2704
+    /**
2705
+     * deletes all birthday calendars
2706
+     */
2707
+    public function deleteAllBirthdayCalendars() {
2708
+        $query = $this->db->getQueryBuilder();
2709
+        $result = $query->select(['id'])->from('calendars')
2710
+            ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
2711
+            ->executeQuery();
2712
+
2713
+        $ids = $result->fetchAll();
2714
+        foreach ($ids as $id) {
2715
+            $this->deleteCalendar($id['id']);
2716
+        }
2717
+    }
2718
+
2719
+    /**
2720
+     * @param $subscriptionId
2721
+     */
2722
+    public function purgeAllCachedEventsForSubscription($subscriptionId) {
2723
+        $query = $this->db->getQueryBuilder();
2724
+        $query->select('uri')
2725
+            ->from('calendarobjects')
2726
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2727
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)));
2728
+        $stmt = $query->executeQuery();
2729
+
2730
+        $uris = [];
2731
+        foreach ($stmt->fetchAll() as $row) {
2732
+            $uris[] = $row['uri'];
2733
+        }
2734
+        $stmt->closeCursor();
2735
+
2736
+        $query = $this->db->getQueryBuilder();
2737
+        $query->delete('calendarobjects')
2738
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2739
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2740
+            ->executeUpdate();
2741
+
2742
+        $query->delete('calendarchanges')
2743
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2744
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2745
+            ->executeUpdate();
2746
+
2747
+        $query->delete($this->dbObjectPropertiesTable)
2748
+            ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
2749
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
2750
+            ->executeUpdate();
2751
+
2752
+        foreach ($uris as $uri) {
2753
+            $this->addChange($subscriptionId, $uri, 3, self::CALENDAR_TYPE_SUBSCRIPTION);
2754
+        }
2755
+    }
2756
+
2757
+    /**
2758
+     * Move a calendar from one user to another
2759
+     *
2760
+     * @param string $uriName
2761
+     * @param string $uriOrigin
2762
+     * @param string $uriDestination
2763
+     * @param string $newUriName (optional) the new uriName
2764
+     */
2765
+    public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName = null) {
2766
+        $query = $this->db->getQueryBuilder();
2767
+        $query->update('calendars')
2768
+            ->set('principaluri', $query->createNamedParameter($uriDestination))
2769
+            ->set('uri', $query->createNamedParameter($newUriName ?: $uriName))
2770
+            ->where($query->expr()->eq('principaluri', $query->createNamedParameter($uriOrigin)))
2771
+            ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($uriName)))
2772
+            ->executeUpdate();
2773
+    }
2774
+
2775
+    /**
2776
+     * read VCalendar data into a VCalendar object
2777
+     *
2778
+     * @param string $objectData
2779
+     * @return VCalendar
2780
+     */
2781
+    protected function readCalendarData($objectData) {
2782
+        return Reader::read($objectData);
2783
+    }
2784
+
2785
+    /**
2786
+     * delete all properties from a given calendar object
2787
+     *
2788
+     * @param int $calendarId
2789
+     * @param int $objectId
2790
+     */
2791
+    protected function purgeProperties($calendarId, $objectId) {
2792
+        $query = $this->db->getQueryBuilder();
2793
+        $query->delete($this->dbObjectPropertiesTable)
2794
+            ->where($query->expr()->eq('objectid', $query->createNamedParameter($objectId)))
2795
+            ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)));
2796
+        $query->executeUpdate();
2797
+    }
2798
+
2799
+    /**
2800
+     * get ID from a given calendar object
2801
+     *
2802
+     * @param int $calendarId
2803
+     * @param string $uri
2804
+     * @param int $calendarType
2805
+     * @return int
2806
+     */
2807
+    protected function getCalendarObjectId($calendarId, $uri, $calendarType):int {
2808
+        $query = $this->db->getQueryBuilder();
2809
+        $query->select('id')
2810
+            ->from('calendarobjects')
2811
+            ->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
2812
+            ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
2813
+            ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
2814
+
2815
+        $result = $query->executeQuery();
2816
+        $objectIds = $result->fetch();
2817
+        $result->closeCursor();
2818
+
2819
+        if (!isset($objectIds['id'])) {
2820
+            throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
2821
+        }
2822
+
2823
+        return (int)$objectIds['id'];
2824
+    }
2825
+
2826
+    /**
2827
+     * return legacy endpoint principal name to new principal name
2828
+     *
2829
+     * @param $principalUri
2830
+     * @param $toV2
2831
+     * @return string
2832
+     */
2833
+    private function convertPrincipal($principalUri, $toV2) {
2834
+        if ($this->principalBackend->getPrincipalPrefix() === 'principals') {
2835
+            [, $name] = Uri\split($principalUri);
2836
+            if ($toV2 === true) {
2837
+                return "principals/users/$name";
2838
+            }
2839
+            return "principals/$name";
2840
+        }
2841
+        return $principalUri;
2842
+    }
2843
+
2844
+    /**
2845
+     * adds information about an owner to the calendar data
2846
+     *
2847
+     * @param $calendarInfo
2848
+     */
2849
+    private function addOwnerPrincipal(&$calendarInfo) {
2850
+        $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
2851
+        $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
2852
+        if (isset($calendarInfo[$ownerPrincipalKey])) {
2853
+            $uri = $calendarInfo[$ownerPrincipalKey];
2854
+        } else {
2855
+            $uri = $calendarInfo['principaluri'];
2856
+        }
2857
+
2858
+        $principalInformation = $this->principalBackend->getPrincipalByPath($uri);
2859
+        if (isset($principalInformation['{DAV:}displayname'])) {
2860
+            $calendarInfo[$displaynameKey] = $principalInformation['{DAV:}displayname'];
2861
+        }
2862
+    }
2863 2863
 }
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		}
257 257
 
258 258
 		$result = $query->executeQuery();
259
-		$column = (int)$result->fetchOne();
259
+		$column = (int) $result->fetchOne();
260 260
 		$result->closeCursor();
261 261
 		return $column;
262 262
 	}
@@ -316,18 +316,18 @@  discard block
 block discarded – undo
316 316
 			$row['principaluri'] = (string) $row['principaluri'];
317 317
 			$components = [];
318 318
 			if ($row['components']) {
319
-				$components = explode(',',$row['components']);
319
+				$components = explode(',', $row['components']);
320 320
 			}
321 321
 
322 322
 			$calendar = [
323 323
 				'id' => $row['id'],
324 324
 				'uri' => $row['uri'],
325 325
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
326
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
327
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
328
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
329
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
330
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
326
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
327
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
328
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
329
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
330
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
331 331
 			];
332 332
 
333 333
 			foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 
368 368
 		$result = $query->executeQuery();
369 369
 
370
-		$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
370
+		$readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
371 371
 		while ($row = $result->fetch()) {
372 372
 			$row['principaluri'] = (string) $row['principaluri'];
373 373
 			if ($row['principaluri'] === $principalUri) {
@@ -388,21 +388,21 @@  discard block
 block discarded – undo
388 388
 			}
389 389
 
390 390
 			[, $name] = Uri\split($row['principaluri']);
391
-			$uri = $row['uri'] . '_shared_by_' . $name;
392
-			$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
391
+			$uri = $row['uri'].'_shared_by_'.$name;
392
+			$row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')';
393 393
 			$components = [];
394 394
 			if ($row['components']) {
395
-				$components = explode(',',$row['components']);
395
+				$components = explode(',', $row['components']);
396 396
 			}
397 397
 			$calendar = [
398 398
 				'id' => $row['id'],
399 399
 				'uri' => $uri,
400 400
 				'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
401
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
402
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
403
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
404
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
405
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
401
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
402
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
403
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
404
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
405
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
406 406
 				$readOnlyPropertyName => $readOnly,
407 407
 			];
408 408
 
@@ -443,16 +443,16 @@  discard block
 block discarded – undo
443 443
 			$row['principaluri'] = (string) $row['principaluri'];
444 444
 			$components = [];
445 445
 			if ($row['components']) {
446
-				$components = explode(',',$row['components']);
446
+				$components = explode(',', $row['components']);
447 447
 			}
448 448
 			$calendar = [
449 449
 				'id' => $row['id'],
450 450
 				'uri' => $row['uri'],
451 451
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
452
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
453
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
454
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
455
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
452
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
453
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
454
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
455
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
456 456
 			];
457 457
 			foreach ($this->propertyMap as $xmlName => $dbName) {
458 458
 				$calendar[$xmlName] = $row[$dbName];
@@ -512,22 +512,22 @@  discard block
 block discarded – undo
512 512
 		while ($row = $result->fetch()) {
513 513
 			$row['principaluri'] = (string) $row['principaluri'];
514 514
 			[, $name] = Uri\split($row['principaluri']);
515
-			$row['displayname'] = $row['displayname'] . "($name)";
515
+			$row['displayname'] = $row['displayname']."($name)";
516 516
 			$components = [];
517 517
 			if ($row['components']) {
518
-				$components = explode(',',$row['components']);
518
+				$components = explode(',', $row['components']);
519 519
 			}
520 520
 			$calendar = [
521 521
 				'id' => $row['id'],
522 522
 				'uri' => $row['publicuri'],
523 523
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
524
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
525
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
526
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
527
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
528
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
529
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
530
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
524
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
525
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
526
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
527
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
528
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
529
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
530
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
531 531
 			];
532 532
 
533 533
 			foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -574,27 +574,27 @@  discard block
 block discarded – undo
574 574
 		$result->closeCursor();
575 575
 
576 576
 		if ($row === false) {
577
-			throw new NotFound('Node with name \'' . $uri . '\' could not be found');
577
+			throw new NotFound('Node with name \''.$uri.'\' could not be found');
578 578
 		}
579 579
 
580 580
 		$row['principaluri'] = (string) $row['principaluri'];
581 581
 		[, $name] = Uri\split($row['principaluri']);
582
-		$row['displayname'] = $row['displayname'] . ' ' . "($name)";
582
+		$row['displayname'] = $row['displayname'].' '."($name)";
583 583
 		$components = [];
584 584
 		if ($row['components']) {
585
-			$components = explode(',',$row['components']);
585
+			$components = explode(',', $row['components']);
586 586
 		}
587 587
 		$calendar = [
588 588
 			'id' => $row['id'],
589 589
 			'uri' => $row['publicuri'],
590 590
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
591
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
592
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
593
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
594
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
595
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
596
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
597
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
591
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
592
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
593
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
594
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
595
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
596
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
597
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
598 598
 		];
599 599
 
600 600
 		foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -637,17 +637,17 @@  discard block
 block discarded – undo
637 637
 		$row['principaluri'] = (string) $row['principaluri'];
638 638
 		$components = [];
639 639
 		if ($row['components']) {
640
-			$components = explode(',',$row['components']);
640
+			$components = explode(',', $row['components']);
641 641
 		}
642 642
 
643 643
 		$calendar = [
644 644
 			'id' => $row['id'],
645 645
 			'uri' => $row['uri'],
646 646
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
647
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
648
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
649
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
650
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
647
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
648
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
649
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
650
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
651 651
 		];
652 652
 
653 653
 		foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -688,17 +688,17 @@  discard block
 block discarded – undo
688 688
 		$row['principaluri'] = (string) $row['principaluri'];
689 689
 		$components = [];
690 690
 		if ($row['components']) {
691
-			$components = explode(',',$row['components']);
691
+			$components = explode(',', $row['components']);
692 692
 		}
693 693
 
694 694
 		$calendar = [
695 695
 			'id' => $row['id'],
696 696
 			'uri' => $row['uri'],
697 697
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
698
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
699
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
700
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
701
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
698
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
699
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
700
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
701
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
702 702
 		];
703 703
 
704 704
 		foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
 			'principaluri' => $row['principaluri'],
743 743
 			'source' => $row['source'],
744 744
 			'lastmodified' => $row['lastmodified'],
745
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
746
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
745
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
746
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
747 747
 		];
748 748
 
749 749
 		foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
@@ -780,16 +780,16 @@  discard block
 block discarded – undo
780 780
 		$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
781 781
 		if (isset($properties[$sccs])) {
782 782
 			if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) {
783
-				throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
783
+				throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
784 784
 			}
785
-			$values['components'] = implode(',',$properties[$sccs]->getValue());
785
+			$values['components'] = implode(',', $properties[$sccs]->getValue());
786 786
 		} elseif (isset($properties['components'])) {
787 787
 			// Allow to provide components internally without having
788 788
 			// to create a SupportedCalendarComponentSet object
789 789
 			$values['components'] = $properties['components'];
790 790
 		}
791 791
 
792
-		$transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
792
+		$transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
793 793
 		if (isset($properties[$transp])) {
794 794
 			$values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
795 795
 		}
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 		$calendarId = $query->getLastInsertId();
810 810
 
811 811
 		$calendarData = $this->getCalendarById($calendarId);
812
-		$this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData));
812
+		$this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData));
813 813
 		$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent(
814 814
 			'\OCA\DAV\CalDAV\CalDavBackend::createCalendar',
815 815
 			[
@@ -838,13 +838,13 @@  discard block
 block discarded – undo
838 838
 	 */
839 839
 	public function updateCalendar($calendarId, PropPatch $propPatch) {
840 840
 		$supportedProperties = array_keys($this->propertyMap);
841
-		$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
841
+		$supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
842 842
 
843
-		$propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
843
+		$propPatch->handle($supportedProperties, function($mutations) use ($calendarId) {
844 844
 			$newValues = [];
845 845
 			foreach ($mutations as $propertyName => $propertyValue) {
846 846
 				switch ($propertyName) {
847
-					case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp':
847
+					case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp':
848 848
 						$fieldName = 'transparent';
849 849
 						$newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent');
850 850
 						break;
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 
867 867
 			$calendarData = $this->getCalendarById($calendarId);
868 868
 			$shares = $this->getShares($calendarId);
869
-			$this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations));
869
+			$this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int) $calendarId, $calendarData, $shares, $mutations));
870 870
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent(
871 871
 				'\OCA\DAV\CalDAV\CalDavBackend::updateCalendar',
872 872
 				[
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 
910 910
 		// Only dispatch if we actually deleted anything
911 911
 		if ($calendarData) {
912
-			$this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares));
912
+			$this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int) $calendarId, $calendarData, $shares));
913 913
 		}
914 914
 	}
915 915
 
@@ -969,11 +969,11 @@  discard block
 block discarded – undo
969 969
 				'id' => $row['id'],
970 970
 				'uri' => $row['uri'],
971 971
 				'lastmodified' => $row['lastmodified'],
972
-				'etag' => '"' . $row['etag'] . '"',
972
+				'etag' => '"'.$row['etag'].'"',
973 973
 				'calendarid' => $row['calendarid'],
974
-				'size' => (int)$row['size'],
974
+				'size' => (int) $row['size'],
975 975
 				'component' => strtolower($row['componenttype']),
976
-				'classification' => (int)$row['classification']
976
+				'classification' => (int) $row['classification']
977 977
 			];
978 978
 		}
979 979
 		$stmt->closeCursor();
@@ -1017,12 +1017,12 @@  discard block
 block discarded – undo
1017 1017
 			'id' => $row['id'],
1018 1018
 			'uri' => $row['uri'],
1019 1019
 			'lastmodified' => $row['lastmodified'],
1020
-			'etag' => '"' . $row['etag'] . '"',
1020
+			'etag' => '"'.$row['etag'].'"',
1021 1021
 			'calendarid' => $row['calendarid'],
1022
-			'size' => (int)$row['size'],
1022
+			'size' => (int) $row['size'],
1023 1023
 			'calendardata' => $this->readBlob($row['calendardata']),
1024 1024
 			'component' => strtolower($row['componenttype']),
1025
-			'classification' => (int)$row['classification']
1025
+			'classification' => (int) $row['classification']
1026 1026
 		];
1027 1027
 	}
1028 1028
 
@@ -1063,12 +1063,12 @@  discard block
 block discarded – undo
1063 1063
 					'id' => $row['id'],
1064 1064
 					'uri' => $row['uri'],
1065 1065
 					'lastmodified' => $row['lastmodified'],
1066
-					'etag' => '"' . $row['etag'] . '"',
1066
+					'etag' => '"'.$row['etag'].'"',
1067 1067
 					'calendarid' => $row['calendarid'],
1068
-					'size' => (int)$row['size'],
1068
+					'size' => (int) $row['size'],
1069 1069
 					'calendardata' => $this->readBlob($row['calendardata']),
1070 1070
 					'component' => strtolower($row['componenttype']),
1071
-					'classification' => (int)$row['classification']
1071
+					'classification' => (int) $row['classification']
1072 1072
 				];
1073 1073
 			}
1074 1074
 			$result->closeCursor();
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 			$calendarRow = $this->getCalendarById($calendarId);
1141 1141
 			$shares = $this->getShares($calendarId);
1142 1142
 
1143
-			$this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
1143
+			$this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow));
1144 1144
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent(
1145 1145
 				'\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject',
1146 1146
 				[
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 		} else {
1154 1154
 			$subscriptionRow = $this->getSubscriptionById($calendarId);
1155 1155
 
1156
-			$this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow));
1156
+			$this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow));
1157 1157
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent(
1158 1158
 				'\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject',
1159 1159
 				[
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 			));
1166 1166
 		}
1167 1167
 
1168
-		return '"' . $extraData['etag'] . '"';
1168
+		return '"'.$extraData['etag'].'"';
1169 1169
 	}
1170 1170
 
1171 1171
 	/**
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 				$calendarRow = $this->getCalendarById($calendarId);
1215 1215
 				$shares = $this->getShares($calendarId);
1216 1216
 
1217
-				$this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
1217
+				$this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow));
1218 1218
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent(
1219 1219
 					'\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject',
1220 1220
 					[
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			} else {
1228 1228
 				$subscriptionRow = $this->getSubscriptionById($calendarId);
1229 1229
 
1230
-				$this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow));
1230
+				$this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow));
1231 1231
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent(
1232 1232
 					'\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject',
1233 1233
 					[
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 			}
1241 1241
 		}
1242 1242
 
1243
-		return '"' . $extraData['etag'] . '"';
1243
+		return '"'.$extraData['etag'].'"';
1244 1244
 	}
1245 1245
 
1246 1246
 	/**
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
 				$calendarRow = $this->getCalendarById($calendarId);
1278 1278
 				$shares = $this->getShares($calendarId);
1279 1279
 
1280
-				$this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data));
1280
+				$this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int) $calendarId, $calendarRow, $shares, $data));
1281 1281
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent(
1282 1282
 					'\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject',
1283 1283
 					[
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 			} else {
1291 1291
 				$subscriptionRow = $this->getSubscriptionById($calendarId);
1292 1292
 
1293
-				$this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data));
1293
+				$this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int) $calendarId, $subscriptionRow, [], $data));
1294 1294
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent(
1295 1295
 					'\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject',
1296 1296
 					[
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 
1563 1563
 		$result = [];
1564 1564
 		while ($row = $stmt->fetch()) {
1565
-			$path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
1565
+			$path = $uriMapper[$row['calendarid']].'/'.$row['uri'];
1566 1566
 			if (!in_array($path, $result)) {
1567 1567
 				$result[] = $path;
1568 1568
 			}
@@ -1610,8 +1610,8 @@  discard block
 block discarded – undo
1610 1610
 
1611 1611
 		if ($pattern !== '') {
1612 1612
 			$innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
1613
-				$outerQuery->createNamedParameter('%' .
1614
-					$this->db->escapeLikeParameter($pattern) . '%')));
1613
+				$outerQuery->createNamedParameter('%'.
1614
+					$this->db->escapeLikeParameter($pattern).'%')));
1615 1615
 		}
1616 1616
 
1617 1617
 		$outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
@@ -1650,7 +1650,7 @@  discard block
 block discarded – undo
1650 1650
 		$result = $outerQuery->executeQuery();
1651 1651
 		$calendarObjects = $result->fetchAll();
1652 1652
 
1653
-		return array_map(function ($o) {
1653
+		return array_map(function($o) {
1654 1654
 			$calendarData = Reader::read($o['calendardata']);
1655 1655
 			$comps = $calendarData->getComponents();
1656 1656
 			$objects = [];
@@ -1668,10 +1668,10 @@  discard block
 block discarded – undo
1668 1668
 				'type' => $o['componenttype'],
1669 1669
 				'uid' => $o['uid'],
1670 1670
 				'uri' => $o['uri'],
1671
-				'objects' => array_map(function ($c) {
1671
+				'objects' => array_map(function($c) {
1672 1672
 					return $this->transformSearchData($c);
1673 1673
 				}, $objects),
1674
-				'timezones' => array_map(function ($c) {
1674
+				'timezones' => array_map(function($c) {
1675 1675
 					return $this->transformSearchData($c);
1676 1676
 				}, $timezones),
1677 1677
 			];
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
 		/** @var Component[] $subComponents */
1688 1688
 		$subComponents = $comp->getComponents();
1689 1689
 		/** @var Property[] $properties */
1690
-		$properties = array_filter($comp->children(), function ($c) {
1690
+		$properties = array_filter($comp->children(), function($c) {
1691 1691
 			return $c instanceof Property;
1692 1692
 		});
1693 1693
 		$validationRules = $comp->getValidationRules();
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
 		$subscriptions = $this->getSubscriptionsForUser($principalUri);
1766 1766
 		foreach ($calendars as $calendar) {
1767 1767
 			$calendarAnd = $calendarObjectIdQuery->expr()->andX();
1768
-			$calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])));
1768
+			$calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id'])));
1769 1769
 			$calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1770 1770
 
1771 1771
 			// If it's shared, limit search to public events
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
 		}
1779 1779
 		foreach ($subscriptions as $subscription) {
1780 1780
 			$subscriptionAnd = $calendarObjectIdQuery->expr()->andX();
1781
-			$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])));
1781
+			$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id'])));
1782 1782
 			$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)));
1783 1783
 
1784 1784
 			// If it's shared, limit search to public events
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
 			if (!$escapePattern) {
1824 1824
 				$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern)));
1825 1825
 			} else {
1826
-				$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
1826
+				$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%')));
1827 1827
 			}
1828 1828
 		}
1829 1829
 
@@ -1837,7 +1837,7 @@  discard block
 block discarded – undo
1837 1837
 		$result = $calendarObjectIdQuery->executeQuery();
1838 1838
 		$matches = $result->fetchAll();
1839 1839
 		$result->closeCursor();
1840
-		$matches = array_map(static function (array $match):int {
1840
+		$matches = array_map(static function(array $match):int {
1841 1841
 			return (int) $match['objectid'];
1842 1842
 		}, $matches);
1843 1843
 
@@ -1850,9 +1850,9 @@  discard block
 block discarded – undo
1850 1850
 		$calendarObjects = $result->fetchAll();
1851 1851
 		$result->closeCursor();
1852 1852
 
1853
-		return array_map(function (array $array): array {
1854
-			$array['calendarid'] = (int)$array['calendarid'];
1855
-			$array['calendartype'] = (int)$array['calendartype'];
1853
+		return array_map(function(array $array): array {
1854
+			$array['calendarid'] = (int) $array['calendarid'];
1855
+			$array['calendartype'] = (int) $array['calendartype'];
1856 1856
 			$array['calendardata'] = $this->readBlob($array['calendardata']);
1857 1857
 
1858 1858
 			return $array;
@@ -1890,7 +1890,7 @@  discard block
 block discarded – undo
1890 1890
 		$row = $stmt->fetch();
1891 1891
 		$stmt->closeCursor();
1892 1892
 		if ($row) {
1893
-			return $row['calendaruri'] . '/' . $row['objecturi'];
1893
+			return $row['calendaruri'].'/'.$row['objecturi'];
1894 1894
 		}
1895 1895
 
1896 1896
 		return null;
@@ -2091,8 +2091,8 @@  discard block
 block discarded – undo
2091 2091
 				'source' => $row['source'],
2092 2092
 				'lastmodified' => $row['lastmodified'],
2093 2093
 
2094
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
2095
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
2094
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
2095
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
2096 2096
 			];
2097 2097
 
2098 2098
 			foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
@@ -2187,7 +2187,7 @@  discard block
 block discarded – undo
2187 2187
 		$supportedProperties = array_keys($this->subscriptionPropertyMap);
2188 2188
 		$supportedProperties[] = '{http://calendarserver.org/ns/}source';
2189 2189
 
2190
-		$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
2190
+		$propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) {
2191 2191
 			$newValues = [];
2192 2192
 
2193 2193
 			foreach ($mutations as $propertyName => $propertyValue) {
@@ -2209,7 +2209,7 @@  discard block
 block discarded – undo
2209 2209
 				->executeUpdate();
2210 2210
 
2211 2211
 			$subscriptionRow = $this->getSubscriptionById($subscriptionId);
2212
-			$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations));
2212
+			$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations));
2213 2213
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent(
2214 2214
 				'\OCA\DAV\CalDAV\CalDavBackend::updateSubscription',
2215 2215
 				[
@@ -2260,7 +2260,7 @@  discard block
 block discarded – undo
2260 2260
 			->executeUpdate();
2261 2261
 
2262 2262
 		if ($subscriptionRow) {
2263
-			$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, []));
2263
+			$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, []));
2264 2264
 		}
2265 2265
 	}
2266 2266
 
@@ -2298,8 +2298,8 @@  discard block
 block discarded – undo
2298 2298
 			'uri' => $row['uri'],
2299 2299
 			'calendardata' => $row['calendardata'],
2300 2300
 			'lastmodified' => $row['lastmodified'],
2301
-			'etag' => '"' . $row['etag'] . '"',
2302
-			'size' => (int)$row['size'],
2301
+			'etag' => '"'.$row['etag'].'"',
2302
+			'size' => (int) $row['size'],
2303 2303
 		];
2304 2304
 	}
2305 2305
 
@@ -2327,8 +2327,8 @@  discard block
 block discarded – undo
2327 2327
 				'calendardata' => $row['calendardata'],
2328 2328
 				'uri' => $row['uri'],
2329 2329
 				'lastmodified' => $row['lastmodified'],
2330
-				'etag' => '"' . $row['etag'] . '"',
2331
-				'size' => (int)$row['size'],
2330
+				'etag' => '"'.$row['etag'].'"',
2331
+				'size' => (int) $row['size'],
2332 2332
 			];
2333 2333
 		}
2334 2334
 
@@ -2382,14 +2382,14 @@  discard block
 block discarded – undo
2382 2382
 	 * @return void
2383 2383
 	 */
2384 2384
 	protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2385
-		$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
2385
+		$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions';
2386 2386
 
2387 2387
 		$query = $this->db->getQueryBuilder();
2388 2388
 		$query->select('synctoken')
2389 2389
 			->from($table)
2390 2390
 			->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
2391 2391
 		$result = $query->executeQuery();
2392
-		$syncToken = (int)$result->fetchOne();
2392
+		$syncToken = (int) $result->fetchOne();
2393 2393
 		$result->closeCursor();
2394 2394
 
2395 2395
 		$query = $this->db->getQueryBuilder();
@@ -2446,7 +2446,7 @@  discard block
 block discarded – undo
2446 2446
 				// Track first component type and uid
2447 2447
 				if ($uid === null) {
2448 2448
 					$componentType = $component->name;
2449
-					$uid = (string)$component->UID;
2449
+					$uid = (string) $component->UID;
2450 2450
 				}
2451 2451
 			}
2452 2452
 		}
@@ -2545,7 +2545,7 @@  discard block
 block discarded – undo
2545 2545
 			]));
2546 2546
 		$this->calendarSharingBackend->updateShares($shareable, $add, $remove);
2547 2547
 
2548
-		$this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove));
2548
+		$this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int) $calendarId, $calendarRow, $oldShares, $add, $remove));
2549 2549
 	}
2550 2550
 
2551 2551
 	/**
@@ -2586,7 +2586,7 @@  discard block
 block discarded – undo
2586 2586
 				]);
2587 2587
 			$query->executeUpdate();
2588 2588
 
2589
-			$this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri));
2589
+			$this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int) $calendarId, $calendarData, $publicUri));
2590 2590
 			return $publicUri;
2591 2591
 		}
2592 2592
 		$query->delete('dav_shares')
@@ -2594,7 +2594,7 @@  discard block
 block discarded – undo
2594 2594
 			->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)));
2595 2595
 		$query->executeUpdate();
2596 2596
 
2597
-		$this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData));
2597
+		$this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int) $calendarId, $calendarData));
2598 2598
 		return null;
2599 2599
 	}
2600 2600
 
@@ -2817,10 +2817,10 @@  discard block
 block discarded – undo
2817 2817
 		$result->closeCursor();
2818 2818
 
2819 2819
 		if (!isset($objectIds['id'])) {
2820
-			throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
2820
+			throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri);
2821 2821
 		}
2822 2822
 
2823
-		return (int)$objectIds['id'];
2823
+		return (int) $objectIds['id'];
2824 2824
 	}
2825 2825
 
2826 2826
 	/**
@@ -2847,8 +2847,8 @@  discard block
 block discarded – undo
2847 2847
 	 * @param $calendarInfo
2848 2848
 	 */
2849 2849
 	private function addOwnerPrincipal(&$calendarInfo) {
2850
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
2851
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
2850
+		$ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal';
2851
+		$displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname';
2852 2852
 		if (isset($calendarInfo[$ownerPrincipalKey])) {
2853 2853
 			$uri = $calendarInfo[$ownerPrincipalKey];
2854 2854
 		} else {
Please login to merge, or discard this patch.
apps/dav/composer/composer/autoload_classmap.php 1 patch
Spacing   +260 added lines, -260 removed lines patch added patch discarded remove patch
@@ -6,264 +6,264 @@
 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\\CleanupDirectLinksJob' => $baseDir . '/../lib/BackgroundJob/CleanupDirectLinksJob.php',
17
-    'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => $baseDir . '/../lib/BackgroundJob/CleanupInvitationTokenJob.php',
18
-    'OCA\\DAV\\BackgroundJob\\EventReminderJob' => $baseDir . '/../lib/BackgroundJob/EventReminderJob.php',
19
-    'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => $baseDir . '/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php',
20
-    'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => $baseDir . '/../lib/BackgroundJob/RefreshWebcalJob.php',
21
-    'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => $baseDir . '/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php',
22
-    'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => $baseDir . '/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php',
23
-    'OCA\\DAV\\BackgroundJob\\UploadCleanup' => $baseDir . '/../lib/BackgroundJob/UploadCleanup.php',
24
-    'OCA\\DAV\\CalDAV\\Activity\\Backend' => $baseDir . '/../lib/CalDAV/Activity/Backend.php',
25
-    'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Filter/Calendar.php',
26
-    'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Filter/Todo.php',
27
-    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => $baseDir . '/../lib/CalDAV/Activity/Provider/Base.php',
28
-    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Provider/Calendar.php',
29
-    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => $baseDir . '/../lib/CalDAV/Activity/Provider/Event.php',
30
-    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Provider/Todo.php',
31
-    'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => $baseDir . '/../lib/CalDAV/Activity/Setting/CalDAVSetting.php',
32
-    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Setting/Calendar.php',
33
-    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => $baseDir . '/../lib/CalDAV/Activity/Setting/Event.php',
34
-    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Setting/Todo.php',
35
-    'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => $baseDir . '/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php',
36
-    'OCA\\DAV\\CalDAV\\BirthdayService' => $baseDir . '/../lib/CalDAV/BirthdayService.php',
37
-    'OCA\\DAV\\CalDAV\\CachedSubscription' => $baseDir . '/../lib/CalDAV/CachedSubscription.php',
38
-    'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => $baseDir . '/../lib/CalDAV/CachedSubscriptionObject.php',
39
-    'OCA\\DAV\\CalDAV\\CalDavBackend' => $baseDir . '/../lib/CalDAV/CalDavBackend.php',
40
-    'OCA\\DAV\\CalDAV\\Calendar' => $baseDir . '/../lib/CalDAV/Calendar.php',
41
-    'OCA\\DAV\\CalDAV\\CalendarHome' => $baseDir . '/../lib/CalDAV/CalendarHome.php',
42
-    'OCA\\DAV\\CalDAV\\CalendarImpl' => $baseDir . '/../lib/CalDAV/CalendarImpl.php',
43
-    'OCA\\DAV\\CalDAV\\CalendarManager' => $baseDir . '/../lib/CalDAV/CalendarManager.php',
44
-    'OCA\\DAV\\CalDAV\\CalendarObject' => $baseDir . '/../lib/CalDAV/CalendarObject.php',
45
-    'OCA\\DAV\\CalDAV\\CalendarRoot' => $baseDir . '/../lib/CalDAV/CalendarRoot.php',
46
-    'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => $baseDir . '/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
47
-    'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => $baseDir . '/../lib/CalDAV/Integration/ExternalCalendar.php',
48
-    'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => $baseDir . '/../lib/CalDAV/Integration/ICalendarProvider.php',
49
-    'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => $baseDir . '/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php',
50
-    'OCA\\DAV\\CalDAV\\Outbox' => $baseDir . '/../lib/CalDAV/Outbox.php',
51
-    'OCA\\DAV\\CalDAV\\Plugin' => $baseDir . '/../lib/CalDAV/Plugin.php',
52
-    'OCA\\DAV\\CalDAV\\Principal\\Collection' => $baseDir . '/../lib/CalDAV/Principal/Collection.php',
53
-    'OCA\\DAV\\CalDAV\\Principal\\User' => $baseDir . '/../lib/CalDAV/Principal/User.php',
54
-    'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => $baseDir . '/../lib/CalDAV/Proxy/Proxy.php',
55
-    'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => $baseDir . '/../lib/CalDAV/Proxy/ProxyMapper.php',
56
-    'OCA\\DAV\\CalDAV\\PublicCalendar' => $baseDir . '/../lib/CalDAV/PublicCalendar.php',
57
-    'OCA\\DAV\\CalDAV\\PublicCalendarObject' => $baseDir . '/../lib/CalDAV/PublicCalendarObject.php',
58
-    'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => $baseDir . '/../lib/CalDAV/PublicCalendarRoot.php',
59
-    'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => $baseDir . '/../lib/CalDAV/Publishing/PublishPlugin.php',
60
-    'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => $baseDir . '/../lib/CalDAV/Publishing/Xml/Publisher.php',
61
-    'OCA\\DAV\\CalDAV\\Reminder\\Backend' => $baseDir . '/../lib/CalDAV/Reminder/Backend.php',
62
-    'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => $baseDir . '/../lib/CalDAV/Reminder/INotificationProvider.php',
63
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProviderManager.php',
64
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php',
65
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php',
66
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php',
67
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php',
68
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => $baseDir . '/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php',
69
-    'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => $baseDir . '/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php',
70
-    'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => $baseDir . '/../lib/CalDAV/Reminder/Notifier.php',
71
-    'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => $baseDir . '/../lib/CalDAV/Reminder/ReminderService.php',
72
-    'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php',
73
-    'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php',
74
-    'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => $baseDir . '/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php',
75
-    'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => $baseDir . '/../lib/CalDAV/Schedule/IMipPlugin.php',
76
-    'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => $baseDir . '/../lib/CalDAV/Schedule/Plugin.php',
77
-    'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => $baseDir . '/../lib/CalDAV/Search/SearchPlugin.php',
78
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/CompFilter.php',
79
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php',
80
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php',
81
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php',
82
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/PropFilter.php',
83
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => $baseDir . '/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php',
84
-    'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => $baseDir . '/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php',
85
-    'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => $baseDir . '/../lib/CalDAV/WebcalCaching/Plugin.php',
86
-    'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => $baseDir . '/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php',
87
-    'OCA\\DAV\\Capabilities' => $baseDir . '/../lib/Capabilities.php',
88
-    'OCA\\DAV\\CardDAV\\AddressBook' => $baseDir . '/../lib/CardDAV/AddressBook.php',
89
-    'OCA\\DAV\\CardDAV\\AddressBookImpl' => $baseDir . '/../lib/CardDAV/AddressBookImpl.php',
90
-    'OCA\\DAV\\CardDAV\\AddressBookRoot' => $baseDir . '/../lib/CardDAV/AddressBookRoot.php',
91
-    'OCA\\DAV\\CardDAV\\CardDavBackend' => $baseDir . '/../lib/CardDAV/CardDavBackend.php',
92
-    'OCA\\DAV\\CardDAV\\ContactsManager' => $baseDir . '/../lib/CardDAV/ContactsManager.php',
93
-    'OCA\\DAV\\CardDAV\\Converter' => $baseDir . '/../lib/CardDAV/Converter.php',
94
-    'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => $baseDir . '/../lib/CardDAV/HasPhotoPlugin.php',
95
-    'OCA\\DAV\\CardDAV\\ImageExportPlugin' => $baseDir . '/../lib/CardDAV/ImageExportPlugin.php',
96
-    'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => $baseDir . '/../lib/CardDAV/Integration/ExternalAddressBook.php',
97
-    'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => $baseDir . '/../lib/CardDAV/Integration/IAddressBookProvider.php',
98
-    'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => $baseDir . '/../lib/CardDAV/MultiGetExportPlugin.php',
99
-    'OCA\\DAV\\CardDAV\\PhotoCache' => $baseDir . '/../lib/CardDAV/PhotoCache.php',
100
-    'OCA\\DAV\\CardDAV\\Plugin' => $baseDir . '/../lib/CardDAV/Plugin.php',
101
-    'OCA\\DAV\\CardDAV\\SyncService' => $baseDir . '/../lib/CardDAV/SyncService.php',
102
-    'OCA\\DAV\\CardDAV\\SystemAddressbook' => $baseDir . '/../lib/CardDAV/SystemAddressbook.php',
103
-    'OCA\\DAV\\CardDAV\\UserAddressBooks' => $baseDir . '/../lib/CardDAV/UserAddressBooks.php',
104
-    'OCA\\DAV\\CardDAV\\Xml\\Groups' => $baseDir . '/../lib/CardDAV/Xml/Groups.php',
105
-    'OCA\\DAV\\Command\\CreateAddressBook' => $baseDir . '/../lib/Command/CreateAddressBook.php',
106
-    'OCA\\DAV\\Command\\CreateCalendar' => $baseDir . '/../lib/Command/CreateCalendar.php',
107
-    'OCA\\DAV\\Command\\ListCalendars' => $baseDir . '/../lib/Command/ListCalendars.php',
108
-    'OCA\\DAV\\Command\\MoveCalendar' => $baseDir . '/../lib/Command/MoveCalendar.php',
109
-    'OCA\\DAV\\Command\\RemoveInvalidShares' => $baseDir . '/../lib/Command/RemoveInvalidShares.php',
110
-    'OCA\\DAV\\Command\\SendEventReminders' => $baseDir . '/../lib/Command/SendEventReminders.php',
111
-    'OCA\\DAV\\Command\\SyncBirthdayCalendar' => $baseDir . '/../lib/Command/SyncBirthdayCalendar.php',
112
-    'OCA\\DAV\\Command\\SyncSystemAddressBook' => $baseDir . '/../lib/Command/SyncSystemAddressBook.php',
113
-    'OCA\\DAV\\Comments\\CommentNode' => $baseDir . '/../lib/Comments/CommentNode.php',
114
-    'OCA\\DAV\\Comments\\CommentsPlugin' => $baseDir . '/../lib/Comments/CommentsPlugin.php',
115
-    'OCA\\DAV\\Comments\\EntityCollection' => $baseDir . '/../lib/Comments/EntityCollection.php',
116
-    'OCA\\DAV\\Comments\\EntityTypeCollection' => $baseDir . '/../lib/Comments/EntityTypeCollection.php',
117
-    'OCA\\DAV\\Comments\\RootCollection' => $baseDir . '/../lib/Comments/RootCollection.php',
118
-    'OCA\\DAV\\Connector\\LegacyDAVACL' => $baseDir . '/../lib/Connector/LegacyDAVACL.php',
119
-    'OCA\\DAV\\Connector\\PublicAuth' => $baseDir . '/../lib/Connector/PublicAuth.php',
120
-    'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => $baseDir . '/../lib/Connector/Sabre/AnonymousOptionsPlugin.php',
121
-    'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => $baseDir . '/../lib/Connector/Sabre/AppEnabledPlugin.php',
122
-    'OCA\\DAV\\Connector\\Sabre\\Auth' => $baseDir . '/../lib/Connector/Sabre/Auth.php',
123
-    'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => $baseDir . '/../lib/Connector/Sabre/BearerAuth.php',
124
-    'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => $baseDir . '/../lib/Connector/Sabre/BlockLegacyClientPlugin.php',
125
-    'OCA\\DAV\\Connector\\Sabre\\CachingTree' => $baseDir . '/../lib/Connector/Sabre/CachingTree.php',
126
-    'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => $baseDir . '/../lib/Connector/Sabre/ChecksumList.php',
127
-    'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => $baseDir . '/../lib/Connector/Sabre/CommentPropertiesPlugin.php',
128
-    'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => $baseDir . '/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php',
129
-    'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => $baseDir . '/../lib/Connector/Sabre/DavAclPlugin.php',
130
-    'OCA\\DAV\\Connector\\Sabre\\Directory' => $baseDir . '/../lib/Connector/Sabre/Directory.php',
131
-    'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => $baseDir . '/../lib/Connector/Sabre/DummyGetResponsePlugin.php',
132
-    'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => $baseDir . '/../lib/Connector/Sabre/ExceptionLoggerPlugin.php',
133
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => $baseDir . '/../lib/Connector/Sabre/Exception/EntityTooLarge.php',
134
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => $baseDir . '/../lib/Connector/Sabre/Exception/FileLocked.php',
135
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => $baseDir . '/../lib/Connector/Sabre/Exception/Forbidden.php',
136
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => $baseDir . '/../lib/Connector/Sabre/Exception/InvalidPath.php',
137
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => $baseDir . '/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php',
138
-    'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => $baseDir . '/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php',
139
-    'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => $baseDir . '/../lib/Connector/Sabre/FakeLockerPlugin.php',
140
-    'OCA\\DAV\\Connector\\Sabre\\File' => $baseDir . '/../lib/Connector/Sabre/File.php',
141
-    'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => $baseDir . '/../lib/Connector/Sabre/FilesPlugin.php',
142
-    'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => $baseDir . '/../lib/Connector/Sabre/FilesReportPlugin.php',
143
-    'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => $baseDir . '/../lib/Connector/Sabre/LockPlugin.php',
144
-    'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => $baseDir . '/../lib/Connector/Sabre/MaintenancePlugin.php',
145
-    'OCA\\DAV\\Connector\\Sabre\\Node' => $baseDir . '/../lib/Connector/Sabre/Node.php',
146
-    'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => $baseDir . '/../lib/Connector/Sabre/ObjectTree.php',
147
-    'OCA\\DAV\\Connector\\Sabre\\Principal' => $baseDir . '/../lib/Connector/Sabre/Principal.php',
148
-    'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => $baseDir . '/../lib/Connector/Sabre/PropfindCompressionPlugin.php',
149
-    'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => $baseDir . '/../lib/Connector/Sabre/QuotaPlugin.php',
150
-    'OCA\\DAV\\Connector\\Sabre\\Server' => $baseDir . '/../lib/Connector/Sabre/Server.php',
151
-    'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => $baseDir . '/../lib/Connector/Sabre/ServerFactory.php',
152
-    'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => $baseDir . '/../lib/Connector/Sabre/ShareTypeList.php',
153
-    'OCA\\DAV\\Connector\\Sabre\\ShareeList' => $baseDir . '/../lib/Connector/Sabre/ShareeList.php',
154
-    'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => $baseDir . '/../lib/Connector/Sabre/SharesPlugin.php',
155
-    'OCA\\DAV\\Connector\\Sabre\\TagList' => $baseDir . '/../lib/Connector/Sabre/TagList.php',
156
-    'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => $baseDir . '/../lib/Connector/Sabre/TagsPlugin.php',
157
-    'OCA\\DAV\\Controller\\BirthdayCalendarController' => $baseDir . '/../lib/Controller/BirthdayCalendarController.php',
158
-    'OCA\\DAV\\Controller\\DirectController' => $baseDir . '/../lib/Controller/DirectController.php',
159
-    'OCA\\DAV\\Controller\\InvitationResponseController' => $baseDir . '/../lib/Controller/InvitationResponseController.php',
160
-    'OCA\\DAV\\DAV\\CustomPropertiesBackend' => $baseDir . '/../lib/DAV/CustomPropertiesBackend.php',
161
-    'OCA\\DAV\\DAV\\GroupPrincipalBackend' => $baseDir . '/../lib/DAV/GroupPrincipalBackend.php',
162
-    'OCA\\DAV\\DAV\\PublicAuth' => $baseDir . '/../lib/DAV/PublicAuth.php',
163
-    'OCA\\DAV\\DAV\\Sharing\\Backend' => $baseDir . '/../lib/DAV/Sharing/Backend.php',
164
-    'OCA\\DAV\\DAV\\Sharing\\IShareable' => $baseDir . '/../lib/DAV/Sharing/IShareable.php',
165
-    'OCA\\DAV\\DAV\\Sharing\\Plugin' => $baseDir . '/../lib/DAV/Sharing/Plugin.php',
166
-    'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => $baseDir . '/../lib/DAV/Sharing/Xml/Invite.php',
167
-    'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => $baseDir . '/../lib/DAV/Sharing/Xml/ShareRequest.php',
168
-    'OCA\\DAV\\DAV\\SystemPrincipalBackend' => $baseDir . '/../lib/DAV/SystemPrincipalBackend.php',
169
-    'OCA\\DAV\\Db\\Direct' => $baseDir . '/../lib/Db/Direct.php',
170
-    'OCA\\DAV\\Db\\DirectMapper' => $baseDir . '/../lib/Db/DirectMapper.php',
171
-    'OCA\\DAV\\Direct\\DirectFile' => $baseDir . '/../lib/Direct/DirectFile.php',
172
-    'OCA\\DAV\\Direct\\DirectHome' => $baseDir . '/../lib/Direct/DirectHome.php',
173
-    'OCA\\DAV\\Direct\\Server' => $baseDir . '/../lib/Direct/Server.php',
174
-    'OCA\\DAV\\Direct\\ServerFactory' => $baseDir . '/../lib/Direct/ServerFactory.php',
175
-    'OCA\\DAV\\Events\\AddressBookCreatedEvent' => $baseDir . '/../lib/Events/AddressBookCreatedEvent.php',
176
-    'OCA\\DAV\\Events\\AddressBookDeletedEvent' => $baseDir . '/../lib/Events/AddressBookDeletedEvent.php',
177
-    'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => $baseDir . '/../lib/Events/AddressBookShareUpdatedEvent.php',
178
-    'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => $baseDir . '/../lib/Events/AddressBookUpdatedEvent.php',
179
-    'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => $baseDir . '/../lib/Events/BeforeFileDirectDownloadedEvent.php',
180
-    'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectCreatedEvent.php',
181
-    'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectDeletedEvent.php',
182
-    'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => $baseDir . '/../lib/Events/CachedCalendarObjectUpdatedEvent.php',
183
-    'OCA\\DAV\\Events\\CalendarCreatedEvent' => $baseDir . '/../lib/Events/CalendarCreatedEvent.php',
184
-    'OCA\\DAV\\Events\\CalendarDeletedEvent' => $baseDir . '/../lib/Events/CalendarDeletedEvent.php',
185
-    'OCA\\DAV\\Events\\CalendarObjectCreatedEvent' => $baseDir . '/../lib/Events/CalendarObjectCreatedEvent.php',
186
-    'OCA\\DAV\\Events\\CalendarObjectDeletedEvent' => $baseDir . '/../lib/Events/CalendarObjectDeletedEvent.php',
187
-    'OCA\\DAV\\Events\\CalendarObjectUpdatedEvent' => $baseDir . '/../lib/Events/CalendarObjectUpdatedEvent.php',
188
-    'OCA\\DAV\\Events\\CalendarPublishedEvent' => $baseDir . '/../lib/Events/CalendarPublishedEvent.php',
189
-    'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => $baseDir . '/../lib/Events/CalendarShareUpdatedEvent.php',
190
-    'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => $baseDir . '/../lib/Events/CalendarUnpublishedEvent.php',
191
-    'OCA\\DAV\\Events\\CalendarUpdatedEvent' => $baseDir . '/../lib/Events/CalendarUpdatedEvent.php',
192
-    'OCA\\DAV\\Events\\CardCreatedEvent' => $baseDir . '/../lib/Events/CardCreatedEvent.php',
193
-    'OCA\\DAV\\Events\\CardDeletedEvent' => $baseDir . '/../lib/Events/CardDeletedEvent.php',
194
-    'OCA\\DAV\\Events\\CardUpdatedEvent' => $baseDir . '/../lib/Events/CardUpdatedEvent.php',
195
-    'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => $baseDir . '/../lib/Events/SabrePluginAuthInitEvent.php',
196
-    'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => $baseDir . '/../lib/Events/SubscriptionCreatedEvent.php',
197
-    'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => $baseDir . '/../lib/Events/SubscriptionDeletedEvent.php',
198
-    'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => $baseDir . '/../lib/Events/SubscriptionUpdatedEvent.php',
199
-    'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => $baseDir . '/../lib/Exception/UnsupportedLimitOnInitialSyncException.php',
200
-    'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => $baseDir . '/../lib/Files/BrowserErrorPagePlugin.php',
201
-    'OCA\\DAV\\Files\\FileSearchBackend' => $baseDir . '/../lib/Files/FileSearchBackend.php',
202
-    'OCA\\DAV\\Files\\FilesHome' => $baseDir . '/../lib/Files/FilesHome.php',
203
-    'OCA\\DAV\\Files\\LazySearchBackend' => $baseDir . '/../lib/Files/LazySearchBackend.php',
204
-    'OCA\\DAV\\Files\\RootCollection' => $baseDir . '/../lib/Files/RootCollection.php',
205
-    'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => $baseDir . '/../lib/Files/Sharing/FilesDropPlugin.php',
206
-    'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => $baseDir . '/../lib/Files/Sharing/PublicLinkCheckPlugin.php',
207
-    'OCA\\DAV\\HookManager' => $baseDir . '/../lib/HookManager.php',
208
-    'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => $baseDir . '/../lib/Listener/CalendarContactInteractionListener.php',
209
-    'OCA\\DAV\\Listener\\CalendarDeletionActivityUpdaterListener' => $baseDir . '/../lib/Listener/CalendarDeletionActivityUpdaterListener.php',
210
-    'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => $baseDir . '/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php',
211
-    'OCA\\DAV\\Listener\\CalendarDeletionReminderUpdaterListener' => $baseDir . '/../lib/Listener/CalendarDeletionReminderUpdaterListener.php',
212
-    'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => $baseDir . '/../lib/Migration/BuildCalendarSearchIndex.php',
213
-    'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => $baseDir . '/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php',
214
-    'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => $baseDir . '/../lib/Migration/BuildSocialSearchIndex.php',
215
-    'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => $baseDir . '/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php',
216
-    'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => $baseDir . '/../lib/Migration/CalDAVRemoveEmptyValue.php',
217
-    'OCA\\DAV\\Migration\\ChunkCleanup' => $baseDir . '/../lib/Migration/ChunkCleanup.php',
218
-    'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => $baseDir . '/../lib/Migration/FixBirthdayCalendarComponent.php',
219
-    'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => $baseDir . '/../lib/Migration/RefreshWebcalJobRegistrar.php',
220
-    'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => $baseDir . '/../lib/Migration/RegenerateBirthdayCalendars.php',
221
-    'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => $baseDir . '/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php',
222
-    'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => $baseDir . '/../lib/Migration/RemoveClassifiedEventActivity.php',
223
-    'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => $baseDir . '/../lib/Migration/RemoveOrphanEventsAndContacts.php',
224
-    'OCA\\DAV\\Migration\\Version1004Date20170825134824' => $baseDir . '/../lib/Migration/Version1004Date20170825134824.php',
225
-    'OCA\\DAV\\Migration\\Version1004Date20170919104507' => $baseDir . '/../lib/Migration/Version1004Date20170919104507.php',
226
-    'OCA\\DAV\\Migration\\Version1004Date20170924124212' => $baseDir . '/../lib/Migration/Version1004Date20170924124212.php',
227
-    'OCA\\DAV\\Migration\\Version1004Date20170926103422' => $baseDir . '/../lib/Migration/Version1004Date20170926103422.php',
228
-    'OCA\\DAV\\Migration\\Version1005Date20180413093149' => $baseDir . '/../lib/Migration/Version1005Date20180413093149.php',
229
-    'OCA\\DAV\\Migration\\Version1005Date20180530124431' => $baseDir . '/../lib/Migration/Version1005Date20180530124431.php',
230
-    'OCA\\DAV\\Migration\\Version1006Date20180619154313' => $baseDir . '/../lib/Migration/Version1006Date20180619154313.php',
231
-    'OCA\\DAV\\Migration\\Version1006Date20180628111625' => $baseDir . '/../lib/Migration/Version1006Date20180628111625.php',
232
-    'OCA\\DAV\\Migration\\Version1008Date20181030113700' => $baseDir . '/../lib/Migration/Version1008Date20181030113700.php',
233
-    'OCA\\DAV\\Migration\\Version1008Date20181105104826' => $baseDir . '/../lib/Migration/Version1008Date20181105104826.php',
234
-    'OCA\\DAV\\Migration\\Version1008Date20181105104833' => $baseDir . '/../lib/Migration/Version1008Date20181105104833.php',
235
-    'OCA\\DAV\\Migration\\Version1008Date20181105110300' => $baseDir . '/../lib/Migration/Version1008Date20181105110300.php',
236
-    'OCA\\DAV\\Migration\\Version1008Date20181105112049' => $baseDir . '/../lib/Migration/Version1008Date20181105112049.php',
237
-    'OCA\\DAV\\Migration\\Version1008Date20181114084440' => $baseDir . '/../lib/Migration/Version1008Date20181114084440.php',
238
-    'OCA\\DAV\\Migration\\Version1011Date20190725113607' => $baseDir . '/../lib/Migration/Version1011Date20190725113607.php',
239
-    'OCA\\DAV\\Migration\\Version1011Date20190806104428' => $baseDir . '/../lib/Migration/Version1011Date20190806104428.php',
240
-    'OCA\\DAV\\Migration\\Version1012Date20190808122342' => $baseDir . '/../lib/Migration/Version1012Date20190808122342.php',
241
-    'OCA\\DAV\\Migration\\Version1016Date20201109085907' => $baseDir . '/../lib/Migration/Version1016Date20201109085907.php',
242
-    'OCA\\DAV\\Migration\\Version1017Date20210216083742' => $baseDir . '/../lib/Migration/Version1017Date20210216083742.php',
243
-    'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => $baseDir . '/../lib/Provisioning/Apple/AppleProvisioningNode.php',
244
-    'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => $baseDir . '/../lib/Provisioning/Apple/AppleProvisioningPlugin.php',
245
-    'OCA\\DAV\\RootCollection' => $baseDir . '/../lib/RootCollection.php',
246
-    'OCA\\DAV\\Search\\ACalendarSearchProvider' => $baseDir . '/../lib/Search/ACalendarSearchProvider.php',
247
-    'OCA\\DAV\\Search\\ContactsSearchProvider' => $baseDir . '/../lib/Search/ContactsSearchProvider.php',
248
-    'OCA\\DAV\\Search\\EventsSearchProvider' => $baseDir . '/../lib/Search/EventsSearchProvider.php',
249
-    'OCA\\DAV\\Search\\TasksSearchProvider' => $baseDir . '/../lib/Search/TasksSearchProvider.php',
250
-    'OCA\\DAV\\Server' => $baseDir . '/../lib/Server.php',
251
-    'OCA\\DAV\\Settings\\CalDAVSettings' => $baseDir . '/../lib/Settings/CalDAVSettings.php',
252
-    'OCA\\DAV\\Storage\\PublicOwnerWrapper' => $baseDir . '/../lib/Storage/PublicOwnerWrapper.php',
253
-    'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => $baseDir . '/../lib/SystemTag/SystemTagMappingNode.php',
254
-    'OCA\\DAV\\SystemTag\\SystemTagNode' => $baseDir . '/../lib/SystemTag/SystemTagNode.php',
255
-    'OCA\\DAV\\SystemTag\\SystemTagPlugin' => $baseDir . '/../lib/SystemTag/SystemTagPlugin.php',
256
-    'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => $baseDir . '/../lib/SystemTag/SystemTagsByIdCollection.php',
257
-    'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => $baseDir . '/../lib/SystemTag/SystemTagsObjectMappingCollection.php',
258
-    'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => $baseDir . '/../lib/SystemTag/SystemTagsObjectTypeCollection.php',
259
-    'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => $baseDir . '/../lib/SystemTag/SystemTagsRelationsCollection.php',
260
-    'OCA\\DAV\\Traits\\PrincipalProxyTrait' => $baseDir . '/../lib/Traits/PrincipalProxyTrait.php',
261
-    'OCA\\DAV\\Upload\\AssemblyStream' => $baseDir . '/../lib/Upload/AssemblyStream.php',
262
-    'OCA\\DAV\\Upload\\ChunkingPlugin' => $baseDir . '/../lib/Upload/ChunkingPlugin.php',
263
-    'OCA\\DAV\\Upload\\CleanupService' => $baseDir . '/../lib/Upload/CleanupService.php',
264
-    'OCA\\DAV\\Upload\\FutureFile' => $baseDir . '/../lib/Upload/FutureFile.php',
265
-    'OCA\\DAV\\Upload\\RootCollection' => $baseDir . '/../lib/Upload/RootCollection.php',
266
-    'OCA\\DAV\\Upload\\UploadFile' => $baseDir . '/../lib/Upload/UploadFile.php',
267
-    'OCA\\DAV\\Upload\\UploadFolder' => $baseDir . '/../lib/Upload/UploadFolder.php',
268
-    'OCA\\DAV\\Upload\\UploadHome' => $baseDir . '/../lib/Upload/UploadHome.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\\CleanupDirectLinksJob' => $baseDir.'/../lib/BackgroundJob/CleanupDirectLinksJob.php',
17
+    'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => $baseDir.'/../lib/BackgroundJob/CleanupInvitationTokenJob.php',
18
+    'OCA\\DAV\\BackgroundJob\\EventReminderJob' => $baseDir.'/../lib/BackgroundJob/EventReminderJob.php',
19
+    'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => $baseDir.'/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php',
20
+    'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => $baseDir.'/../lib/BackgroundJob/RefreshWebcalJob.php',
21
+    'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => $baseDir.'/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php',
22
+    'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => $baseDir.'/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php',
23
+    'OCA\\DAV\\BackgroundJob\\UploadCleanup' => $baseDir.'/../lib/BackgroundJob/UploadCleanup.php',
24
+    'OCA\\DAV\\CalDAV\\Activity\\Backend' => $baseDir.'/../lib/CalDAV/Activity/Backend.php',
25
+    'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Filter/Calendar.php',
26
+    'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Filter/Todo.php',
27
+    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => $baseDir.'/../lib/CalDAV/Activity/Provider/Base.php',
28
+    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Provider/Calendar.php',
29
+    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => $baseDir.'/../lib/CalDAV/Activity/Provider/Event.php',
30
+    'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Provider/Todo.php',
31
+    'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => $baseDir.'/../lib/CalDAV/Activity/Setting/CalDAVSetting.php',
32
+    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => $baseDir.'/../lib/CalDAV/Activity/Setting/Calendar.php',
33
+    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => $baseDir.'/../lib/CalDAV/Activity/Setting/Event.php',
34
+    'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => $baseDir.'/../lib/CalDAV/Activity/Setting/Todo.php',
35
+    'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => $baseDir.'/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php',
36
+    'OCA\\DAV\\CalDAV\\BirthdayService' => $baseDir.'/../lib/CalDAV/BirthdayService.php',
37
+    'OCA\\DAV\\CalDAV\\CachedSubscription' => $baseDir.'/../lib/CalDAV/CachedSubscription.php',
38
+    'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => $baseDir.'/../lib/CalDAV/CachedSubscriptionObject.php',
39
+    'OCA\\DAV\\CalDAV\\CalDavBackend' => $baseDir.'/../lib/CalDAV/CalDavBackend.php',
40
+    'OCA\\DAV\\CalDAV\\Calendar' => $baseDir.'/../lib/CalDAV/Calendar.php',
41
+    'OCA\\DAV\\CalDAV\\CalendarHome' => $baseDir.'/../lib/CalDAV/CalendarHome.php',
42
+    'OCA\\DAV\\CalDAV\\CalendarImpl' => $baseDir.'/../lib/CalDAV/CalendarImpl.php',
43
+    'OCA\\DAV\\CalDAV\\CalendarManager' => $baseDir.'/../lib/CalDAV/CalendarManager.php',
44
+    'OCA\\DAV\\CalDAV\\CalendarObject' => $baseDir.'/../lib/CalDAV/CalendarObject.php',
45
+    'OCA\\DAV\\CalDAV\\CalendarRoot' => $baseDir.'/../lib/CalDAV/CalendarRoot.php',
46
+    'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => $baseDir.'/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
47
+    'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => $baseDir.'/../lib/CalDAV/Integration/ExternalCalendar.php',
48
+    'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => $baseDir.'/../lib/CalDAV/Integration/ICalendarProvider.php',
49
+    'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => $baseDir.'/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php',
50
+    'OCA\\DAV\\CalDAV\\Outbox' => $baseDir.'/../lib/CalDAV/Outbox.php',
51
+    'OCA\\DAV\\CalDAV\\Plugin' => $baseDir.'/../lib/CalDAV/Plugin.php',
52
+    'OCA\\DAV\\CalDAV\\Principal\\Collection' => $baseDir.'/../lib/CalDAV/Principal/Collection.php',
53
+    'OCA\\DAV\\CalDAV\\Principal\\User' => $baseDir.'/../lib/CalDAV/Principal/User.php',
54
+    'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => $baseDir.'/../lib/CalDAV/Proxy/Proxy.php',
55
+    'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => $baseDir.'/../lib/CalDAV/Proxy/ProxyMapper.php',
56
+    'OCA\\DAV\\CalDAV\\PublicCalendar' => $baseDir.'/../lib/CalDAV/PublicCalendar.php',
57
+    'OCA\\DAV\\CalDAV\\PublicCalendarObject' => $baseDir.'/../lib/CalDAV/PublicCalendarObject.php',
58
+    'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => $baseDir.'/../lib/CalDAV/PublicCalendarRoot.php',
59
+    'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => $baseDir.'/../lib/CalDAV/Publishing/PublishPlugin.php',
60
+    'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => $baseDir.'/../lib/CalDAV/Publishing/Xml/Publisher.php',
61
+    'OCA\\DAV\\CalDAV\\Reminder\\Backend' => $baseDir.'/../lib/CalDAV/Reminder/Backend.php',
62
+    'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => $baseDir.'/../lib/CalDAV/Reminder/INotificationProvider.php',
63
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProviderManager.php',
64
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php',
65
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php',
66
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php',
67
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php',
68
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => $baseDir.'/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php',
69
+    'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => $baseDir.'/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php',
70
+    'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => $baseDir.'/../lib/CalDAV/Reminder/Notifier.php',
71
+    'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => $baseDir.'/../lib/CalDAV/Reminder/ReminderService.php',
72
+    'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php',
73
+    'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php',
74
+    'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => $baseDir.'/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php',
75
+    'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => $baseDir.'/../lib/CalDAV/Schedule/IMipPlugin.php',
76
+    'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => $baseDir.'/../lib/CalDAV/Schedule/Plugin.php',
77
+    'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => $baseDir.'/../lib/CalDAV/Search/SearchPlugin.php',
78
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/CompFilter.php',
79
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php',
80
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php',
81
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php',
82
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/PropFilter.php',
83
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => $baseDir.'/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php',
84
+    'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => $baseDir.'/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php',
85
+    'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => $baseDir.'/../lib/CalDAV/WebcalCaching/Plugin.php',
86
+    'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => $baseDir.'/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php',
87
+    'OCA\\DAV\\Capabilities' => $baseDir.'/../lib/Capabilities.php',
88
+    'OCA\\DAV\\CardDAV\\AddressBook' => $baseDir.'/../lib/CardDAV/AddressBook.php',
89
+    'OCA\\DAV\\CardDAV\\AddressBookImpl' => $baseDir.'/../lib/CardDAV/AddressBookImpl.php',
90
+    'OCA\\DAV\\CardDAV\\AddressBookRoot' => $baseDir.'/../lib/CardDAV/AddressBookRoot.php',
91
+    'OCA\\DAV\\CardDAV\\CardDavBackend' => $baseDir.'/../lib/CardDAV/CardDavBackend.php',
92
+    'OCA\\DAV\\CardDAV\\ContactsManager' => $baseDir.'/../lib/CardDAV/ContactsManager.php',
93
+    'OCA\\DAV\\CardDAV\\Converter' => $baseDir.'/../lib/CardDAV/Converter.php',
94
+    'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => $baseDir.'/../lib/CardDAV/HasPhotoPlugin.php',
95
+    'OCA\\DAV\\CardDAV\\ImageExportPlugin' => $baseDir.'/../lib/CardDAV/ImageExportPlugin.php',
96
+    'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => $baseDir.'/../lib/CardDAV/Integration/ExternalAddressBook.php',
97
+    'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => $baseDir.'/../lib/CardDAV/Integration/IAddressBookProvider.php',
98
+    'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => $baseDir.'/../lib/CardDAV/MultiGetExportPlugin.php',
99
+    'OCA\\DAV\\CardDAV\\PhotoCache' => $baseDir.'/../lib/CardDAV/PhotoCache.php',
100
+    'OCA\\DAV\\CardDAV\\Plugin' => $baseDir.'/../lib/CardDAV/Plugin.php',
101
+    'OCA\\DAV\\CardDAV\\SyncService' => $baseDir.'/../lib/CardDAV/SyncService.php',
102
+    'OCA\\DAV\\CardDAV\\SystemAddressbook' => $baseDir.'/../lib/CardDAV/SystemAddressbook.php',
103
+    'OCA\\DAV\\CardDAV\\UserAddressBooks' => $baseDir.'/../lib/CardDAV/UserAddressBooks.php',
104
+    'OCA\\DAV\\CardDAV\\Xml\\Groups' => $baseDir.'/../lib/CardDAV/Xml/Groups.php',
105
+    'OCA\\DAV\\Command\\CreateAddressBook' => $baseDir.'/../lib/Command/CreateAddressBook.php',
106
+    'OCA\\DAV\\Command\\CreateCalendar' => $baseDir.'/../lib/Command/CreateCalendar.php',
107
+    'OCA\\DAV\\Command\\ListCalendars' => $baseDir.'/../lib/Command/ListCalendars.php',
108
+    'OCA\\DAV\\Command\\MoveCalendar' => $baseDir.'/../lib/Command/MoveCalendar.php',
109
+    'OCA\\DAV\\Command\\RemoveInvalidShares' => $baseDir.'/../lib/Command/RemoveInvalidShares.php',
110
+    'OCA\\DAV\\Command\\SendEventReminders' => $baseDir.'/../lib/Command/SendEventReminders.php',
111
+    'OCA\\DAV\\Command\\SyncBirthdayCalendar' => $baseDir.'/../lib/Command/SyncBirthdayCalendar.php',
112
+    'OCA\\DAV\\Command\\SyncSystemAddressBook' => $baseDir.'/../lib/Command/SyncSystemAddressBook.php',
113
+    'OCA\\DAV\\Comments\\CommentNode' => $baseDir.'/../lib/Comments/CommentNode.php',
114
+    'OCA\\DAV\\Comments\\CommentsPlugin' => $baseDir.'/../lib/Comments/CommentsPlugin.php',
115
+    'OCA\\DAV\\Comments\\EntityCollection' => $baseDir.'/../lib/Comments/EntityCollection.php',
116
+    'OCA\\DAV\\Comments\\EntityTypeCollection' => $baseDir.'/../lib/Comments/EntityTypeCollection.php',
117
+    'OCA\\DAV\\Comments\\RootCollection' => $baseDir.'/../lib/Comments/RootCollection.php',
118
+    'OCA\\DAV\\Connector\\LegacyDAVACL' => $baseDir.'/../lib/Connector/LegacyDAVACL.php',
119
+    'OCA\\DAV\\Connector\\PublicAuth' => $baseDir.'/../lib/Connector/PublicAuth.php',
120
+    'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => $baseDir.'/../lib/Connector/Sabre/AnonymousOptionsPlugin.php',
121
+    'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => $baseDir.'/../lib/Connector/Sabre/AppEnabledPlugin.php',
122
+    'OCA\\DAV\\Connector\\Sabre\\Auth' => $baseDir.'/../lib/Connector/Sabre/Auth.php',
123
+    'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => $baseDir.'/../lib/Connector/Sabre/BearerAuth.php',
124
+    'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => $baseDir.'/../lib/Connector/Sabre/BlockLegacyClientPlugin.php',
125
+    'OCA\\DAV\\Connector\\Sabre\\CachingTree' => $baseDir.'/../lib/Connector/Sabre/CachingTree.php',
126
+    'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => $baseDir.'/../lib/Connector/Sabre/ChecksumList.php',
127
+    'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => $baseDir.'/../lib/Connector/Sabre/CommentPropertiesPlugin.php',
128
+    'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => $baseDir.'/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php',
129
+    'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => $baseDir.'/../lib/Connector/Sabre/DavAclPlugin.php',
130
+    'OCA\\DAV\\Connector\\Sabre\\Directory' => $baseDir.'/../lib/Connector/Sabre/Directory.php',
131
+    'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => $baseDir.'/../lib/Connector/Sabre/DummyGetResponsePlugin.php',
132
+    'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => $baseDir.'/../lib/Connector/Sabre/ExceptionLoggerPlugin.php',
133
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => $baseDir.'/../lib/Connector/Sabre/Exception/EntityTooLarge.php',
134
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => $baseDir.'/../lib/Connector/Sabre/Exception/FileLocked.php',
135
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => $baseDir.'/../lib/Connector/Sabre/Exception/Forbidden.php',
136
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => $baseDir.'/../lib/Connector/Sabre/Exception/InvalidPath.php',
137
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => $baseDir.'/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php',
138
+    'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => $baseDir.'/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php',
139
+    'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => $baseDir.'/../lib/Connector/Sabre/FakeLockerPlugin.php',
140
+    'OCA\\DAV\\Connector\\Sabre\\File' => $baseDir.'/../lib/Connector/Sabre/File.php',
141
+    'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => $baseDir.'/../lib/Connector/Sabre/FilesPlugin.php',
142
+    'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => $baseDir.'/../lib/Connector/Sabre/FilesReportPlugin.php',
143
+    'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => $baseDir.'/../lib/Connector/Sabre/LockPlugin.php',
144
+    'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => $baseDir.'/../lib/Connector/Sabre/MaintenancePlugin.php',
145
+    'OCA\\DAV\\Connector\\Sabre\\Node' => $baseDir.'/../lib/Connector/Sabre/Node.php',
146
+    'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => $baseDir.'/../lib/Connector/Sabre/ObjectTree.php',
147
+    'OCA\\DAV\\Connector\\Sabre\\Principal' => $baseDir.'/../lib/Connector/Sabre/Principal.php',
148
+    'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => $baseDir.'/../lib/Connector/Sabre/PropfindCompressionPlugin.php',
149
+    'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => $baseDir.'/../lib/Connector/Sabre/QuotaPlugin.php',
150
+    'OCA\\DAV\\Connector\\Sabre\\Server' => $baseDir.'/../lib/Connector/Sabre/Server.php',
151
+    'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => $baseDir.'/../lib/Connector/Sabre/ServerFactory.php',
152
+    'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => $baseDir.'/../lib/Connector/Sabre/ShareTypeList.php',
153
+    'OCA\\DAV\\Connector\\Sabre\\ShareeList' => $baseDir.'/../lib/Connector/Sabre/ShareeList.php',
154
+    'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => $baseDir.'/../lib/Connector/Sabre/SharesPlugin.php',
155
+    'OCA\\DAV\\Connector\\Sabre\\TagList' => $baseDir.'/../lib/Connector/Sabre/TagList.php',
156
+    'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => $baseDir.'/../lib/Connector/Sabre/TagsPlugin.php',
157
+    'OCA\\DAV\\Controller\\BirthdayCalendarController' => $baseDir.'/../lib/Controller/BirthdayCalendarController.php',
158
+    'OCA\\DAV\\Controller\\DirectController' => $baseDir.'/../lib/Controller/DirectController.php',
159
+    'OCA\\DAV\\Controller\\InvitationResponseController' => $baseDir.'/../lib/Controller/InvitationResponseController.php',
160
+    'OCA\\DAV\\DAV\\CustomPropertiesBackend' => $baseDir.'/../lib/DAV/CustomPropertiesBackend.php',
161
+    'OCA\\DAV\\DAV\\GroupPrincipalBackend' => $baseDir.'/../lib/DAV/GroupPrincipalBackend.php',
162
+    'OCA\\DAV\\DAV\\PublicAuth' => $baseDir.'/../lib/DAV/PublicAuth.php',
163
+    'OCA\\DAV\\DAV\\Sharing\\Backend' => $baseDir.'/../lib/DAV/Sharing/Backend.php',
164
+    'OCA\\DAV\\DAV\\Sharing\\IShareable' => $baseDir.'/../lib/DAV/Sharing/IShareable.php',
165
+    'OCA\\DAV\\DAV\\Sharing\\Plugin' => $baseDir.'/../lib/DAV/Sharing/Plugin.php',
166
+    'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => $baseDir.'/../lib/DAV/Sharing/Xml/Invite.php',
167
+    'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => $baseDir.'/../lib/DAV/Sharing/Xml/ShareRequest.php',
168
+    'OCA\\DAV\\DAV\\SystemPrincipalBackend' => $baseDir.'/../lib/DAV/SystemPrincipalBackend.php',
169
+    'OCA\\DAV\\Db\\Direct' => $baseDir.'/../lib/Db/Direct.php',
170
+    'OCA\\DAV\\Db\\DirectMapper' => $baseDir.'/../lib/Db/DirectMapper.php',
171
+    'OCA\\DAV\\Direct\\DirectFile' => $baseDir.'/../lib/Direct/DirectFile.php',
172
+    'OCA\\DAV\\Direct\\DirectHome' => $baseDir.'/../lib/Direct/DirectHome.php',
173
+    'OCA\\DAV\\Direct\\Server' => $baseDir.'/../lib/Direct/Server.php',
174
+    'OCA\\DAV\\Direct\\ServerFactory' => $baseDir.'/../lib/Direct/ServerFactory.php',
175
+    'OCA\\DAV\\Events\\AddressBookCreatedEvent' => $baseDir.'/../lib/Events/AddressBookCreatedEvent.php',
176
+    'OCA\\DAV\\Events\\AddressBookDeletedEvent' => $baseDir.'/../lib/Events/AddressBookDeletedEvent.php',
177
+    'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => $baseDir.'/../lib/Events/AddressBookShareUpdatedEvent.php',
178
+    'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => $baseDir.'/../lib/Events/AddressBookUpdatedEvent.php',
179
+    'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => $baseDir.'/../lib/Events/BeforeFileDirectDownloadedEvent.php',
180
+    'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => $baseDir.'/../lib/Events/CachedCalendarObjectCreatedEvent.php',
181
+    'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => $baseDir.'/../lib/Events/CachedCalendarObjectDeletedEvent.php',
182
+    'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => $baseDir.'/../lib/Events/CachedCalendarObjectUpdatedEvent.php',
183
+    'OCA\\DAV\\Events\\CalendarCreatedEvent' => $baseDir.'/../lib/Events/CalendarCreatedEvent.php',
184
+    'OCA\\DAV\\Events\\CalendarDeletedEvent' => $baseDir.'/../lib/Events/CalendarDeletedEvent.php',
185
+    'OCA\\DAV\\Events\\CalendarObjectCreatedEvent' => $baseDir.'/../lib/Events/CalendarObjectCreatedEvent.php',
186
+    'OCA\\DAV\\Events\\CalendarObjectDeletedEvent' => $baseDir.'/../lib/Events/CalendarObjectDeletedEvent.php',
187
+    'OCA\\DAV\\Events\\CalendarObjectUpdatedEvent' => $baseDir.'/../lib/Events/CalendarObjectUpdatedEvent.php',
188
+    'OCA\\DAV\\Events\\CalendarPublishedEvent' => $baseDir.'/../lib/Events/CalendarPublishedEvent.php',
189
+    'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => $baseDir.'/../lib/Events/CalendarShareUpdatedEvent.php',
190
+    'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => $baseDir.'/../lib/Events/CalendarUnpublishedEvent.php',
191
+    'OCA\\DAV\\Events\\CalendarUpdatedEvent' => $baseDir.'/../lib/Events/CalendarUpdatedEvent.php',
192
+    'OCA\\DAV\\Events\\CardCreatedEvent' => $baseDir.'/../lib/Events/CardCreatedEvent.php',
193
+    'OCA\\DAV\\Events\\CardDeletedEvent' => $baseDir.'/../lib/Events/CardDeletedEvent.php',
194
+    'OCA\\DAV\\Events\\CardUpdatedEvent' => $baseDir.'/../lib/Events/CardUpdatedEvent.php',
195
+    'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => $baseDir.'/../lib/Events/SabrePluginAuthInitEvent.php',
196
+    'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => $baseDir.'/../lib/Events/SubscriptionCreatedEvent.php',
197
+    'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => $baseDir.'/../lib/Events/SubscriptionDeletedEvent.php',
198
+    'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => $baseDir.'/../lib/Events/SubscriptionUpdatedEvent.php',
199
+    'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => $baseDir.'/../lib/Exception/UnsupportedLimitOnInitialSyncException.php',
200
+    'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => $baseDir.'/../lib/Files/BrowserErrorPagePlugin.php',
201
+    'OCA\\DAV\\Files\\FileSearchBackend' => $baseDir.'/../lib/Files/FileSearchBackend.php',
202
+    'OCA\\DAV\\Files\\FilesHome' => $baseDir.'/../lib/Files/FilesHome.php',
203
+    'OCA\\DAV\\Files\\LazySearchBackend' => $baseDir.'/../lib/Files/LazySearchBackend.php',
204
+    'OCA\\DAV\\Files\\RootCollection' => $baseDir.'/../lib/Files/RootCollection.php',
205
+    'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => $baseDir.'/../lib/Files/Sharing/FilesDropPlugin.php',
206
+    'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => $baseDir.'/../lib/Files/Sharing/PublicLinkCheckPlugin.php',
207
+    'OCA\\DAV\\HookManager' => $baseDir.'/../lib/HookManager.php',
208
+    'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => $baseDir.'/../lib/Listener/CalendarContactInteractionListener.php',
209
+    'OCA\\DAV\\Listener\\CalendarDeletionActivityUpdaterListener' => $baseDir.'/../lib/Listener/CalendarDeletionActivityUpdaterListener.php',
210
+    'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => $baseDir.'/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php',
211
+    'OCA\\DAV\\Listener\\CalendarDeletionReminderUpdaterListener' => $baseDir.'/../lib/Listener/CalendarDeletionReminderUpdaterListener.php',
212
+    'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => $baseDir.'/../lib/Migration/BuildCalendarSearchIndex.php',
213
+    'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => $baseDir.'/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php',
214
+    'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => $baseDir.'/../lib/Migration/BuildSocialSearchIndex.php',
215
+    'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => $baseDir.'/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php',
216
+    'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => $baseDir.'/../lib/Migration/CalDAVRemoveEmptyValue.php',
217
+    'OCA\\DAV\\Migration\\ChunkCleanup' => $baseDir.'/../lib/Migration/ChunkCleanup.php',
218
+    'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => $baseDir.'/../lib/Migration/FixBirthdayCalendarComponent.php',
219
+    'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => $baseDir.'/../lib/Migration/RefreshWebcalJobRegistrar.php',
220
+    'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => $baseDir.'/../lib/Migration/RegenerateBirthdayCalendars.php',
221
+    'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => $baseDir.'/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php',
222
+    'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => $baseDir.'/../lib/Migration/RemoveClassifiedEventActivity.php',
223
+    'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => $baseDir.'/../lib/Migration/RemoveOrphanEventsAndContacts.php',
224
+    'OCA\\DAV\\Migration\\Version1004Date20170825134824' => $baseDir.'/../lib/Migration/Version1004Date20170825134824.php',
225
+    'OCA\\DAV\\Migration\\Version1004Date20170919104507' => $baseDir.'/../lib/Migration/Version1004Date20170919104507.php',
226
+    'OCA\\DAV\\Migration\\Version1004Date20170924124212' => $baseDir.'/../lib/Migration/Version1004Date20170924124212.php',
227
+    'OCA\\DAV\\Migration\\Version1004Date20170926103422' => $baseDir.'/../lib/Migration/Version1004Date20170926103422.php',
228
+    'OCA\\DAV\\Migration\\Version1005Date20180413093149' => $baseDir.'/../lib/Migration/Version1005Date20180413093149.php',
229
+    'OCA\\DAV\\Migration\\Version1005Date20180530124431' => $baseDir.'/../lib/Migration/Version1005Date20180530124431.php',
230
+    'OCA\\DAV\\Migration\\Version1006Date20180619154313' => $baseDir.'/../lib/Migration/Version1006Date20180619154313.php',
231
+    'OCA\\DAV\\Migration\\Version1006Date20180628111625' => $baseDir.'/../lib/Migration/Version1006Date20180628111625.php',
232
+    'OCA\\DAV\\Migration\\Version1008Date20181030113700' => $baseDir.'/../lib/Migration/Version1008Date20181030113700.php',
233
+    'OCA\\DAV\\Migration\\Version1008Date20181105104826' => $baseDir.'/../lib/Migration/Version1008Date20181105104826.php',
234
+    'OCA\\DAV\\Migration\\Version1008Date20181105104833' => $baseDir.'/../lib/Migration/Version1008Date20181105104833.php',
235
+    'OCA\\DAV\\Migration\\Version1008Date20181105110300' => $baseDir.'/../lib/Migration/Version1008Date20181105110300.php',
236
+    'OCA\\DAV\\Migration\\Version1008Date20181105112049' => $baseDir.'/../lib/Migration/Version1008Date20181105112049.php',
237
+    'OCA\\DAV\\Migration\\Version1008Date20181114084440' => $baseDir.'/../lib/Migration/Version1008Date20181114084440.php',
238
+    'OCA\\DAV\\Migration\\Version1011Date20190725113607' => $baseDir.'/../lib/Migration/Version1011Date20190725113607.php',
239
+    'OCA\\DAV\\Migration\\Version1011Date20190806104428' => $baseDir.'/../lib/Migration/Version1011Date20190806104428.php',
240
+    'OCA\\DAV\\Migration\\Version1012Date20190808122342' => $baseDir.'/../lib/Migration/Version1012Date20190808122342.php',
241
+    'OCA\\DAV\\Migration\\Version1016Date20201109085907' => $baseDir.'/../lib/Migration/Version1016Date20201109085907.php',
242
+    'OCA\\DAV\\Migration\\Version1017Date20210216083742' => $baseDir.'/../lib/Migration/Version1017Date20210216083742.php',
243
+    'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => $baseDir.'/../lib/Provisioning/Apple/AppleProvisioningNode.php',
244
+    'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => $baseDir.'/../lib/Provisioning/Apple/AppleProvisioningPlugin.php',
245
+    'OCA\\DAV\\RootCollection' => $baseDir.'/../lib/RootCollection.php',
246
+    'OCA\\DAV\\Search\\ACalendarSearchProvider' => $baseDir.'/../lib/Search/ACalendarSearchProvider.php',
247
+    'OCA\\DAV\\Search\\ContactsSearchProvider' => $baseDir.'/../lib/Search/ContactsSearchProvider.php',
248
+    'OCA\\DAV\\Search\\EventsSearchProvider' => $baseDir.'/../lib/Search/EventsSearchProvider.php',
249
+    'OCA\\DAV\\Search\\TasksSearchProvider' => $baseDir.'/../lib/Search/TasksSearchProvider.php',
250
+    'OCA\\DAV\\Server' => $baseDir.'/../lib/Server.php',
251
+    'OCA\\DAV\\Settings\\CalDAVSettings' => $baseDir.'/../lib/Settings/CalDAVSettings.php',
252
+    'OCA\\DAV\\Storage\\PublicOwnerWrapper' => $baseDir.'/../lib/Storage/PublicOwnerWrapper.php',
253
+    'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => $baseDir.'/../lib/SystemTag/SystemTagMappingNode.php',
254
+    'OCA\\DAV\\SystemTag\\SystemTagNode' => $baseDir.'/../lib/SystemTag/SystemTagNode.php',
255
+    'OCA\\DAV\\SystemTag\\SystemTagPlugin' => $baseDir.'/../lib/SystemTag/SystemTagPlugin.php',
256
+    'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => $baseDir.'/../lib/SystemTag/SystemTagsByIdCollection.php',
257
+    'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => $baseDir.'/../lib/SystemTag/SystemTagsObjectMappingCollection.php',
258
+    'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => $baseDir.'/../lib/SystemTag/SystemTagsObjectTypeCollection.php',
259
+    'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => $baseDir.'/../lib/SystemTag/SystemTagsRelationsCollection.php',
260
+    'OCA\\DAV\\Traits\\PrincipalProxyTrait' => $baseDir.'/../lib/Traits/PrincipalProxyTrait.php',
261
+    'OCA\\DAV\\Upload\\AssemblyStream' => $baseDir.'/../lib/Upload/AssemblyStream.php',
262
+    'OCA\\DAV\\Upload\\ChunkingPlugin' => $baseDir.'/../lib/Upload/ChunkingPlugin.php',
263
+    'OCA\\DAV\\Upload\\CleanupService' => $baseDir.'/../lib/Upload/CleanupService.php',
264
+    'OCA\\DAV\\Upload\\FutureFile' => $baseDir.'/../lib/Upload/FutureFile.php',
265
+    'OCA\\DAV\\Upload\\RootCollection' => $baseDir.'/../lib/Upload/RootCollection.php',
266
+    'OCA\\DAV\\Upload\\UploadFile' => $baseDir.'/../lib/Upload/UploadFile.php',
267
+    'OCA\\DAV\\Upload\\UploadFolder' => $baseDir.'/../lib/Upload/UploadFolder.php',
268
+    'OCA\\DAV\\Upload\\UploadHome' => $baseDir.'/../lib/Upload/UploadHome.php',
269 269
 );
Please login to merge, or discard this patch.
apps/dav/composer/composer/autoload_static.php 1 patch
Spacing   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -6,286 +6,286 @@
 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\\CleanupDirectLinksJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupDirectLinksJob.php',
32
-        'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupInvitationTokenJob.php',
33
-        'OCA\\DAV\\BackgroundJob\\EventReminderJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/EventReminderJob.php',
34
-        'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php',
35
-        'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/RefreshWebcalJob.php',
36
-        'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => __DIR__ . '/..' . '/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php',
37
-        'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php',
38
-        'OCA\\DAV\\BackgroundJob\\UploadCleanup' => __DIR__ . '/..' . '/../lib/BackgroundJob/UploadCleanup.php',
39
-        'OCA\\DAV\\CalDAV\\Activity\\Backend' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Backend.php',
40
-        'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Filter/Calendar.php',
41
-        'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Filter/Todo.php',
42
-        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Base.php',
43
-        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Calendar.php',
44
-        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Event.php',
45
-        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Todo.php',
46
-        'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/CalDAVSetting.php',
47
-        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Calendar.php',
48
-        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Event.php',
49
-        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Todo.php',
50
-        'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => __DIR__ . '/..' . '/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php',
51
-        'OCA\\DAV\\CalDAV\\BirthdayService' => __DIR__ . '/..' . '/../lib/CalDAV/BirthdayService.php',
52
-        'OCA\\DAV\\CalDAV\\CachedSubscription' => __DIR__ . '/..' . '/../lib/CalDAV/CachedSubscription.php',
53
-        'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => __DIR__ . '/..' . '/../lib/CalDAV/CachedSubscriptionObject.php',
54
-        'OCA\\DAV\\CalDAV\\CalDavBackend' => __DIR__ . '/..' . '/../lib/CalDAV/CalDavBackend.php',
55
-        'OCA\\DAV\\CalDAV\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Calendar.php',
56
-        'OCA\\DAV\\CalDAV\\CalendarHome' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarHome.php',
57
-        'OCA\\DAV\\CalDAV\\CalendarImpl' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarImpl.php',
58
-        'OCA\\DAV\\CalDAV\\CalendarManager' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarManager.php',
59
-        'OCA\\DAV\\CalDAV\\CalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarObject.php',
60
-        'OCA\\DAV\\CalDAV\\CalendarRoot' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarRoot.php',
61
-        'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
62
-        'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => __DIR__ . '/..' . '/../lib/CalDAV/Integration/ExternalCalendar.php',
63
-        'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Integration/ICalendarProvider.php',
64
-        'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => __DIR__ . '/..' . '/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php',
65
-        'OCA\\DAV\\CalDAV\\Outbox' => __DIR__ . '/..' . '/../lib/CalDAV/Outbox.php',
66
-        'OCA\\DAV\\CalDAV\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/Plugin.php',
67
-        'OCA\\DAV\\CalDAV\\Principal\\Collection' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/Collection.php',
68
-        'OCA\\DAV\\CalDAV\\Principal\\User' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/User.php',
69
-        'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => __DIR__ . '/..' . '/../lib/CalDAV/Proxy/Proxy.php',
70
-        'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => __DIR__ . '/..' . '/../lib/CalDAV/Proxy/ProxyMapper.php',
71
-        'OCA\\DAV\\CalDAV\\PublicCalendar' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendar.php',
72
-        'OCA\\DAV\\CalDAV\\PublicCalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendarObject.php',
73
-        'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => __DIR__ . '/..' . '/../lib/CalDAV/PublicCalendarRoot.php',
74
-        'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Publishing/PublishPlugin.php',
75
-        'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => __DIR__ . '/..' . '/../lib/CalDAV/Publishing/Xml/Publisher.php',
76
-        'OCA\\DAV\\CalDAV\\Reminder\\Backend' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/Backend.php',
77
-        'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/INotificationProvider.php',
78
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProviderManager.php',
79
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php',
80
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php',
81
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php',
82
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php',
83
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php',
84
-        'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php',
85
-        'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/Notifier.php',
86
-        'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => __DIR__ . '/..' . '/../lib/CalDAV/Reminder/ReminderService.php',
87
-        'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php',
88
-        'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php',
89
-        'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => __DIR__ . '/..' . '/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php',
90
-        'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Schedule/IMipPlugin.php',
91
-        'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/Schedule/Plugin.php',
92
-        'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/Search/SearchPlugin.php',
93
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/CompFilter.php',
94
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php',
95
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php',
96
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php',
97
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/PropFilter.php',
98
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php',
99
-        'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => __DIR__ . '/..' . '/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php',
100
-        'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/WebcalCaching/Plugin.php',
101
-        'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => __DIR__ . '/..' . '/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php',
102
-        'OCA\\DAV\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php',
103
-        'OCA\\DAV\\CardDAV\\AddressBook' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBook.php',
104
-        'OCA\\DAV\\CardDAV\\AddressBookImpl' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBookImpl.php',
105
-        'OCA\\DAV\\CardDAV\\AddressBookRoot' => __DIR__ . '/..' . '/../lib/CardDAV/AddressBookRoot.php',
106
-        'OCA\\DAV\\CardDAV\\CardDavBackend' => __DIR__ . '/..' . '/../lib/CardDAV/CardDavBackend.php',
107
-        'OCA\\DAV\\CardDAV\\ContactsManager' => __DIR__ . '/..' . '/../lib/CardDAV/ContactsManager.php',
108
-        'OCA\\DAV\\CardDAV\\Converter' => __DIR__ . '/..' . '/../lib/CardDAV/Converter.php',
109
-        'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => __DIR__ . '/..' . '/../lib/CardDAV/HasPhotoPlugin.php',
110
-        'OCA\\DAV\\CardDAV\\ImageExportPlugin' => __DIR__ . '/..' . '/../lib/CardDAV/ImageExportPlugin.php',
111
-        'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => __DIR__ . '/..' . '/../lib/CardDAV/Integration/ExternalAddressBook.php',
112
-        'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => __DIR__ . '/..' . '/../lib/CardDAV/Integration/IAddressBookProvider.php',
113
-        'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => __DIR__ . '/..' . '/../lib/CardDAV/MultiGetExportPlugin.php',
114
-        'OCA\\DAV\\CardDAV\\PhotoCache' => __DIR__ . '/..' . '/../lib/CardDAV/PhotoCache.php',
115
-        'OCA\\DAV\\CardDAV\\Plugin' => __DIR__ . '/..' . '/../lib/CardDAV/Plugin.php',
116
-        'OCA\\DAV\\CardDAV\\SyncService' => __DIR__ . '/..' . '/../lib/CardDAV/SyncService.php',
117
-        'OCA\\DAV\\CardDAV\\SystemAddressbook' => __DIR__ . '/..' . '/../lib/CardDAV/SystemAddressbook.php',
118
-        'OCA\\DAV\\CardDAV\\UserAddressBooks' => __DIR__ . '/..' . '/../lib/CardDAV/UserAddressBooks.php',
119
-        'OCA\\DAV\\CardDAV\\Xml\\Groups' => __DIR__ . '/..' . '/../lib/CardDAV/Xml/Groups.php',
120
-        'OCA\\DAV\\Command\\CreateAddressBook' => __DIR__ . '/..' . '/../lib/Command/CreateAddressBook.php',
121
-        'OCA\\DAV\\Command\\CreateCalendar' => __DIR__ . '/..' . '/../lib/Command/CreateCalendar.php',
122
-        'OCA\\DAV\\Command\\ListCalendars' => __DIR__ . '/..' . '/../lib/Command/ListCalendars.php',
123
-        'OCA\\DAV\\Command\\MoveCalendar' => __DIR__ . '/..' . '/../lib/Command/MoveCalendar.php',
124
-        'OCA\\DAV\\Command\\RemoveInvalidShares' => __DIR__ . '/..' . '/../lib/Command/RemoveInvalidShares.php',
125
-        'OCA\\DAV\\Command\\SendEventReminders' => __DIR__ . '/..' . '/../lib/Command/SendEventReminders.php',
126
-        'OCA\\DAV\\Command\\SyncBirthdayCalendar' => __DIR__ . '/..' . '/../lib/Command/SyncBirthdayCalendar.php',
127
-        'OCA\\DAV\\Command\\SyncSystemAddressBook' => __DIR__ . '/..' . '/../lib/Command/SyncSystemAddressBook.php',
128
-        'OCA\\DAV\\Comments\\CommentNode' => __DIR__ . '/..' . '/../lib/Comments/CommentNode.php',
129
-        'OCA\\DAV\\Comments\\CommentsPlugin' => __DIR__ . '/..' . '/../lib/Comments/CommentsPlugin.php',
130
-        'OCA\\DAV\\Comments\\EntityCollection' => __DIR__ . '/..' . '/../lib/Comments/EntityCollection.php',
131
-        'OCA\\DAV\\Comments\\EntityTypeCollection' => __DIR__ . '/..' . '/../lib/Comments/EntityTypeCollection.php',
132
-        'OCA\\DAV\\Comments\\RootCollection' => __DIR__ . '/..' . '/../lib/Comments/RootCollection.php',
133
-        'OCA\\DAV\\Connector\\LegacyDAVACL' => __DIR__ . '/..' . '/../lib/Connector/LegacyDAVACL.php',
134
-        'OCA\\DAV\\Connector\\PublicAuth' => __DIR__ . '/..' . '/../lib/Connector/PublicAuth.php',
135
-        'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/AnonymousOptionsPlugin.php',
136
-        'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/AppEnabledPlugin.php',
137
-        'OCA\\DAV\\Connector\\Sabre\\Auth' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Auth.php',
138
-        'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => __DIR__ . '/..' . '/../lib/Connector/Sabre/BearerAuth.php',
139
-        'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/BlockLegacyClientPlugin.php',
140
-        'OCA\\DAV\\Connector\\Sabre\\CachingTree' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CachingTree.php',
141
-        'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ChecksumList.php',
142
-        'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CommentPropertiesPlugin.php',
143
-        'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php',
144
-        'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/DavAclPlugin.php',
145
-        'OCA\\DAV\\Connector\\Sabre\\Directory' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Directory.php',
146
-        'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/DummyGetResponsePlugin.php',
147
-        'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ExceptionLoggerPlugin.php',
148
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/EntityTooLarge.php',
149
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/FileLocked.php',
150
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/Forbidden.php',
151
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/InvalidPath.php',
152
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php',
153
-        'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php',
154
-        'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FakeLockerPlugin.php',
155
-        'OCA\\DAV\\Connector\\Sabre\\File' => __DIR__ . '/..' . '/../lib/Connector/Sabre/File.php',
156
-        'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FilesPlugin.php',
157
-        'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FilesReportPlugin.php',
158
-        'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/LockPlugin.php',
159
-        'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/MaintenancePlugin.php',
160
-        'OCA\\DAV\\Connector\\Sabre\\Node' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Node.php',
161
-        'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ObjectTree.php',
162
-        'OCA\\DAV\\Connector\\Sabre\\Principal' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Principal.php',
163
-        'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/PropfindCompressionPlugin.php',
164
-        'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/QuotaPlugin.php',
165
-        'OCA\\DAV\\Connector\\Sabre\\Server' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Server.php',
166
-        'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ServerFactory.php',
167
-        'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ShareTypeList.php',
168
-        'OCA\\DAV\\Connector\\Sabre\\ShareeList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ShareeList.php',
169
-        'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/SharesPlugin.php',
170
-        'OCA\\DAV\\Connector\\Sabre\\TagList' => __DIR__ . '/..' . '/../lib/Connector/Sabre/TagList.php',
171
-        'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/TagsPlugin.php',
172
-        'OCA\\DAV\\Controller\\BirthdayCalendarController' => __DIR__ . '/..' . '/../lib/Controller/BirthdayCalendarController.php',
173
-        'OCA\\DAV\\Controller\\DirectController' => __DIR__ . '/..' . '/../lib/Controller/DirectController.php',
174
-        'OCA\\DAV\\Controller\\InvitationResponseController' => __DIR__ . '/..' . '/../lib/Controller/InvitationResponseController.php',
175
-        'OCA\\DAV\\DAV\\CustomPropertiesBackend' => __DIR__ . '/..' . '/../lib/DAV/CustomPropertiesBackend.php',
176
-        'OCA\\DAV\\DAV\\GroupPrincipalBackend' => __DIR__ . '/..' . '/../lib/DAV/GroupPrincipalBackend.php',
177
-        'OCA\\DAV\\DAV\\PublicAuth' => __DIR__ . '/..' . '/../lib/DAV/PublicAuth.php',
178
-        'OCA\\DAV\\DAV\\Sharing\\Backend' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Backend.php',
179
-        'OCA\\DAV\\DAV\\Sharing\\IShareable' => __DIR__ . '/..' . '/../lib/DAV/Sharing/IShareable.php',
180
-        'OCA\\DAV\\DAV\\Sharing\\Plugin' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Plugin.php',
181
-        'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Xml/Invite.php',
182
-        'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => __DIR__ . '/..' . '/../lib/DAV/Sharing/Xml/ShareRequest.php',
183
-        'OCA\\DAV\\DAV\\SystemPrincipalBackend' => __DIR__ . '/..' . '/../lib/DAV/SystemPrincipalBackend.php',
184
-        'OCA\\DAV\\Db\\Direct' => __DIR__ . '/..' . '/../lib/Db/Direct.php',
185
-        'OCA\\DAV\\Db\\DirectMapper' => __DIR__ . '/..' . '/../lib/Db/DirectMapper.php',
186
-        'OCA\\DAV\\Direct\\DirectFile' => __DIR__ . '/..' . '/../lib/Direct/DirectFile.php',
187
-        'OCA\\DAV\\Direct\\DirectHome' => __DIR__ . '/..' . '/../lib/Direct/DirectHome.php',
188
-        'OCA\\DAV\\Direct\\Server' => __DIR__ . '/..' . '/../lib/Direct/Server.php',
189
-        'OCA\\DAV\\Direct\\ServerFactory' => __DIR__ . '/..' . '/../lib/Direct/ServerFactory.php',
190
-        'OCA\\DAV\\Events\\AddressBookCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookCreatedEvent.php',
191
-        'OCA\\DAV\\Events\\AddressBookDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookDeletedEvent.php',
192
-        'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookShareUpdatedEvent.php',
193
-        'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/AddressBookUpdatedEvent.php',
194
-        'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => __DIR__ . '/..' . '/../lib/Events/BeforeFileDirectDownloadedEvent.php',
195
-        'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectCreatedEvent.php',
196
-        'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectDeletedEvent.php',
197
-        'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CachedCalendarObjectUpdatedEvent.php',
198
-        'OCA\\DAV\\Events\\CalendarCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarCreatedEvent.php',
199
-        'OCA\\DAV\\Events\\CalendarDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarDeletedEvent.php',
200
-        'OCA\\DAV\\Events\\CalendarObjectCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarObjectCreatedEvent.php',
201
-        'OCA\\DAV\\Events\\CalendarObjectDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarObjectDeletedEvent.php',
202
-        'OCA\\DAV\\Events\\CalendarObjectUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarObjectUpdatedEvent.php',
203
-        'OCA\\DAV\\Events\\CalendarPublishedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarPublishedEvent.php',
204
-        'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarShareUpdatedEvent.php',
205
-        'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarUnpublishedEvent.php',
206
-        'OCA\\DAV\\Events\\CalendarUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CalendarUpdatedEvent.php',
207
-        'OCA\\DAV\\Events\\CardCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CardCreatedEvent.php',
208
-        'OCA\\DAV\\Events\\CardDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CardDeletedEvent.php',
209
-        'OCA\\DAV\\Events\\CardUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CardUpdatedEvent.php',
210
-        'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => __DIR__ . '/..' . '/../lib/Events/SabrePluginAuthInitEvent.php',
211
-        'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionCreatedEvent.php',
212
-        'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionDeletedEvent.php',
213
-        'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionUpdatedEvent.php',
214
-        'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => __DIR__ . '/..' . '/../lib/Exception/UnsupportedLimitOnInitialSyncException.php',
215
-        'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => __DIR__ . '/..' . '/../lib/Files/BrowserErrorPagePlugin.php',
216
-        'OCA\\DAV\\Files\\FileSearchBackend' => __DIR__ . '/..' . '/../lib/Files/FileSearchBackend.php',
217
-        'OCA\\DAV\\Files\\FilesHome' => __DIR__ . '/..' . '/../lib/Files/FilesHome.php',
218
-        'OCA\\DAV\\Files\\LazySearchBackend' => __DIR__ . '/..' . '/../lib/Files/LazySearchBackend.php',
219
-        'OCA\\DAV\\Files\\RootCollection' => __DIR__ . '/..' . '/../lib/Files/RootCollection.php',
220
-        'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => __DIR__ . '/..' . '/../lib/Files/Sharing/FilesDropPlugin.php',
221
-        'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => __DIR__ . '/..' . '/../lib/Files/Sharing/PublicLinkCheckPlugin.php',
222
-        'OCA\\DAV\\HookManager' => __DIR__ . '/..' . '/../lib/HookManager.php',
223
-        'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarContactInteractionListener.php',
224
-        'OCA\\DAV\\Listener\\CalendarDeletionActivityUpdaterListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarDeletionActivityUpdaterListener.php',
225
-        'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php',
226
-        'OCA\\DAV\\Listener\\CalendarDeletionReminderUpdaterListener' => __DIR__ . '/..' . '/../lib/Listener/CalendarDeletionReminderUpdaterListener.php',
227
-        'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => __DIR__ . '/..' . '/../lib/Migration/BuildCalendarSearchIndex.php',
228
-        'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php',
229
-        'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => __DIR__ . '/..' . '/../lib/Migration/BuildSocialSearchIndex.php',
230
-        'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php',
231
-        'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => __DIR__ . '/..' . '/../lib/Migration/CalDAVRemoveEmptyValue.php',
232
-        'OCA\\DAV\\Migration\\ChunkCleanup' => __DIR__ . '/..' . '/../lib/Migration/ChunkCleanup.php',
233
-        'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => __DIR__ . '/..' . '/../lib/Migration/FixBirthdayCalendarComponent.php',
234
-        'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => __DIR__ . '/..' . '/../lib/Migration/RefreshWebcalJobRegistrar.php',
235
-        'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => __DIR__ . '/..' . '/../lib/Migration/RegenerateBirthdayCalendars.php',
236
-        'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php',
237
-        'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => __DIR__ . '/..' . '/../lib/Migration/RemoveClassifiedEventActivity.php',
238
-        'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => __DIR__ . '/..' . '/../lib/Migration/RemoveOrphanEventsAndContacts.php',
239
-        'OCA\\DAV\\Migration\\Version1004Date20170825134824' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170825134824.php',
240
-        'OCA\\DAV\\Migration\\Version1004Date20170919104507' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170919104507.php',
241
-        'OCA\\DAV\\Migration\\Version1004Date20170924124212' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170924124212.php',
242
-        'OCA\\DAV\\Migration\\Version1004Date20170926103422' => __DIR__ . '/..' . '/../lib/Migration/Version1004Date20170926103422.php',
243
-        'OCA\\DAV\\Migration\\Version1005Date20180413093149' => __DIR__ . '/..' . '/../lib/Migration/Version1005Date20180413093149.php',
244
-        'OCA\\DAV\\Migration\\Version1005Date20180530124431' => __DIR__ . '/..' . '/../lib/Migration/Version1005Date20180530124431.php',
245
-        'OCA\\DAV\\Migration\\Version1006Date20180619154313' => __DIR__ . '/..' . '/../lib/Migration/Version1006Date20180619154313.php',
246
-        'OCA\\DAV\\Migration\\Version1006Date20180628111625' => __DIR__ . '/..' . '/../lib/Migration/Version1006Date20180628111625.php',
247
-        'OCA\\DAV\\Migration\\Version1008Date20181030113700' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181030113700.php',
248
-        'OCA\\DAV\\Migration\\Version1008Date20181105104826' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105104826.php',
249
-        'OCA\\DAV\\Migration\\Version1008Date20181105104833' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105104833.php',
250
-        'OCA\\DAV\\Migration\\Version1008Date20181105110300' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105110300.php',
251
-        'OCA\\DAV\\Migration\\Version1008Date20181105112049' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181105112049.php',
252
-        'OCA\\DAV\\Migration\\Version1008Date20181114084440' => __DIR__ . '/..' . '/../lib/Migration/Version1008Date20181114084440.php',
253
-        'OCA\\DAV\\Migration\\Version1011Date20190725113607' => __DIR__ . '/..' . '/../lib/Migration/Version1011Date20190725113607.php',
254
-        'OCA\\DAV\\Migration\\Version1011Date20190806104428' => __DIR__ . '/..' . '/../lib/Migration/Version1011Date20190806104428.php',
255
-        'OCA\\DAV\\Migration\\Version1012Date20190808122342' => __DIR__ . '/..' . '/../lib/Migration/Version1012Date20190808122342.php',
256
-        'OCA\\DAV\\Migration\\Version1016Date20201109085907' => __DIR__ . '/..' . '/../lib/Migration/Version1016Date20201109085907.php',
257
-        'OCA\\DAV\\Migration\\Version1017Date20210216083742' => __DIR__ . '/..' . '/../lib/Migration/Version1017Date20210216083742.php',
258
-        'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => __DIR__ . '/..' . '/../lib/Provisioning/Apple/AppleProvisioningNode.php',
259
-        'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => __DIR__ . '/..' . '/../lib/Provisioning/Apple/AppleProvisioningPlugin.php',
260
-        'OCA\\DAV\\RootCollection' => __DIR__ . '/..' . '/../lib/RootCollection.php',
261
-        'OCA\\DAV\\Search\\ACalendarSearchProvider' => __DIR__ . '/..' . '/../lib/Search/ACalendarSearchProvider.php',
262
-        'OCA\\DAV\\Search\\ContactsSearchProvider' => __DIR__ . '/..' . '/../lib/Search/ContactsSearchProvider.php',
263
-        'OCA\\DAV\\Search\\EventsSearchProvider' => __DIR__ . '/..' . '/../lib/Search/EventsSearchProvider.php',
264
-        'OCA\\DAV\\Search\\TasksSearchProvider' => __DIR__ . '/..' . '/../lib/Search/TasksSearchProvider.php',
265
-        'OCA\\DAV\\Server' => __DIR__ . '/..' . '/../lib/Server.php',
266
-        'OCA\\DAV\\Settings\\CalDAVSettings' => __DIR__ . '/..' . '/../lib/Settings/CalDAVSettings.php',
267
-        'OCA\\DAV\\Storage\\PublicOwnerWrapper' => __DIR__ . '/..' . '/../lib/Storage/PublicOwnerWrapper.php',
268
-        'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagMappingNode.php',
269
-        'OCA\\DAV\\SystemTag\\SystemTagNode' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagNode.php',
270
-        'OCA\\DAV\\SystemTag\\SystemTagPlugin' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagPlugin.php',
271
-        'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsByIdCollection.php',
272
-        'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsObjectMappingCollection.php',
273
-        'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsObjectTypeCollection.php',
274
-        'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => __DIR__ . '/..' . '/../lib/SystemTag/SystemTagsRelationsCollection.php',
275
-        'OCA\\DAV\\Traits\\PrincipalProxyTrait' => __DIR__ . '/..' . '/../lib/Traits/PrincipalProxyTrait.php',
276
-        'OCA\\DAV\\Upload\\AssemblyStream' => __DIR__ . '/..' . '/../lib/Upload/AssemblyStream.php',
277
-        'OCA\\DAV\\Upload\\ChunkingPlugin' => __DIR__ . '/..' . '/../lib/Upload/ChunkingPlugin.php',
278
-        'OCA\\DAV\\Upload\\CleanupService' => __DIR__ . '/..' . '/../lib/Upload/CleanupService.php',
279
-        'OCA\\DAV\\Upload\\FutureFile' => __DIR__ . '/..' . '/../lib/Upload/FutureFile.php',
280
-        'OCA\\DAV\\Upload\\RootCollection' => __DIR__ . '/..' . '/../lib/Upload/RootCollection.php',
281
-        'OCA\\DAV\\Upload\\UploadFile' => __DIR__ . '/..' . '/../lib/Upload/UploadFile.php',
282
-        'OCA\\DAV\\Upload\\UploadFolder' => __DIR__ . '/..' . '/../lib/Upload/UploadFolder.php',
283
-        'OCA\\DAV\\Upload\\UploadHome' => __DIR__ . '/..' . '/../lib/Upload/UploadHome.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\\CleanupDirectLinksJob' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupDirectLinksJob.php',
32
+        'OCA\\DAV\\BackgroundJob\\CleanupInvitationTokenJob' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupInvitationTokenJob.php',
33
+        'OCA\\DAV\\BackgroundJob\\EventReminderJob' => __DIR__.'/..'.'/../lib/BackgroundJob/EventReminderJob.php',
34
+        'OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob' => __DIR__.'/..'.'/../lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php',
35
+        'OCA\\DAV\\BackgroundJob\\RefreshWebcalJob' => __DIR__.'/..'.'/../lib/BackgroundJob/RefreshWebcalJob.php',
36
+        'OCA\\DAV\\BackgroundJob\\RegisterRegenerateBirthdayCalendars' => __DIR__.'/..'.'/../lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php',
37
+        'OCA\\DAV\\BackgroundJob\\UpdateCalendarResourcesRoomsBackgroundJob' => __DIR__.'/..'.'/../lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php',
38
+        'OCA\\DAV\\BackgroundJob\\UploadCleanup' => __DIR__.'/..'.'/../lib/BackgroundJob/UploadCleanup.php',
39
+        'OCA\\DAV\\CalDAV\\Activity\\Backend' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Backend.php',
40
+        'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Filter/Calendar.php',
41
+        'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Filter/Todo.php',
42
+        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Base.php',
43
+        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Calendar.php',
44
+        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Event.php',
45
+        'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Provider/Todo.php',
46
+        'OCA\\DAV\\CalDAV\\Activity\\Setting\\CalDAVSetting' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/CalDAVSetting.php',
47
+        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Calendar.php',
48
+        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Event.php',
49
+        'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => __DIR__.'/..'.'/../lib/CalDAV/Activity/Setting/Todo.php',
50
+        'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => __DIR__.'/..'.'/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php',
51
+        'OCA\\DAV\\CalDAV\\BirthdayService' => __DIR__.'/..'.'/../lib/CalDAV/BirthdayService.php',
52
+        'OCA\\DAV\\CalDAV\\CachedSubscription' => __DIR__.'/..'.'/../lib/CalDAV/CachedSubscription.php',
53
+        'OCA\\DAV\\CalDAV\\CachedSubscriptionObject' => __DIR__.'/..'.'/../lib/CalDAV/CachedSubscriptionObject.php',
54
+        'OCA\\DAV\\CalDAV\\CalDavBackend' => __DIR__.'/..'.'/../lib/CalDAV/CalDavBackend.php',
55
+        'OCA\\DAV\\CalDAV\\Calendar' => __DIR__.'/..'.'/../lib/CalDAV/Calendar.php',
56
+        'OCA\\DAV\\CalDAV\\CalendarHome' => __DIR__.'/..'.'/../lib/CalDAV/CalendarHome.php',
57
+        'OCA\\DAV\\CalDAV\\CalendarImpl' => __DIR__.'/..'.'/../lib/CalDAV/CalendarImpl.php',
58
+        'OCA\\DAV\\CalDAV\\CalendarManager' => __DIR__.'/..'.'/../lib/CalDAV/CalendarManager.php',
59
+        'OCA\\DAV\\CalDAV\\CalendarObject' => __DIR__.'/..'.'/../lib/CalDAV/CalendarObject.php',
60
+        'OCA\\DAV\\CalDAV\\CalendarRoot' => __DIR__.'/..'.'/../lib/CalDAV/CalendarRoot.php',
61
+        'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => __DIR__.'/..'.'/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
62
+        'OCA\\DAV\\CalDAV\\Integration\\ExternalCalendar' => __DIR__.'/..'.'/../lib/CalDAV/Integration/ExternalCalendar.php',
63
+        'OCA\\DAV\\CalDAV\\Integration\\ICalendarProvider' => __DIR__.'/..'.'/../lib/CalDAV/Integration/ICalendarProvider.php',
64
+        'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => __DIR__.'/..'.'/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php',
65
+        'OCA\\DAV\\CalDAV\\Outbox' => __DIR__.'/..'.'/../lib/CalDAV/Outbox.php',
66
+        'OCA\\DAV\\CalDAV\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/Plugin.php',
67
+        'OCA\\DAV\\CalDAV\\Principal\\Collection' => __DIR__.'/..'.'/../lib/CalDAV/Principal/Collection.php',
68
+        'OCA\\DAV\\CalDAV\\Principal\\User' => __DIR__.'/..'.'/../lib/CalDAV/Principal/User.php',
69
+        'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => __DIR__.'/..'.'/../lib/CalDAV/Proxy/Proxy.php',
70
+        'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => __DIR__.'/..'.'/../lib/CalDAV/Proxy/ProxyMapper.php',
71
+        'OCA\\DAV\\CalDAV\\PublicCalendar' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendar.php',
72
+        'OCA\\DAV\\CalDAV\\PublicCalendarObject' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendarObject.php',
73
+        'OCA\\DAV\\CalDAV\\PublicCalendarRoot' => __DIR__.'/..'.'/../lib/CalDAV/PublicCalendarRoot.php',
74
+        'OCA\\DAV\\CalDAV\\Publishing\\PublishPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Publishing/PublishPlugin.php',
75
+        'OCA\\DAV\\CalDAV\\Publishing\\Xml\\Publisher' => __DIR__.'/..'.'/../lib/CalDAV/Publishing/Xml/Publisher.php',
76
+        'OCA\\DAV\\CalDAV\\Reminder\\Backend' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/Backend.php',
77
+        'OCA\\DAV\\CalDAV\\Reminder\\INotificationProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/INotificationProvider.php',
78
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProviderManager' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProviderManager.php',
79
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AbstractProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php',
80
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\AudioProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php',
81
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\EmailProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php',
82
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\ProviderNotAvailableException' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php',
83
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationProvider\\PushProvider' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationProvider/PushProvider.php',
84
+        'OCA\\DAV\\CalDAV\\Reminder\\NotificationTypeDoesNotExistException' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php',
85
+        'OCA\\DAV\\CalDAV\\Reminder\\Notifier' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/Notifier.php',
86
+        'OCA\\DAV\\CalDAV\\Reminder\\ReminderService' => __DIR__.'/..'.'/../lib/CalDAV/Reminder/ReminderService.php',
87
+        'OCA\\DAV\\CalDAV\\ResourceBooking\\AbstractPrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php',
88
+        'OCA\\DAV\\CalDAV\\ResourceBooking\\ResourcePrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php',
89
+        'OCA\\DAV\\CalDAV\\ResourceBooking\\RoomPrincipalBackend' => __DIR__.'/..'.'/../lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php',
90
+        'OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Schedule/IMipPlugin.php',
91
+        'OCA\\DAV\\CalDAV\\Schedule\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/Schedule/Plugin.php',
92
+        'OCA\\DAV\\CalDAV\\Search\\SearchPlugin' => __DIR__.'/..'.'/../lib/CalDAV/Search/SearchPlugin.php',
93
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/CompFilter.php',
94
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/LimitFilter.php',
95
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/OffsetFilter.php',
96
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/ParamFilter.php',
97
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/PropFilter.php',
98
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php',
99
+        'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' => __DIR__.'/..'.'/../lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php',
100
+        'OCA\\DAV\\CalDAV\\WebcalCaching\\Plugin' => __DIR__.'/..'.'/../lib/CalDAV/WebcalCaching/Plugin.php',
101
+        'OCA\\DAV\\CalDAV\\WebcalCaching\\RefreshWebcalService' => __DIR__.'/..'.'/../lib/CalDAV/WebcalCaching/RefreshWebcalService.php',
102
+        'OCA\\DAV\\Capabilities' => __DIR__.'/..'.'/../lib/Capabilities.php',
103
+        'OCA\\DAV\\CardDAV\\AddressBook' => __DIR__.'/..'.'/../lib/CardDAV/AddressBook.php',
104
+        'OCA\\DAV\\CardDAV\\AddressBookImpl' => __DIR__.'/..'.'/../lib/CardDAV/AddressBookImpl.php',
105
+        'OCA\\DAV\\CardDAV\\AddressBookRoot' => __DIR__.'/..'.'/../lib/CardDAV/AddressBookRoot.php',
106
+        'OCA\\DAV\\CardDAV\\CardDavBackend' => __DIR__.'/..'.'/../lib/CardDAV/CardDavBackend.php',
107
+        'OCA\\DAV\\CardDAV\\ContactsManager' => __DIR__.'/..'.'/../lib/CardDAV/ContactsManager.php',
108
+        'OCA\\DAV\\CardDAV\\Converter' => __DIR__.'/..'.'/../lib/CardDAV/Converter.php',
109
+        'OCA\\DAV\\CardDAV\\HasPhotoPlugin' => __DIR__.'/..'.'/../lib/CardDAV/HasPhotoPlugin.php',
110
+        'OCA\\DAV\\CardDAV\\ImageExportPlugin' => __DIR__.'/..'.'/../lib/CardDAV/ImageExportPlugin.php',
111
+        'OCA\\DAV\\CardDAV\\Integration\\ExternalAddressBook' => __DIR__.'/..'.'/../lib/CardDAV/Integration/ExternalAddressBook.php',
112
+        'OCA\\DAV\\CardDAV\\Integration\\IAddressBookProvider' => __DIR__.'/..'.'/../lib/CardDAV/Integration/IAddressBookProvider.php',
113
+        'OCA\\DAV\\CardDAV\\MultiGetExportPlugin' => __DIR__.'/..'.'/../lib/CardDAV/MultiGetExportPlugin.php',
114
+        'OCA\\DAV\\CardDAV\\PhotoCache' => __DIR__.'/..'.'/../lib/CardDAV/PhotoCache.php',
115
+        'OCA\\DAV\\CardDAV\\Plugin' => __DIR__.'/..'.'/../lib/CardDAV/Plugin.php',
116
+        'OCA\\DAV\\CardDAV\\SyncService' => __DIR__.'/..'.'/../lib/CardDAV/SyncService.php',
117
+        'OCA\\DAV\\CardDAV\\SystemAddressbook' => __DIR__.'/..'.'/../lib/CardDAV/SystemAddressbook.php',
118
+        'OCA\\DAV\\CardDAV\\UserAddressBooks' => __DIR__.'/..'.'/../lib/CardDAV/UserAddressBooks.php',
119
+        'OCA\\DAV\\CardDAV\\Xml\\Groups' => __DIR__.'/..'.'/../lib/CardDAV/Xml/Groups.php',
120
+        'OCA\\DAV\\Command\\CreateAddressBook' => __DIR__.'/..'.'/../lib/Command/CreateAddressBook.php',
121
+        'OCA\\DAV\\Command\\CreateCalendar' => __DIR__.'/..'.'/../lib/Command/CreateCalendar.php',
122
+        'OCA\\DAV\\Command\\ListCalendars' => __DIR__.'/..'.'/../lib/Command/ListCalendars.php',
123
+        'OCA\\DAV\\Command\\MoveCalendar' => __DIR__.'/..'.'/../lib/Command/MoveCalendar.php',
124
+        'OCA\\DAV\\Command\\RemoveInvalidShares' => __DIR__.'/..'.'/../lib/Command/RemoveInvalidShares.php',
125
+        'OCA\\DAV\\Command\\SendEventReminders' => __DIR__.'/..'.'/../lib/Command/SendEventReminders.php',
126
+        'OCA\\DAV\\Command\\SyncBirthdayCalendar' => __DIR__.'/..'.'/../lib/Command/SyncBirthdayCalendar.php',
127
+        'OCA\\DAV\\Command\\SyncSystemAddressBook' => __DIR__.'/..'.'/../lib/Command/SyncSystemAddressBook.php',
128
+        'OCA\\DAV\\Comments\\CommentNode' => __DIR__.'/..'.'/../lib/Comments/CommentNode.php',
129
+        'OCA\\DAV\\Comments\\CommentsPlugin' => __DIR__.'/..'.'/../lib/Comments/CommentsPlugin.php',
130
+        'OCA\\DAV\\Comments\\EntityCollection' => __DIR__.'/..'.'/../lib/Comments/EntityCollection.php',
131
+        'OCA\\DAV\\Comments\\EntityTypeCollection' => __DIR__.'/..'.'/../lib/Comments/EntityTypeCollection.php',
132
+        'OCA\\DAV\\Comments\\RootCollection' => __DIR__.'/..'.'/../lib/Comments/RootCollection.php',
133
+        'OCA\\DAV\\Connector\\LegacyDAVACL' => __DIR__.'/..'.'/../lib/Connector/LegacyDAVACL.php',
134
+        'OCA\\DAV\\Connector\\PublicAuth' => __DIR__.'/..'.'/../lib/Connector/PublicAuth.php',
135
+        'OCA\\DAV\\Connector\\Sabre\\AnonymousOptionsPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/AnonymousOptionsPlugin.php',
136
+        'OCA\\DAV\\Connector\\Sabre\\AppEnabledPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/AppEnabledPlugin.php',
137
+        'OCA\\DAV\\Connector\\Sabre\\Auth' => __DIR__.'/..'.'/../lib/Connector/Sabre/Auth.php',
138
+        'OCA\\DAV\\Connector\\Sabre\\BearerAuth' => __DIR__.'/..'.'/../lib/Connector/Sabre/BearerAuth.php',
139
+        'OCA\\DAV\\Connector\\Sabre\\BlockLegacyClientPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/BlockLegacyClientPlugin.php',
140
+        'OCA\\DAV\\Connector\\Sabre\\CachingTree' => __DIR__.'/..'.'/../lib/Connector/Sabre/CachingTree.php',
141
+        'OCA\\DAV\\Connector\\Sabre\\ChecksumList' => __DIR__.'/..'.'/../lib/Connector/Sabre/ChecksumList.php',
142
+        'OCA\\DAV\\Connector\\Sabre\\CommentPropertiesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/CommentPropertiesPlugin.php',
143
+        'OCA\\DAV\\Connector\\Sabre\\CopyEtagHeaderPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/CopyEtagHeaderPlugin.php',
144
+        'OCA\\DAV\\Connector\\Sabre\\DavAclPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/DavAclPlugin.php',
145
+        'OCA\\DAV\\Connector\\Sabre\\Directory' => __DIR__.'/..'.'/../lib/Connector/Sabre/Directory.php',
146
+        'OCA\\DAV\\Connector\\Sabre\\DummyGetResponsePlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/DummyGetResponsePlugin.php',
147
+        'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/ExceptionLoggerPlugin.php',
148
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\EntityTooLarge' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/EntityTooLarge.php',
149
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/FileLocked.php',
150
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/Forbidden.php',
151
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/InvalidPath.php',
152
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php',
153
+        'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => __DIR__.'/..'.'/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php',
154
+        'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FakeLockerPlugin.php',
155
+        'OCA\\DAV\\Connector\\Sabre\\File' => __DIR__.'/..'.'/../lib/Connector/Sabre/File.php',
156
+        'OCA\\DAV\\Connector\\Sabre\\FilesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FilesPlugin.php',
157
+        'OCA\\DAV\\Connector\\Sabre\\FilesReportPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/FilesReportPlugin.php',
158
+        'OCA\\DAV\\Connector\\Sabre\\LockPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/LockPlugin.php',
159
+        'OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/MaintenancePlugin.php',
160
+        'OCA\\DAV\\Connector\\Sabre\\Node' => __DIR__.'/..'.'/../lib/Connector/Sabre/Node.php',
161
+        'OCA\\DAV\\Connector\\Sabre\\ObjectTree' => __DIR__.'/..'.'/../lib/Connector/Sabre/ObjectTree.php',
162
+        'OCA\\DAV\\Connector\\Sabre\\Principal' => __DIR__.'/..'.'/../lib/Connector/Sabre/Principal.php',
163
+        'OCA\\DAV\\Connector\\Sabre\\PropfindCompressionPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/PropfindCompressionPlugin.php',
164
+        'OCA\\DAV\\Connector\\Sabre\\QuotaPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/QuotaPlugin.php',
165
+        'OCA\\DAV\\Connector\\Sabre\\Server' => __DIR__.'/..'.'/../lib/Connector/Sabre/Server.php',
166
+        'OCA\\DAV\\Connector\\Sabre\\ServerFactory' => __DIR__.'/..'.'/../lib/Connector/Sabre/ServerFactory.php',
167
+        'OCA\\DAV\\Connector\\Sabre\\ShareTypeList' => __DIR__.'/..'.'/../lib/Connector/Sabre/ShareTypeList.php',
168
+        'OCA\\DAV\\Connector\\Sabre\\ShareeList' => __DIR__.'/..'.'/../lib/Connector/Sabre/ShareeList.php',
169
+        'OCA\\DAV\\Connector\\Sabre\\SharesPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/SharesPlugin.php',
170
+        'OCA\\DAV\\Connector\\Sabre\\TagList' => __DIR__.'/..'.'/../lib/Connector/Sabre/TagList.php',
171
+        'OCA\\DAV\\Connector\\Sabre\\TagsPlugin' => __DIR__.'/..'.'/../lib/Connector/Sabre/TagsPlugin.php',
172
+        'OCA\\DAV\\Controller\\BirthdayCalendarController' => __DIR__.'/..'.'/../lib/Controller/BirthdayCalendarController.php',
173
+        'OCA\\DAV\\Controller\\DirectController' => __DIR__.'/..'.'/../lib/Controller/DirectController.php',
174
+        'OCA\\DAV\\Controller\\InvitationResponseController' => __DIR__.'/..'.'/../lib/Controller/InvitationResponseController.php',
175
+        'OCA\\DAV\\DAV\\CustomPropertiesBackend' => __DIR__.'/..'.'/../lib/DAV/CustomPropertiesBackend.php',
176
+        'OCA\\DAV\\DAV\\GroupPrincipalBackend' => __DIR__.'/..'.'/../lib/DAV/GroupPrincipalBackend.php',
177
+        'OCA\\DAV\\DAV\\PublicAuth' => __DIR__.'/..'.'/../lib/DAV/PublicAuth.php',
178
+        'OCA\\DAV\\DAV\\Sharing\\Backend' => __DIR__.'/..'.'/../lib/DAV/Sharing/Backend.php',
179
+        'OCA\\DAV\\DAV\\Sharing\\IShareable' => __DIR__.'/..'.'/../lib/DAV/Sharing/IShareable.php',
180
+        'OCA\\DAV\\DAV\\Sharing\\Plugin' => __DIR__.'/..'.'/../lib/DAV/Sharing/Plugin.php',
181
+        'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite' => __DIR__.'/..'.'/../lib/DAV/Sharing/Xml/Invite.php',
182
+        'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest' => __DIR__.'/..'.'/../lib/DAV/Sharing/Xml/ShareRequest.php',
183
+        'OCA\\DAV\\DAV\\SystemPrincipalBackend' => __DIR__.'/..'.'/../lib/DAV/SystemPrincipalBackend.php',
184
+        'OCA\\DAV\\Db\\Direct' => __DIR__.'/..'.'/../lib/Db/Direct.php',
185
+        'OCA\\DAV\\Db\\DirectMapper' => __DIR__.'/..'.'/../lib/Db/DirectMapper.php',
186
+        'OCA\\DAV\\Direct\\DirectFile' => __DIR__.'/..'.'/../lib/Direct/DirectFile.php',
187
+        'OCA\\DAV\\Direct\\DirectHome' => __DIR__.'/..'.'/../lib/Direct/DirectHome.php',
188
+        'OCA\\DAV\\Direct\\Server' => __DIR__.'/..'.'/../lib/Direct/Server.php',
189
+        'OCA\\DAV\\Direct\\ServerFactory' => __DIR__.'/..'.'/../lib/Direct/ServerFactory.php',
190
+        'OCA\\DAV\\Events\\AddressBookCreatedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookCreatedEvent.php',
191
+        'OCA\\DAV\\Events\\AddressBookDeletedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookDeletedEvent.php',
192
+        'OCA\\DAV\\Events\\AddressBookShareUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookShareUpdatedEvent.php',
193
+        'OCA\\DAV\\Events\\AddressBookUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/AddressBookUpdatedEvent.php',
194
+        'OCA\\DAV\\Events\\BeforeFileDirectDownloadedEvent' => __DIR__.'/..'.'/../lib/Events/BeforeFileDirectDownloadedEvent.php',
195
+        'OCA\\DAV\\Events\\CachedCalendarObjectCreatedEvent' => __DIR__.'/..'.'/../lib/Events/CachedCalendarObjectCreatedEvent.php',
196
+        'OCA\\DAV\\Events\\CachedCalendarObjectDeletedEvent' => __DIR__.'/..'.'/../lib/Events/CachedCalendarObjectDeletedEvent.php',
197
+        'OCA\\DAV\\Events\\CachedCalendarObjectUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CachedCalendarObjectUpdatedEvent.php',
198
+        'OCA\\DAV\\Events\\CalendarCreatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarCreatedEvent.php',
199
+        'OCA\\DAV\\Events\\CalendarDeletedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarDeletedEvent.php',
200
+        'OCA\\DAV\\Events\\CalendarObjectCreatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarObjectCreatedEvent.php',
201
+        'OCA\\DAV\\Events\\CalendarObjectDeletedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarObjectDeletedEvent.php',
202
+        'OCA\\DAV\\Events\\CalendarObjectUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarObjectUpdatedEvent.php',
203
+        'OCA\\DAV\\Events\\CalendarPublishedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarPublishedEvent.php',
204
+        'OCA\\DAV\\Events\\CalendarShareUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarShareUpdatedEvent.php',
205
+        'OCA\\DAV\\Events\\CalendarUnpublishedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarUnpublishedEvent.php',
206
+        'OCA\\DAV\\Events\\CalendarUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CalendarUpdatedEvent.php',
207
+        'OCA\\DAV\\Events\\CardCreatedEvent' => __DIR__.'/..'.'/../lib/Events/CardCreatedEvent.php',
208
+        'OCA\\DAV\\Events\\CardDeletedEvent' => __DIR__.'/..'.'/../lib/Events/CardDeletedEvent.php',
209
+        'OCA\\DAV\\Events\\CardUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/CardUpdatedEvent.php',
210
+        'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => __DIR__.'/..'.'/../lib/Events/SabrePluginAuthInitEvent.php',
211
+        'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => __DIR__.'/..'.'/../lib/Events/SubscriptionCreatedEvent.php',
212
+        'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => __DIR__.'/..'.'/../lib/Events/SubscriptionDeletedEvent.php',
213
+        'OCA\\DAV\\Events\\SubscriptionUpdatedEvent' => __DIR__.'/..'.'/../lib/Events/SubscriptionUpdatedEvent.php',
214
+        'OCA\\DAV\\Exception\\UnsupportedLimitOnInitialSyncException' => __DIR__.'/..'.'/../lib/Exception/UnsupportedLimitOnInitialSyncException.php',
215
+        'OCA\\DAV\\Files\\BrowserErrorPagePlugin' => __DIR__.'/..'.'/../lib/Files/BrowserErrorPagePlugin.php',
216
+        'OCA\\DAV\\Files\\FileSearchBackend' => __DIR__.'/..'.'/../lib/Files/FileSearchBackend.php',
217
+        'OCA\\DAV\\Files\\FilesHome' => __DIR__.'/..'.'/../lib/Files/FilesHome.php',
218
+        'OCA\\DAV\\Files\\LazySearchBackend' => __DIR__.'/..'.'/../lib/Files/LazySearchBackend.php',
219
+        'OCA\\DAV\\Files\\RootCollection' => __DIR__.'/..'.'/../lib/Files/RootCollection.php',
220
+        'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => __DIR__.'/..'.'/../lib/Files/Sharing/FilesDropPlugin.php',
221
+        'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => __DIR__.'/..'.'/../lib/Files/Sharing/PublicLinkCheckPlugin.php',
222
+        'OCA\\DAV\\HookManager' => __DIR__.'/..'.'/../lib/HookManager.php',
223
+        'OCA\\DAV\\Listener\\CalendarContactInteractionListener' => __DIR__.'/..'.'/../lib/Listener/CalendarContactInteractionListener.php',
224
+        'OCA\\DAV\\Listener\\CalendarDeletionActivityUpdaterListener' => __DIR__.'/..'.'/../lib/Listener/CalendarDeletionActivityUpdaterListener.php',
225
+        'OCA\\DAV\\Listener\\CalendarDeletionDefaultUpdaterListener' => __DIR__.'/..'.'/../lib/Listener/CalendarDeletionDefaultUpdaterListener.php',
226
+        'OCA\\DAV\\Listener\\CalendarDeletionReminderUpdaterListener' => __DIR__.'/..'.'/../lib/Listener/CalendarDeletionReminderUpdaterListener.php',
227
+        'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => __DIR__.'/..'.'/../lib/Migration/BuildCalendarSearchIndex.php',
228
+        'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => __DIR__.'/..'.'/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php',
229
+        'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => __DIR__.'/..'.'/../lib/Migration/BuildSocialSearchIndex.php',
230
+        'OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob' => __DIR__.'/..'.'/../lib/Migration/BuildSocialSearchIndexBackgroundJob.php',
231
+        'OCA\\DAV\\Migration\\CalDAVRemoveEmptyValue' => __DIR__.'/..'.'/../lib/Migration/CalDAVRemoveEmptyValue.php',
232
+        'OCA\\DAV\\Migration\\ChunkCleanup' => __DIR__.'/..'.'/../lib/Migration/ChunkCleanup.php',
233
+        'OCA\\DAV\\Migration\\FixBirthdayCalendarComponent' => __DIR__.'/..'.'/../lib/Migration/FixBirthdayCalendarComponent.php',
234
+        'OCA\\DAV\\Migration\\RefreshWebcalJobRegistrar' => __DIR__.'/..'.'/../lib/Migration/RefreshWebcalJobRegistrar.php',
235
+        'OCA\\DAV\\Migration\\RegenerateBirthdayCalendars' => __DIR__.'/..'.'/../lib/Migration/RegenerateBirthdayCalendars.php',
236
+        'OCA\\DAV\\Migration\\RegisterBuildReminderIndexBackgroundJob' => __DIR__.'/..'.'/../lib/Migration/RegisterBuildReminderIndexBackgroundJob.php',
237
+        'OCA\\DAV\\Migration\\RemoveClassifiedEventActivity' => __DIR__.'/..'.'/../lib/Migration/RemoveClassifiedEventActivity.php',
238
+        'OCA\\DAV\\Migration\\RemoveOrphanEventsAndContacts' => __DIR__.'/..'.'/../lib/Migration/RemoveOrphanEventsAndContacts.php',
239
+        'OCA\\DAV\\Migration\\Version1004Date20170825134824' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170825134824.php',
240
+        'OCA\\DAV\\Migration\\Version1004Date20170919104507' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170919104507.php',
241
+        'OCA\\DAV\\Migration\\Version1004Date20170924124212' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170924124212.php',
242
+        'OCA\\DAV\\Migration\\Version1004Date20170926103422' => __DIR__.'/..'.'/../lib/Migration/Version1004Date20170926103422.php',
243
+        'OCA\\DAV\\Migration\\Version1005Date20180413093149' => __DIR__.'/..'.'/../lib/Migration/Version1005Date20180413093149.php',
244
+        'OCA\\DAV\\Migration\\Version1005Date20180530124431' => __DIR__.'/..'.'/../lib/Migration/Version1005Date20180530124431.php',
245
+        'OCA\\DAV\\Migration\\Version1006Date20180619154313' => __DIR__.'/..'.'/../lib/Migration/Version1006Date20180619154313.php',
246
+        'OCA\\DAV\\Migration\\Version1006Date20180628111625' => __DIR__.'/..'.'/../lib/Migration/Version1006Date20180628111625.php',
247
+        'OCA\\DAV\\Migration\\Version1008Date20181030113700' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181030113700.php',
248
+        'OCA\\DAV\\Migration\\Version1008Date20181105104826' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105104826.php',
249
+        'OCA\\DAV\\Migration\\Version1008Date20181105104833' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105104833.php',
250
+        'OCA\\DAV\\Migration\\Version1008Date20181105110300' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105110300.php',
251
+        'OCA\\DAV\\Migration\\Version1008Date20181105112049' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181105112049.php',
252
+        'OCA\\DAV\\Migration\\Version1008Date20181114084440' => __DIR__.'/..'.'/../lib/Migration/Version1008Date20181114084440.php',
253
+        'OCA\\DAV\\Migration\\Version1011Date20190725113607' => __DIR__.'/..'.'/../lib/Migration/Version1011Date20190725113607.php',
254
+        'OCA\\DAV\\Migration\\Version1011Date20190806104428' => __DIR__.'/..'.'/../lib/Migration/Version1011Date20190806104428.php',
255
+        'OCA\\DAV\\Migration\\Version1012Date20190808122342' => __DIR__.'/..'.'/../lib/Migration/Version1012Date20190808122342.php',
256
+        'OCA\\DAV\\Migration\\Version1016Date20201109085907' => __DIR__.'/..'.'/../lib/Migration/Version1016Date20201109085907.php',
257
+        'OCA\\DAV\\Migration\\Version1017Date20210216083742' => __DIR__.'/..'.'/../lib/Migration/Version1017Date20210216083742.php',
258
+        'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => __DIR__.'/..'.'/../lib/Provisioning/Apple/AppleProvisioningNode.php',
259
+        'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => __DIR__.'/..'.'/../lib/Provisioning/Apple/AppleProvisioningPlugin.php',
260
+        'OCA\\DAV\\RootCollection' => __DIR__.'/..'.'/../lib/RootCollection.php',
261
+        'OCA\\DAV\\Search\\ACalendarSearchProvider' => __DIR__.'/..'.'/../lib/Search/ACalendarSearchProvider.php',
262
+        'OCA\\DAV\\Search\\ContactsSearchProvider' => __DIR__.'/..'.'/../lib/Search/ContactsSearchProvider.php',
263
+        'OCA\\DAV\\Search\\EventsSearchProvider' => __DIR__.'/..'.'/../lib/Search/EventsSearchProvider.php',
264
+        'OCA\\DAV\\Search\\TasksSearchProvider' => __DIR__.'/..'.'/../lib/Search/TasksSearchProvider.php',
265
+        'OCA\\DAV\\Server' => __DIR__.'/..'.'/../lib/Server.php',
266
+        'OCA\\DAV\\Settings\\CalDAVSettings' => __DIR__.'/..'.'/../lib/Settings/CalDAVSettings.php',
267
+        'OCA\\DAV\\Storage\\PublicOwnerWrapper' => __DIR__.'/..'.'/../lib/Storage/PublicOwnerWrapper.php',
268
+        'OCA\\DAV\\SystemTag\\SystemTagMappingNode' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagMappingNode.php',
269
+        'OCA\\DAV\\SystemTag\\SystemTagNode' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagNode.php',
270
+        'OCA\\DAV\\SystemTag\\SystemTagPlugin' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagPlugin.php',
271
+        'OCA\\DAV\\SystemTag\\SystemTagsByIdCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsByIdCollection.php',
272
+        'OCA\\DAV\\SystemTag\\SystemTagsObjectMappingCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsObjectMappingCollection.php',
273
+        'OCA\\DAV\\SystemTag\\SystemTagsObjectTypeCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsObjectTypeCollection.php',
274
+        'OCA\\DAV\\SystemTag\\SystemTagsRelationsCollection' => __DIR__.'/..'.'/../lib/SystemTag/SystemTagsRelationsCollection.php',
275
+        'OCA\\DAV\\Traits\\PrincipalProxyTrait' => __DIR__.'/..'.'/../lib/Traits/PrincipalProxyTrait.php',
276
+        'OCA\\DAV\\Upload\\AssemblyStream' => __DIR__.'/..'.'/../lib/Upload/AssemblyStream.php',
277
+        'OCA\\DAV\\Upload\\ChunkingPlugin' => __DIR__.'/..'.'/../lib/Upload/ChunkingPlugin.php',
278
+        'OCA\\DAV\\Upload\\CleanupService' => __DIR__.'/..'.'/../lib/Upload/CleanupService.php',
279
+        'OCA\\DAV\\Upload\\FutureFile' => __DIR__.'/..'.'/../lib/Upload/FutureFile.php',
280
+        'OCA\\DAV\\Upload\\RootCollection' => __DIR__.'/..'.'/../lib/Upload/RootCollection.php',
281
+        'OCA\\DAV\\Upload\\UploadFile' => __DIR__.'/..'.'/../lib/Upload/UploadFile.php',
282
+        'OCA\\DAV\\Upload\\UploadFolder' => __DIR__.'/..'.'/../lib/Upload/UploadFolder.php',
283
+        'OCA\\DAV\\Upload\\UploadHome' => __DIR__.'/..'.'/../lib/Upload/UploadHome.php',
284 284
     );
285 285
 
286 286
     public static function getInitializer(ClassLoader $loader)
287 287
     {
288
-        return \Closure::bind(function () use ($loader) {
288
+        return \Closure::bind(function() use ($loader) {
289 289
             $loader->prefixLengthsPsr4 = ComposerStaticInitDAV::$prefixLengthsPsr4;
290 290
             $loader->prefixDirsPsr4 = ComposerStaticInitDAV::$prefixDirsPsr4;
291 291
             $loader->classMap = ComposerStaticInitDAV::$classMap;
Please login to merge, or discard this patch.