From bf47b513193e764bd8ae5d516389f8becfb061cc Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 22 Feb 2011 10:13:59 -0500
Subject: [PATCH] Fixed: FS#1529 - wrong permission for link /var/www/clients/clientXX/webXX/log

---
 server/plugins-available/apache2_plugin.inc.php |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 374d4e5..7f356bf 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -161,8 +161,8 @@
 			$csr_file = $ssl_dir.'/'.$domain.".csr";
 			$crt_file = $ssl_dir.'/'.$domain.".crt";
 			$bundle_file = $ssl_dir.'/'.$domain.".bundle";
-			file_put_contents($csr_file,$data["new"]["ssl_request"]);
-			file_put_contents($crt_file,$data["new"]["ssl_cert"]);
+			if(trim($data["new"]["ssl_request"]) != '') file_put_contents($csr_file,$data["new"]["ssl_request"]);
+			if(trim($data["new"]["ssl_cert"]) != '') file_put_contents($crt_file,$data["new"]["ssl_cert"]);
 			if(trim($data["new"]["ssl_bundle"]) != '') file_put_contents($bundle_file,$data["new"]["ssl_bundle"]);
 			/* Update the DB of the (local) Server */
 			$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data["new"]["domain"]."'");
@@ -491,6 +491,9 @@
 
 			// make temp directory writable for the apache and website users
 			$this->_exec("chmod 777 ".escapeshellcmd($data["new"]["document_root"]."/tmp"));
+			
+			// Set Log symlink to 755 to make the logs accessible by the FTP user
+			$this->_exec("chmod 755 ".escapeshellcmd($data["new"]["document_root"])."/log");
 
 			$command = 'usermod';
 			$command .= ' --groups sshusers';
@@ -894,6 +897,9 @@
 			$app->log("Apache status is: ".$apache_online_status_before_restart,LOGLEVEL_DEBUG);
 
 			$app->services->restartService('httpd','restart');
+			
+			// wait a few seconds, before we test the apache status again
+			sleep(2);
 		
 			//* Check if apache restarted successfully if it was online before
 			$apache_online_status_after_restart = $this->_checkTcp('localhost',80);

--
Gitblit v1.9.1