Check the calendar type of calendarobjects & calendarchanges

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-08-22 15:49:51 +02:00
parent 456fb7e294
commit e2b539bebf
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
1 changed files with 6 additions and 0 deletions

View 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();