* eSync/Calendar: new preference how many days to sync back, if client specifies no limit / all, default is 365

This commit is contained in:
ralf 2024-07-16 09:14:08 +02:00
parent 7eee15c980
commit 6e5a691a74
1 changed files with 18 additions and 2 deletions

View File

@ -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;
}