From 6f9f931895bd10e56d27eec3efbbf0e529fa8f1d Mon Sep 17 00:00:00 2001 From: ralf Date: Tue, 16 Jul 2024 09:14:08 +0200 Subject: [PATCH] * eSync/Calendar: new preference how many days to sync back, if client specifies no limit / all, default is 365 --- calendar/inc/class.calendar_zpush.inc.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/calendar/inc/class.calendar_zpush.inc.php b/calendar/inc/class.calendar_zpush.inc.php index b01541d7e7..11e01f0131 100644 --- a/calendar/inc/class.calendar_zpush.inc.php +++ b/calendar/inc/class.calendar_zpush.inc.php @@ -67,6 +67,11 @@ class calendar_zpush implements activesync_plugin_write, activesync_plugin_meeti */ private $addressbook; + /** + * Default in days, if no cutoff-date or preference for it is given + */ + const PAST_LIMIT = 365; + /** * Constructor * @@ -187,11 +192,14 @@ class calendar_zpush implements activesync_plugin_write, activesync_plugin_meeti $type = $user = null; $this->backend->splitID($id,$type,$user); - if (!$cutoffdate) $cutoffdate = time() - 365*24*3600; // limit all to 1 year (-30 breaks all sync recurrences) + if (!$cutoffdate) // limit all to 1 year (-30 breaks all sync recurrences) + { + $cutoffdate = time() - abs($GLOBALS['egw_info']['user']['preferences']['activesync']['calendar-maximumSyncRange'] ?? self::PAST_LIMIT)*24*3600; + } $filter = array( 'users' => $user, - 'start' => $cutoffdate, // default one month back -30 breaks all sync recurrences + 'start' => $cutoffdate, 'enum_recuring' => false, 'daywise' => false, 'date_format' => 'server', @@ -1676,6 +1684,14 @@ END:VTIMEZONE 'xmlrpc' => True, 'admin' => False, ); + $settings['calendar-maximumSyncRange'] = array( + 'type' => 'integer', + 'label' => lang('How many days to sync in the past when client does not specify a date-range (default %1)', self::PAST_LIMIT), + 'name' => 'calendar-maximumSyncRange', + 'help' => 'if the client sets no sync range, you may override the setting (preventing client crash that may be caused by too many mails/too much data). If you want to sync way-back into the past: set a large number', + 'xmlrpc' => True, + 'admin' => False, + ); return $settings; }