From 5ef60a7ff60d0b349e56b7681edc8679fe6cd1e0 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 08 Sep 2011 08:33:09 -0400
Subject: [PATCH] Fixed: FS#1456 - Web domain's log rotate problem

---
 server/cron_daily.php |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/server/cron_daily.php b/server/cron_daily.php
index 571a02b..d8a7b64 100644
--- a/server/cron_daily.php
+++ b/server/cron_daily.php
@@ -280,6 +280,15 @@
 	if(@is_file($logfile)) {
 		unlink($logfile);
 	}
+	
+	//* Delete older Log files, in case that we missed them before due to serverdowntimes.
+	$datepart = date('Ym',time() - 86400 * 31 * 2);
+	
+	$logfile = escapeshellcmd($rec['document_root']).'/log/'.$datepart.'*-access.log.gz';
+	exec('rm -f '.$logfile);
+	
+	$logfile = escapeshellcmd($rec['document_root']).'/log/'.$datepart.'*-access.log';
+	exec('rm -f '.$logfile);
 }
 
 #######################################################################################################

--
Gitblit v1.9.1