From 9142971675bf328ec462578cbd954a0419d4c9b4 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 7 Aug 2013 20:04:53 +0200 Subject: [PATCH] Added automatic deletion of old error log files Closes #1394 --- .../files/lib/system/cronjob/DailyCleanUpCronjob.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php index 60558001d1..74f80969ec 100644 --- a/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php @@ -121,5 +121,12 @@ class DailyCleanUpCronjob extends AbstractCronjob { $statement->execute(array( (TIME_NOW - 86400) )); + + // clean up error logs + foreach (glob(WCF_DIR.'log/*.txt') as $filename) { + if (filectime($filename) < TIME_NOW - 86400 * 14) { + @unlink($filename); + } + } } } -- 2.20.1