* Calendar: added purge interval of half a year

This commit is contained in:
Ralf Becker 2011-06-14 18:17:22 +00:00
parent 56ccefd994
commit 3ccd187698
3 changed files with 13 additions and 11 deletions

View File

@ -2350,15 +2350,14 @@ class calendar_boupdate extends calendar_bo
}
}
/**
* Delete events that are more than $age years old
*
* Purges old events from the database
*
* @param int $age How many years old the event must be before it is deleted
*/
* Delete events that are more than $age years old
*
* Purges old events from the database
*
* @param int|float $age How many years old the event must be before it is deleted
*/
function purge($age)
{
$time = strtotime("-$age years", time());
$this->so->purge($time);
$this->so->purge(time() - 365*24*3600*(float)$age);
}
}

View File

@ -572,18 +572,20 @@ class calendar_hooks
}
// 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';
// Cancel old purge
ExecMethod('phpgwapi.asyncservice.cancel_timer', $id);
if((int)$config > 0) {
if((int)$config > 0)
{
$result = ExecMethod2('phpgwapi.asyncservice.set_timer',
array('month' => '*', 'day' => 1),
$id,
'calendar.calendar_boupdate.purge',
(int)$config
(float)$config
);
}
if(!$result)

View File

@ -77,6 +77,7 @@
<td>
<select name="newsettings[calendar_purge_old]">
<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="2"{selected_calendar_purge_old_2}>2 {lang_years}</option>
<option value="3"{selected_calendar_purge_old_3}>3 {lang_years}</option>