fixed the retention time update

This commit is contained in:
SJ 2013-09-05 13:54:29 +02:00
parent c2539c71a8
commit cba9628780

View File

@ -50,10 +50,10 @@ class ModelPolicyRetention extends Model {
$default_retention = DEFAULT_RETENTION * 86400;
$delta = NOW + 86400 * $data['days'] - $default_retention;
$retained = NOW + 86400 * $data['days'];
$start_ts = NOW - 2*$default_retention;
$query = $this->db->query("UPDATE " . VIEW_MESSAGES . " SET retained=? WHERE arrived > ? AND (todomain=? OR fromdomain=?)", array($delta, $start_ts, $data['domain'], $data['domain']));
$query = $this->db->query("UPDATE " . VIEW_MESSAGES . " SET retained = ? WHERE arrived > ? AND (todomain=? OR fromdomain=?)", array($retained, $start_ts, $data['domain'], $data['domain']));
if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, sprintf("update retention date: domain='%s', days=%d, hits=%d, exec time=%.2f sec", $data['domain'], $data['days'], $this->db->countAffected(), $query->exec_time)); }