From 57659baad5a892afb356b7e30f6a176e5004dcc6 Mon Sep 17 00:00:00 2001
From: vogelor <vogelor@ispconfig3>
Date: Fri, 30 Apr 2010 11:51:41 -0400
Subject: [PATCH] Added Log-Rotation to the installer

---
 install/install.php                       |    2 
 install/lib/installer_base.lib.php        |   28 ++++++++++++--
 docs/INSTALL_DEBIAN_5.0_dovecot_bind.txt  |   21 ----------
 install/update.php                        |    2 
 docs/INSTALL_DEBIAN_6.0_courier_mydns.txt |   21 ----------
 5 files changed, 26 insertions(+), 48 deletions(-)

diff --git a/docs/INSTALL_DEBIAN_5.0_dovecot_bind.txt b/docs/INSTALL_DEBIAN_5.0_dovecot_bind.txt
index 9ee449b..8a8ccf6 100644
--- a/docs/INSTALL_DEBIAN_5.0_dovecot_bind.txt
+++ b/docs/INSTALL_DEBIAN_5.0_dovecot_bind.txt
@@ -224,27 +224,6 @@
 
 -----------------------------------------------------------------------------------------------------------
 
-Ispc log files rotate, for now manual add but to add in ispc installer:
-
-/etc/logrotate.d/logispc3
-
-/var/log/ispconfig/ispconfig.log {
-	weekly
-	missingok
-	rotate 4
-	compress
-	delaycompress
-}
-/var/log/ispconfig/cron.log {
-	weekly
-	missingok
-	rotate 4
-	compress
-	delaycompress
-}
-
-
------------------------------------------------------------------------------------------------------------
 
 Possible errors and their solutions
 ------------------------------------
diff --git a/docs/INSTALL_DEBIAN_6.0_courier_mydns.txt b/docs/INSTALL_DEBIAN_6.0_courier_mydns.txt
index 9ceb9b5..63d7182 100644
--- a/docs/INSTALL_DEBIAN_6.0_courier_mydns.txt
+++ b/docs/INSTALL_DEBIAN_6.0_courier_mydns.txt
@@ -360,27 +360,6 @@
 
 -----------------------------------------------------------------------------------------------------------
 
-Ispc log files rotate, for now manual add but to add in ispc installer:
-
-/etc/logrotate.d/logispc3
-
-/var/log/ispconfig/ispconfig.log {
-	weekly
-	missingok
-	rotate 4
-	compress
-	delaycompress
-}
-/var/log/ispconfig/cron.log {
-	weekly
-	missingok
-	rotate 4
-	compress
-	delaycompress
-}
-
-
------------------------------------------------------------------------------------------------------------
 
 Possible errors and their solutions
 ------------------------------------
diff --git a/install/install.php b/install/install.php
index 5d0d444..b4d59ee 100644
--- a/install/install.php
+++ b/install/install.php
@@ -1,7 +1,7 @@
 <?php
 
 /*
-Copyright (c) 2007, Till Brehm, projektfarm Gmbh
+Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification,
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 20eb61a..5ba03d2 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -1,7 +1,7 @@
 <?php
 
 /*
-Copyright (c) 2007, Till Brehm, projektfarm Gmbh
+Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification,
@@ -154,7 +154,7 @@
 				caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['mysql']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", 
                         __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
 			} else {
-				caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['mysql']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", 
+				caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['mysql']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
                         __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
 			}
 			$db_tables = $this->db->getTables();
@@ -1388,8 +1388,28 @@
 		exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
 		if(is_user('getmail')) exec('chown getmail /usr/local/bin/run-getmail.sh');
 		exec('chmod 744 /usr/local/bin/run-getmail.sh');
-		
-		
+
+		//* Add Log-Rotation
+		if (is_dir('/etc/logrotate.d')){
+			unlink('/etc/logrotate.d/logispc3');
+			$fh = fopen('/etc/logrotate.d/logispc3', 'w');
+			fwrite($fh,
+					"/var/log/ispconfig/ispconfig.log { \n" .
+					"	weekly \n" .
+					"	missingok \n" .
+					"	rotate 4 \n" .
+					"	compress \n" .
+					"	delaycompress \n" .
+					"} \n" .
+					"/var/log/ispconfig/cron.log { \n" .
+					"	weekly \n" .
+					"	missingok \n" .
+					"	rotate 4 \n" .
+					"	compress \n" .
+					"	delaycompress \n" .
+					"}");
+			fclose($fh);
+		}
 	}
 	
 	public function configure_dbserver()
diff --git a/install/update.php b/install/update.php
index 0b1e263..d0ec6ff 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,7 +1,7 @@
 <?php
 
 /*
-Copyright (c) 2007, Till Brehm, projektfarm Gmbh
+Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification,

--
Gitblit v1.9.1