From dea284f5715c8efda8a450ca8fffee6d8e78e83a Mon Sep 17 00:00:00 2001
From: fantu <fantu@ispconfig3>
Date: Tue, 18 Nov 2008 16:43:38 -0500
Subject: [PATCH] Improved merge in language editor: - Remove of the file how not exists in master language - Fix the msg show when no file has been created, removed or modified

---
 install/dist/lib/opensuse.lib.php |   41 +++++++++++++++++++++++++++++------------
 1 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php
index 2d64357..b041b78 100644
--- a/install/dist/lib/opensuse.lib.php
+++ b/install/dist/lib/opensuse.lib.php
@@ -642,8 +642,9 @@
 		//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
 		//* and create the symlink
 		if($this->install_ispconfig_interface == true) {
-			if(!@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) {
-				exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/ispconfig.vhost");
+			if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
+			if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
+				exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
 			}
 		}
 		
@@ -669,6 +670,9 @@
 		exec('chmod a+rx /usr/local/ispconfig');
 		exec('chmod -R 751 /usr/local/ispconfig/interface');
 		exec('chmod a+rx /usr/local/ispconfig/interface/web');
+		
+		//* Create the ispconfig log directory
+		if(!is_dir('/var/log/ispconfig')) mkdir('/var/log/ispconfig');
 		
 		
 	}
@@ -705,6 +709,11 @@
 		exec('crontab -u root -l > crontab.txt');
 		$existing_root_cron_jobs = file('crontab.txt');
 		
+		// remove existing ispconfig cronjobs, in case the syntax has changed
+		foreach($existing_root_cron_jobs as $key => $val) {
+			if(stristr($val,'/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
+		}
+		
 		$root_cron_jobs = array(
 			'* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null',
 			'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null'
@@ -719,19 +728,27 @@
 		unlink('crontab.txt');
 		
 		//* Getmail crontab
-        $cf = $conf['getmail'];
-		exec('crontab -u getmail -l > crontab.txt');
-		$existing_cron_jobs = file('crontab.txt');
+		if(is_user('getmail')) {
+        	$cf = $conf['getmail'];
+			exec('crontab -u getmail -l > crontab.txt');
+			$existing_cron_jobs = file('crontab.txt');
 		
-		$cron_jobs = array('*/5 * * * * '.$cf['program'].' -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf &> /dev/null');
-		foreach($cron_jobs as $cron_job) {
-			if(!in_array($cron_job."\n", $existing_cron_jobs)) {
-				$existing_cron_jobs[] = $cron_job."\n";
+			$cron_jobs = array('*/5 * * * * '.$cf['program'].' -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf &> /dev/null');
+			
+			// remove existing ispconfig cronjobs, in case the syntax has changed
+			foreach($cron_jobs as $key => $val) {
+				if(stristr($val,$cf['program'])) unset($cron_jobs[$key]);
 			}
+			
+			foreach($cron_jobs as $cron_job) {
+				if(!in_array($cron_job."\n", $existing_cron_jobs)) {
+					$existing_cron_jobs[] = $cron_job."\n";
+				}
+			}
+			file_put_contents('crontab.txt', $existing_cron_jobs);
+			exec('crontab -u getmail crontab.txt &> /dev/null');
+			unlink('crontab.txt');
 		}
-		file_put_contents('crontab.txt', $existing_cron_jobs);
-		exec('crontab -u getmail crontab.txt &> /dev/null');
-		unlink('crontab.txt');
 	}
 
 }

--
Gitblit v1.9.1