From 5d93b3a4ecc8931eb8c2fcf619eb34c30068bccc Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Fri, 09 Jan 2015 11:34:21 -0500
Subject: [PATCH] add missing sql-column mail_user.sender_cc to inc-updates

---
 server/lib/classes/cron.d/200-logfiles.inc.php |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/server/lib/classes/cron.d/200-logfiles.inc.php b/server/lib/classes/cron.d/200-logfiles.inc.php
index ebf159c..a802ff9 100644
--- a/server/lib/classes/cron.d/200-logfiles.inc.php
+++ b/server/lib/classes/cron.d/200-logfiles.inc.php
@@ -112,6 +112,30 @@
 				exec("gzip -c $logfile > $logfile.gz");
 				unlink($logfile);
 			}
+			
+			$cron_logfiles = array('cron.log', 'cron_error.log', 'cron_wget.log');
+			foreach($cron_logfiles as $cron_logfile) {
+				$cron_logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/' . $cron_logfile);
+				
+				// rename older files (move up by one)
+				$num = 7;
+				while($num >= 1 && is_file($cron_logfile . '.' . $num . '.gz')) {
+					rename($cron_logfile . '.' . $num . '.gz', $cron_logfile . '.' . ($num + 1) . '.gz');
+					$num--;
+				}
+				
+				// compress current logfile
+				if(is_file($cron_logfile)) {
+					exec("gzip -c $cron_logfile > $cron_logfile.1.gz");
+					exec("cat /dev/null > $cron_logfile");
+				}
+				// remove older logs
+				$num = 7;
+				while(is_file($cron_logfile . '.' . $num . '.gz')) {
+					@unlink($cron_logfile . '.' . $num . '.gz');
+					$num++;
+				}
+			}
 
 			// rotate and compress the error.log when it exceeds a size of 10 MB
 			$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/error.log');

--
Gitblit v1.9.1