From 3ffbc8af4b3d8bdd3fb8a883f6e73ac762352e6e Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 14 Nov 2011 10:27:25 -0500
Subject: [PATCH] Fixed: FS#1834 - More info link

---
 install/lib/installer_base.lib.php |   58 +++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 00e4a7e..c3d40b2 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -118,7 +118,7 @@
 		if(is_installed('mysql') || is_installed('mysqld')) $conf['mysql']['installed'] = true;
 		if(is_installed('postfix')) $conf['postfix']['installed'] = true;
 		if(is_installed('mailman')) $conf['mailman']['installed'] = true;
-		if(is_installed('apache') || is_installed('apache2') || is_installed('httpd')) $conf['apache']['installed'] = true;
+		if(is_installed('apache') || is_installed('apache2') || is_installed('httpd') || is_installed('httpd2')) $conf['apache']['installed'] = true;
 		if(is_installed('getmail')) $conf['getmail']['installed'] = true;
 		if(is_installed('courierlogger')) $conf['courier']['installed'] = true;
 		if(is_installed('dovecot')) $conf['dovecot']['installed'] = true;
@@ -888,7 +888,7 @@
 		if(is_file($config_dir.'/'.$configfile)) {
 			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
 		}
-		chmod($config_dir.'/'.$configfile.'~', 0400);
+		if(is_file($config_dir.'/'.$configfile.'~')) chmod($config_dir.'/'.$configfile.'~', 0400);
 		$content = rf('tpl/debian_dovecot-sql.conf.master');
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
@@ -1396,7 +1396,11 @@
 			$command = 'adduser '.$conf['apache']['user'].' '.$apps_vhost_group;
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 
-			if(!@is_dir($install_dir)) mkdir($install_dir, 0755, true);
+			if(!@is_dir($install_dir)){
+				mkdir($install_dir, 0755, true);
+			} else {
+				chmod($install_dir, 0755);
+			}
 			chown($install_dir, $apps_vhost_user);
 			chgrp($install_dir, $apps_vhost_group);
 
@@ -1455,7 +1459,11 @@
 			$command = 'adduser '.$conf['nginx']['user'].' '.$apps_vhost_group;
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 
-			if(!@is_dir($install_dir)) mkdir($install_dir, 0755, true);
+			if(!@is_dir($install_dir)){
+				mkdir($install_dir, 0755, true);
+			} else {
+				chmod($install_dir, 0755);
+			}
 			chown($install_dir, $apps_vhost_user);
 			chgrp($install_dir, $apps_vhost_group);
 
@@ -1472,20 +1480,29 @@
 			} else {
 				$apps_vhost_ip = $conf['web']['apps_vhost_ip'].':';
 			}
+			
+			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
+			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
+			$fpm_socket = $socket_dir.'apps.sock';
+			$cgi_socket = escapeshellcmd($conf['nginx']['cgi_socket']);
 
 			$content = str_replace('{apps_vhost_ip}', $apps_vhost_ip, $content);
 			$content = str_replace('{apps_vhost_port}', $conf['web']['apps_vhost_port'], $content);
 			$content = str_replace('{apps_vhost_dir}', $conf['web']['website_basedir'].'/apps', $content);
 			$content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content);
-			$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
+			//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
+			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
+			$content = str_replace('{cgi_socket}', $cgi_socket, $content);
 
 			wf($vhost_conf_dir.'/apps.vhost', $content);
 			
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
-			$content = rf('tpl/php_fpm_pool.conf.master');
+			$content = rf('tpl/apps_php_fpm_pool.conf.master');
 			$content = str_replace('{fpm_pool}', 'apps', $content);
-			$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
+			//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
+			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 			$content = str_replace('{fpm_user}', $apps_vhost_user, $content);
 			$content = str_replace('{fpm_group}', $apps_vhost_group, $content);
 			wf($conf['nginx']['php_fpm_pool_dir'].'/apps.conf', $content);
@@ -1668,13 +1685,9 @@
 		$dns_server_enabled = ($conf['services']['dns'])?1:0;
 		$file_server_enabled = ($conf['services']['file'])?1:0;
 		$db_server_enabled = ($conf['services']['db'])?1:0;
-		$vserver_server_enabled = ($conf['services']['vserver'])?1:0;
+		$vserver_server_enabled = ($conf['openvz']['installed'])?1:0;
 		$proxy_server_enabled = ($conf['services']['proxy'])?1:0;
 		$firewall_server_enabled = ($conf['services']['firewall'])?1:0;
-
-
-
-
 
 		$sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled', proxy_server = '$proxy_server_enabled', firewall_server = '$firewall_server_enabled' WHERE server_id = ".intval($conf['server_id']);
 
@@ -1737,10 +1750,18 @@
 		if($conf['apache']['installed'] == true){
 			$command = 'adduser '.$conf['apache']['user'].' ispconfig';
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
+			if(is_group('ispapps')){
+				$command = 'adduser '.$conf['apache']['user'].' ispapps';
+				caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
+			}
 		}
 		if($conf['nginx']['installed'] == true){
 			$command = 'adduser '.$conf['nginx']['user'].' ispconfig';
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
+			if(is_group('ispapps')){
+				$command = 'adduser '.$conf['nginx']['user'].' ispapps';
+				caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
+			}
 		}
 
 		//* Make the shell scripts executable
@@ -1808,8 +1829,14 @@
 				$content = str_replace('{fastcgi_ssl}', 'off', $content);
 			}
 			
-			$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
-
+			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
+			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
+			$fpm_socket = $socket_dir.'ispconfig.sock';
+			
+			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
+			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
+			
 			wf($vhost_conf_dir.'/ispconfig.vhost', $content);
 			
 			unset($content);
@@ -1818,7 +1845,8 @@
 			// Dont just copy over the php-fpm pool template but add some custom settings
 			$content = rf('tpl/php_fpm_pool.conf.master');
 			$content = str_replace('{fpm_pool}', 'ispconfig', $content);
-			$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
+			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
+			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 			$content = str_replace('{fpm_user}', 'ispconfig', $content);
 			$content = str_replace('{fpm_group}', 'ispconfig', $content);
 			wf($conf['nginx']['php_fpm_pool_dir'].'/ispconfig.conf', $content);

--
Gitblit v1.9.1