forked from extern/egroupware
- Fix purging of old events so it doesn't delete everything
- Trick config into calling the hook when purging is turned off so cron job is cancelled
This commit is contained in:
parent
0867ed78d8
commit
f8431b00a7
@ -578,12 +578,14 @@ function calendar_purge_old($config) {
|
|||||||
// Cancel old purge
|
// Cancel old purge
|
||||||
ExecMethod('phpgwapi.asyncservice.cancel_timer', $id);
|
ExecMethod('phpgwapi.asyncservice.cancel_timer', $id);
|
||||||
|
|
||||||
|
if((int)$config > 0) {
|
||||||
$result = ExecMethod2('phpgwapi.asyncservice.set_timer',
|
$result = ExecMethod2('phpgwapi.asyncservice.set_timer',
|
||||||
array('month' => '*', 'day' => 1),
|
array('month' => '*', 'day' => 1),
|
||||||
$id,
|
$id,
|
||||||
'calendar.calendar_boupdate.purge',
|
'calendar.calendar_boupdate.purge',
|
||||||
(int)$config
|
(int)$config
|
||||||
);
|
);
|
||||||
|
}
|
||||||
if(!$result)
|
if(!$result)
|
||||||
{
|
{
|
||||||
$GLOBALS['config_error'] = 'Unable to schedule purge';
|
$GLOBALS['config_error'] = 'Unable to schedule purge';
|
||||||
|
@ -1516,7 +1516,9 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
$sql = "DELETE egw_cal.* FROM egw_cal
|
$sql = "DELETE egw_cal.* FROM egw_cal
|
||||||
LEFT JOIN egw_cal_repeats ON
|
LEFT JOIN egw_cal_repeats ON
|
||||||
egw_cal_repeats.cal_id = egw_cal.cal_id
|
egw_cal_repeats.cal_id = egw_cal.cal_id
|
||||||
WHERE egw_cal_repeats.cal_id IS NULL || (recur_enddate < $date && recur_enddate != 0)";
|
JOIN egw_cal_dates ON
|
||||||
|
egw_cal.cal_id = egw_cal_dates.cal_id
|
||||||
|
WHERE cal_end < $date AND (egw_cal_repeats.cal_id IS NULL || (recur_enddate < $date && recur_enddate != 0))";
|
||||||
$this->db->query($sql, __LINE__, __FILE__);
|
$this->db->query($sql, __LINE__, __FILE__);
|
||||||
|
|
||||||
// Get a list of what we just deleted for links
|
// Get a list of what we just deleted for links
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
<td> {lang_Automatically_purge_old_events_after}</td>
|
<td> {lang_Automatically_purge_old_events_after}</td>
|
||||||
<td>
|
<td>
|
||||||
<select name="newsettings[calendar_purge_old]">
|
<select name="newsettings[calendar_purge_old]">
|
||||||
<option value="">{lang_No_automatic_purging}</option>
|
<option value="0ff">{lang_No_automatic_purging}</option>
|
||||||
<option value="1"{selected_calendar_purge_old_1}>1 {lang_year}</option>
|
<option value="1"{selected_calendar_purge_old_1}>1 {lang_year}</option>
|
||||||
<option value="2"{selected_calendar_purge_old_2}>2 {lang_years}</option>
|
<option value="2"{selected_calendar_purge_old_2}>2 {lang_years}</option>
|
||||||
<option value="3"{selected_calendar_purge_old_3}>3 {lang_years}</option>
|
<option value="3"{selected_calendar_purge_old_3}>3 {lang_years}</option>
|
||||||
|
Loading…
Reference in New Issue
Block a user