From e2c00a1762d1313e32f9fed330406b2e38d1af5b Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Mon, 26 Mar 2012 12:33:34 -0400
Subject: [PATCH] - Added restart function for PHP-FPM.

---
 install/lib/installer_base.lib.php |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 0021057..ae279ab 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -635,7 +635,7 @@
 
 		//* If there are RBL's defined, format the list and add them to smtp_recipient_restrictions to prevent removeal after an update
 		$rbl_list = '';
-		if ($server_ini_array['mail']['realtime_blackhole_list'] != '') {
+		if (@isset($server_ini_array['mail']['realtime_blackhole_list']) && $server_ini_array['mail']['realtime_blackhole_list'] != '') {
 			$rbl_hosts = explode(",",str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
 			foreach ($rbl_hosts as $key => $value) {
 				$rbl_list .= ", reject_rbl_client ". $value;
@@ -895,12 +895,25 @@
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
 
-		//* copy dovecot.conf
+		//* backup dovecot.conf
 		$configfile = 'dovecot.conf';
 		if(is_file($config_dir.'/'.$configfile)) {
 			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
 		}
-		copy('tpl/debian_dovecot.conf.master',$config_dir.'/'.$configfile);
+		
+		//* Get the dovecot version
+		exec('dovecot --version',$tmp);
+		$parts = explode('.',trim($tmp[0]));
+		$dovecot_version = $parts[0];
+		unset($tmp);
+		unset($parts);
+		
+		//* Copy dovecot configuration file
+		if($dovecot_version == 2) {
+			copy('tpl/debian_dovecot2.conf.master',$config_dir.'/'.$configfile);
+		} else {
+			copy('tpl/debian_dovecot.conf.master',$config_dir.'/'.$configfile);
+		}
 
 		//* dovecot-sql.conf
 		$configfile = 'dovecot-sql.conf';
@@ -1608,6 +1621,7 @@
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
 		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
 		$content = str_replace('{language}', $conf['language'], $content);
+		$content = str_replace('{timezone}', $conf['timezone'], $content);
 
 		wf($install_dir.'/interface/lib/'.$configfile, $content);
 
@@ -1630,6 +1644,7 @@
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
 		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
 		$content = str_replace('{language}', $conf['language'], $content);
+		$content = str_replace('{timezone}', $conf['timezone'], $content);
 
 		wf($install_dir.'/server/lib/'.$configfile, $content);
 
@@ -1763,7 +1778,7 @@
 			chgrp($install_dir.'/server/lib/mysql_clientdb.conf', 'root');
 		}
 		
-		if(is_file($install_dir.'/interface/invoices')) {
+		if(is_dir($install_dir.'/interface/invoices')) {
 			chmod($install_dir.'/interface/invoices', 0770);
 			chown($install_dir.'/interface/invoices', 'ispconfig');
 			chgrp($install_dir.'/interface/invoices', 'ispconfig');
@@ -1845,11 +1860,11 @@
 			$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
 		
 			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
-				$content = str_replace('{ssl_on}', ' ssl', $content);
+				$content = str_replace('{ssl_on}', 'on', $content);
 				$content = str_replace('{ssl_comment}', '', $content);
 				$content = str_replace('{fastcgi_ssl}', 'on', $content);
 			} else {
-				$content = str_replace('{ssl_on}', '', $content);
+				$content = str_replace('{ssl_on}', 'off', $content);
 				$content = str_replace('{ssl_comment}', '#', $content);
 				$content = str_replace('{fastcgi_ssl}', 'off', $content);
 			}

--
Gitblit v1.9.1