Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Check the calendar type of calendarobjects & calendarchanges
Signed-off-by: Thomas Citharel <[email protected]>
  • Loading branch information
tcitworld committed Aug 26, 2019
commit e2b539bebf53e0823d6561fbfde6f660ebc416ab
6 changes: 6 additions & 0 deletions apps/dav/lib/Migration/RemoveOrphanEventsAndContacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ protected function removeOrphanChildren($childTable, $parentTable, $parentId): i
->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();
Expand Down