diff --git a/webui/model/policy/retention.php b/webui/model/policy/retention.php index fb614af8..97c007be 100644 --- a/webui/model/policy/retention.php +++ b/webui/model/policy/retention.php @@ -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)); }