Added automatic deletion of old error log files
authorAlexander Ebert <ebert@woltlab.com>
Wed, 7 Aug 2013 18:04:53 +0000 (20:04 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 7 Aug 2013 18:04:53 +0000 (20:04 +0200)
Closes #1394

wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php

index 60558001d1638aa0e13a1b034c0ccc8cec27108e..74f80969ec3fa246371cec21138e40d5953ed95b 100644 (file)
@@ -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);
+                       }
+               }
        }
 }