mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-03 11:59:16 +01:00
* Calendar: added purge interval of half a year
This commit is contained in:
parent
3d1cbd3f40
commit
f65fd9129f
@ -2383,15 +2383,14 @@ class calendar_boupdate extends calendar_bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Delete events that are more than $age years old
|
* Delete events that are more than $age years old
|
||||||
*
|
*
|
||||||
* Purges old events from the database
|
* Purges old events from the database
|
||||||
*
|
*
|
||||||
* @param int $age How many years old the event must be before it is deleted
|
* @param int|float $age How many years old the event must be before it is deleted
|
||||||
*/
|
*/
|
||||||
function purge($age)
|
function purge($age)
|
||||||
{
|
{
|
||||||
$time = strtotime("-$age years", time());
|
$this->so->purge(time() - 365*24*3600*(float)$age);
|
||||||
$this->so->purge($time);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -659,18 +659,20 @@ class calendar_hooks
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Not part of the class, since config hooks are still using the old style
|
// Not part of the class, since config hooks are still using the old style
|
||||||
function calendar_purge_old($config) {
|
function calendar_purge_old($config)
|
||||||
|
{
|
||||||
$id = 'calendar_purge';
|
$id = 'calendar_purge';
|
||||||
|
|
||||||
// Cancel old purge
|
// Cancel old purge
|
||||||
ExecMethod('phpgwapi.asyncservice.cancel_timer', $id);
|
ExecMethod('phpgwapi.asyncservice.cancel_timer', $id);
|
||||||
|
|
||||||
if((int)$config > 0) {
|
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
|
(float)$config
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(!$result)
|
if(!$result)
|
||||||
|
@ -87,6 +87,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<select name="newsettings[calendar_purge_old]">
|
<select name="newsettings[calendar_purge_old]">
|
||||||
<option value="0ff">{lang_No_automatic_purging}</option>
|
<option value="0ff">{lang_No_automatic_purging}</option>
|
||||||
|
<option value=".5"{selected_calendar_purge_old_.5}>0.5 {lang_years}</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