From: Thomas Citharel Date: Thu, 22 Aug 2019 13:49:51 +0000 (+0200) Subject: Check the calendar type of calendarobjects & calendarchanges X-Git-Tag: v16.0.5RC1~1^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6d856ceaf9af79a4e85380201a9f470471b85ac5;p=nextcloud-server.git Check the calendar type of calendarobjects & calendarchanges Signed-off-by: Thomas Citharel --- diff --git a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php index 7d995ff35cd..3b5b7bc8ac7 100644 --- a/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php +++ b/apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php @@ -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();