]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check the calendar type of calendarobjects & calendarchanges 16994/head
authorThomas Citharel <tcit@tcit.fr>
Thu, 22 Aug 2019 13:49:51 +0000 (15:49 +0200)
committerBackportbot <backportbot-noreply@rullzer.com>
Wed, 4 Sep 2019 08:55:47 +0000 (08:55 +0000)
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php

index 7d995ff35cda63dd390162f41f428c9e1e10c41c..3b5b7bc8ac74135f6336f61276db6c59faf94d02 100644 (file)
@@ -75,6 +75,12 @@ class RemoveOrphanEventsAndContacts implements IRepairStep {
                        ->from($childTable, 'c')
                        ->leftJoin('c', $parentTable, 'p', $qb->expr()->eq('c.' . $parentId, 'p.id'))
                        ->where($qb->expr()->isNull('p.id'));
+
+               if (\in_array($parentTable, ['calendars', 'calendarsubscriptions'], true)) {
+                       $calendarType = $parentTable === 'calendarsubscriptions' ? CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION : CalDavBackend::CALENDAR_TYPE_CALENDAR;
+                       $qb->andWhere($qb->expr()->eq('c.calendartype', $qb->createNamedParameter($calendarType, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT));
+               }
+
                $result = $qb->execute();
 
                $orphanItems = array();