mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Add audit log cleanup/retention period to cron
Audit logs will be automatically cleaned up after 90 days (new installs) or 7 years (existing installs). This is configurable in Settings > Security.
This commit is contained in:
10
cron.php
10
cron.php
@@ -67,9 +67,12 @@ $config_telemetry = intval($row['config_telemetry']);
|
||||
$config_enable_alert_domain_expire = intval($row['config_enable_alert_domain_expire']);
|
||||
$config_send_invoice_reminders = intval($row['config_send_invoice_reminders']);
|
||||
|
||||
// Remmeber Token Expire
|
||||
// Remember-me Token Expiry
|
||||
$config_login_remember_me_expire = intval($row['config_login_remember_me_expire']);
|
||||
|
||||
// Log retention
|
||||
$config_log_retention = intval($row['config_log_retention']);
|
||||
|
||||
// Set Currency Format
|
||||
$currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY);
|
||||
|
||||
@@ -120,9 +123,12 @@ mysqli_query($mysqli, "DELETE FROM notifications WHERE notification_dismissed_at
|
||||
// Clean-up mail queue
|
||||
mysqli_query($mysqli, "DELETE FROM email_queue WHERE email_queued_at < CURDATE() - INTERVAL 90 DAY");
|
||||
|
||||
// Clean-up old remember me tokens (2 or more days old)
|
||||
// Clean-up old remember me tokens
|
||||
mysqli_query($mysqli, "DELETE FROM remember_tokens WHERE remember_token_created_at < CURDATE() - INTERVAL $config_login_remember_me_expire DAY");
|
||||
|
||||
// Cleanup old audit logs
|
||||
mysqli_query($mysqli, "DELETE FROM logs WHERE log_created_at < CURDATE() - INTERVAL $config_log_retention DAY");
|
||||
|
||||
//Logging
|
||||
//mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron cleaned up old data'");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user