summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna <anna@nextcloud.com>2023-01-18 21:39:15 +0100
committerGitHub <noreply@github.com>2023-01-18 21:39:15 +0100
commit444f11b857ffb63382409df3c572e49d4ca2bf4d (patch)
tree83a9406d567ce1c5d94629239df360adf71f8f3a
parent950b71c6ae39073e1ca569da931346822fa77e5b (diff)
parenta9264b007ffa4bf4ae04069bb14f56b6b3f591ea (diff)
downloadnextcloud-server-444f11b857ffb63382409df3c572e49d4ca2bf4d.tar.gz
nextcloud-server-444f11b857ffb63382409df3c572e49d4ca2bf4d.zip
Merge pull request #36211 from nextcloud/enh/catch-recurrence-exception
fix(dav): catch MaxInstancesExceededException for recurring events without end date
-rw-r--r--apps/dav/lib/CalDAV/Reminder/ReminderService.php73
1 files changed, 39 insertions, 34 deletions
diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php
index 3fb8cf9ebe5..ffb829f454a 100644
--- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php
+++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php
@@ -482,49 +482,54 @@ class ReminderService {
return;
}
- while ($iterator->valid()) {
- $event = $iterator->getEventObject();
-
- // Recurrence-exceptions are handled separately, so just ignore them here
- if (\in_array($event, $recurrenceExceptions, true)) {
- $iterator->next();
- continue;
- }
-
- $recurrenceId = $this->getEffectiveRecurrenceIdOfVEvent($event);
- if ($reminder['recurrence_id'] >= $recurrenceId) {
- $iterator->next();
- continue;
- }
+ try {
+ while ($iterator->valid()) {
+ $event = $iterator->getEventObject();
- foreach ($event->VALARM as $valarm) {
- /** @var VAlarm $valarm */
- $alarmHash = $this->getAlarmHash($valarm);
- if ($alarmHash !== $reminder['alarm_hash']) {
+ // Recurrence-exceptions are handled separately, so just ignore them here
+ if (\in_array($event, $recurrenceExceptions, true)) {
+ $iterator->next();
continue;
}
- $triggerTime = $valarm->getEffectiveTriggerTime();
-
- // If effective trigger time is in the past
- // just skip and generate for next event
- $diff = $now->diff($triggerTime);
- if ($diff->invert === 1) {
+ $recurrenceId = $this->getEffectiveRecurrenceIdOfVEvent($event);
+ if ($reminder['recurrence_id'] >= $recurrenceId) {
+ $iterator->next();
continue;
}
- $this->backend->removeReminder($reminder['id']);
- $alarms = $this->getRemindersForVAlarm($valarm, [
- 'calendarid' => $reminder['calendar_id'],
- 'id' => $reminder['object_id'],
- ], $reminder['event_hash'], $alarmHash, true, false);
- $this->writeRemindersToDatabase($alarms);
+ foreach ($event->VALARM as $valarm) {
+ /** @var VAlarm $valarm */
+ $alarmHash = $this->getAlarmHash($valarm);
+ if ($alarmHash !== $reminder['alarm_hash']) {
+ continue;
+ }
- // Abort generating reminders after creating one successfully
- return;
- }
+ $triggerTime = $valarm->getEffectiveTriggerTime();
- $iterator->next();
+ // If effective trigger time is in the past
+ // just skip and generate for next event
+ $diff = $now->diff($triggerTime);
+ if ($diff->invert === 1) {
+ continue;
+ }
+
+ $this->backend->removeReminder($reminder['id']);
+ $alarms = $this->getRemindersForVAlarm($valarm, [
+ 'calendarid' => $reminder['calendar_id'],
+ 'id' => $reminder['object_id'],
+ ], $reminder['event_hash'], $alarmHash, true, false);
+ $this->writeRemindersToDatabase($alarms);
+
+ // Abort generating reminders after creating one successfully
+ return;
+ }
+
+ $iterator->next();
+ }
+ } catch (MaxInstancesExceededException $e) {
+ // Using debug logger as this isn't really an error
+ $this->logger->debug('Recurrence with too many instances detected, skipping VEVENT', ['exception' => $e]);
}
$this->backend->removeReminder($reminder['id']);