From 5b6ae9f9889cfc24c9ffffe9b02dbdeb11308251 Mon Sep 17 00:00:00 2001 From: Toni Cunyat Date: Mon, 3 Nov 2014 18:25:45 +0100 Subject: [PATCH] Add option to clean old perf_times table entries #341 --- daily.php | 7 +++++++ daily.sh | 1 + includes/defaults.inc.php | 1 + 3 files changed, 9 insertions(+) diff --git a/daily.php b/daily.php index fa07397e3..38ac1584e 100644 --- a/daily.php +++ b/daily.php @@ -48,5 +48,12 @@ if ($options['f'] === 'authlog') { } } } +if ($options['f'] === 'perf_times') { + if (is_numeric($config['perf_times_purge'])) { + if (dbDelete('perf_times', "start < UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL ? DAY))", array($config['perf_times_purge'])) ) { + echo 'Performance poller times cleared for entries over ' . $config['perf_times_purge'] . " days\n"; + } + } +} ?> diff --git a/daily.sh b/daily.sh index 61a9e1b82..ca8c87077 100644 --- a/daily.sh +++ b/daily.sh @@ -10,3 +10,4 @@ fi php daily.php -f syslog php daily.php -f eventlog php daily.php -f authlog +php daily.php -f perf_times diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index f29156193..433e34b34 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -576,6 +576,7 @@ $config['update'] = 1; $config['syslog_purge'] = 30; # Number in days of how long to keep syslog entries for. $config['eventlog_purge'] = 30; # Number in days of how long to keep eventlog entries for. $config['authlog_purge'] = 30; # Number in days of how long to keep authlog entries for. +$config['perf_times_purge'] = 30; # Number in days of how long to keep performace pooling stats entries for. # Date format for PHP date()s $config['dateformat']['long'] = "r"; # RFC2822 style