From 0c1bc352c2f2984b19e43cc5e6182976a155fc0c Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Sun, 15 Nov 2015 07:24:18 -0500
Subject: [PATCH] Merge branch 'master' of git.ispconfig.org:ispconfig/ispconfig3

---
 server/plugins-available/apache2_plugin.inc.php        |    5 +++--
 server/plugins-available/mailman_plugin.inc.php        |   10 +++++++++-
 server/plugins-available/nginx_plugin.inc.php          |    5 +++--
 server/plugins-available/postfix_server_plugin.inc.php |   39 +++++++++++++++++++++------------------
 4 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 25147e4..1b5a4c2 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -595,7 +595,7 @@
 				
 				//* Unmount the old log directory bfore we move the log dir
 				//exec('fuser -km '.escapeshellcmd($old_dir.'/log'));
-				exec('umount '.escapeshellcmd($old_dir.'/log'));
+				exec('umount '.escapeshellcmd($data['old']['document_root'].'/log'));
 
 				//* Create new base directory, if it does not exist yet
 				if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
@@ -691,7 +691,8 @@
 			$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 			exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
 			//* add mountpoint to fstab
-			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait,_netdev    0 0';
+			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait';
+			$fstab_line .= @($web_config['network_filesystem'] == 'y')?',_netdev    0 0':'    0 0';
 			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 		}
 
diff --git a/server/plugins-available/mailman_plugin.inc.php b/server/plugins-available/mailman_plugin.inc.php
index 0d282f5..b15cd73 100644
--- a/server/plugins-available/mailman_plugin.inc.php
+++ b/server/plugins-available/mailman_plugin.inc.php
@@ -73,7 +73,15 @@
 
 		$this->update_config();
 
-		exec("nohup /usr/lib/mailman/bin/newlist -u ".escapeshellcmd($data["new"]["domain"])." -e ".escapeshellcmd($data["new"]["domain"])." ".escapeshellcmd($data["new"]["listname"])." ".escapeshellcmd($data["new"]["email"])." ".escapeshellcmd($data["new"]["password"])." >/dev/null 2>&1 &");
+		$pid = exec("nohup /usr/lib/mailman/bin/newlist -u ".escapeshellcmd($data["new"]["domain"])." -e ".escapeshellcmd($data["new"]["domain"])." ".escapeshellcmd($data["new"]["listname"])." ".escapeshellcmd($data["new"]["email"])." ".escapeshellcmd($data["new"]["password"])." >/dev/null 2>&1 & echo $!;");
+		// wait for /usr/lib/mailman/bin/newlist-call
+		$running = true;
+		do {
+			exec('ps -p '.intval($pid), $out);
+			if (count($out) ==1) $running=false; else sleep(1);
+			unset($out);
+		} while ($running);
+		unset($out);
 		if(is_file('/var/lib/mailman/data/virtual-mailman')) exec('postmap /var/lib/mailman/data/virtual-mailman');
 		if(is_file('/var/lib/mailman/data/transport-mailman')) exec('postmap /var/lib/mailman/data/transport-mailman');
 		exec('nohup '.$conf['init_scripts'] . '/' . 'mailman reload >/dev/null 2>&1 &');
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 7be49ce..7bb4f8c 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -476,7 +476,7 @@
 				
 				//* Unmount the old log directory bfore we move the log dir
 				//exec('fuser -km '.escapeshellcmd($old_dir.'/log'));
-				exec('umount '.escapeshellcmd($old_dir.'/log'));
+				exec('umount '.escapeshellcmd($data['old']['document_root'].'/log'));
 
 				//* Create new base directory, if it does not exist yet
 				if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
@@ -572,7 +572,8 @@
 			$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 			exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
 			//* add mountpoint to fstab
-			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait,_netdev    0 0';
+			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait';
+			$fstab_line .= @($web_config['network_filesystem'] == 'y')?',_netdev    0 0':'    0 0';
 			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 		}
 
diff --git a/server/plugins-available/postfix_server_plugin.inc.php b/server/plugins-available/postfix_server_plugin.inc.php
index 87ae500..64c5571 100644
--- a/server/plugins-available/postfix_server_plugin.inc.php
+++ b/server/plugins-available/postfix_server_plugin.inc.php
@@ -161,27 +161,30 @@
 			exec('postfix reload');
 		}		
 		
-		if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') {
-			// If dovecot switch to lmtp
-			if($app->system->is_installed('dovecot')) {
-				exec("postconf -e 'virtual_transport = lmtp:unix:private/dovecot-lmtp'");
-				exec('postfix reload');
-				$app->system->replaceLine("/etc/dovecot/dovecot.conf", "protocols = imap pop3", "protocols = imap pop3 lmtp");
-				exec($conf['init_scripts'] . '/' . 'dovecot restart');
-			}
-		}
-		else {
-			// If dovecot switch to dovecot
-			if($app->system->is_installed('dovecot')) {
-				exec("postconf -e 'virtual_transport = dovecot'");
-				exec('postfix reload');
-				$app->system->replaceLine("/etc/dovecot/dovecot.conf", "protocols = imap pop3 lmtp", "protocols = imap pop3");
-				exec($conf['init_scripts'] . '/' . 'dovecot restart');
+		if($app->system->is_installed('dovecot')) {
+			$temp = exec("postconf -n virtual_transport", $out);
+			if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') {
+				// If dovecot switch to lmtp
+				if($out[0] != "virtual_transport = lmtp:unix:private/dovecot-lmtp") {
+					exec("postconf -e 'virtual_transport = lmtp:unix:private/dovecot-lmtp'");
+					exec('postfix reload');
+					$app->system->replaceLine("/etc/dovecot/dovecot.conf", "protocols = imap pop3", "protocols = imap pop3 lmtp");
+					exec($conf['init_scripts'] . '/' . 'dovecot restart');
+				}
+			} else {
+				// If dovecot switch to dovecot
+				if($out[0] != "virtual_transport = dovecot") {
+					exec("postconf -e 'virtual_transport = dovecot'");
+					exec('postfix reload');
+					$app->system->replaceLine("/etc/dovecot/dovecot.conf", "protocols = imap pop3 lmtp", "protocols = imap pop3");
+					exec($conf['init_scripts'] . '/' . 'dovecot restart');
+				}
 			}
 		}
 
-		exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'");
-		exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'");
+		exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'"); //TODO : no reload?
+		exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'"); //TODO : no reload?
+		
 
 	}
 

--
Gitblit v1.9.1