From 933fe813713e97412ec8889522a0c32206b1baab Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sat, 14 Dec 2024 06:26:52 -0700 Subject: [PATCH] Change log rotation from 1 day to 7 days. --- Rocksolid_Light/rslight/scripts/cron.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rocksolid_Light/rslight/scripts/cron.php b/Rocksolid_Light/rslight/scripts/cron.php index 147043d..ca8ef83 100644 --- a/Rocksolid_Light/rslight/scripts/cron.php +++ b/Rocksolid_Light/rslight/scripts/cron.php @@ -303,8 +303,9 @@ function expire_files() function log_rotate() { global $logdir; + $rotate_days = 7; $rotate = filemtime($logdir . '/rotate'); - if ((time() - $rotate) > 86400) { + if ((time() - $rotate) > ($rotate_days * 86400)) { $log_files = scandir($logdir); foreach ($log_files as $logfile) { if (substr($logfile, -4) != '.log') { @@ -318,7 +319,6 @@ function log_rotate() @rename($logfile . '.1', $logfile . '.2'); file_put_contents($logfile, "\nLog file rotated", FILE_APPEND); @rename($logfile, $logfile . '.1'); - file_put_contents($logfile, "\nLog file started", FILE_APPEND); echo 'Rotated: ' . $logfile . "\n"; } unlink($logdir . '/rotate');