From 88d899db2dedb799fecf941d7021b1dd30d87a17 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 9 Jul 2008 19:32:11 +0000
Subject: [PATCH] Better debugging and exit conditions in mysql databse plugin.

---
 install/lib/installer_base.lib.php                     | 8 +++++---
 server/plugins-available/mysql_clientdb_plugin.inc.php | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 2f0f26d965..841e402d0f 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -657,8 +657,10 @@ class installer_base {
 		$install_dir = $this->conf['ispconfig_install_dir'];
 
 		//* Create the ISPConfig installation directory
-		$command = "mkdir $install_dir";
-		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
+		if(!@is_dir($install_dir)) {
+			$command = "mkdir $install_dir";
+			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
+		}
 		
 		//* Create a ISPConfig user and group
 		$command = 'groupadd ispconfig';
@@ -795,7 +797,7 @@ class installer_base {
 		//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")) {
+			if(!@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) {
 				exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/ispconfig.vhost");
 			}
 		}
diff --git a/server/plugins-available/mysql_clientdb_plugin.inc.php b/server/plugins-available/mysql_clientdb_plugin.inc.php
index 469937904b..7055c41e37 100644
--- a/server/plugins-available/mysql_clientdb_plugin.inc.php
+++ b/server/plugins-available/mysql_clientdb_plugin.inc.php
@@ -105,6 +105,7 @@ class mysql_clientdb_plugin {
 			$link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password);
 			if (!$link) {
 				$app->log('Unable to connect to the database'.mysql_error($link),LOGLEVEL_ERROR);
+				return;
 			}
 			
 			//* Rename User
@@ -164,6 +165,7 @@ class mysql_clientdb_plugin {
 			$link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password);
 			if (!$link) {
 				$app->log('Unable to connect to the database'.mysql_error($link),LOGLEVEL_ERROR);
+				return;
 			}
 			
 			//* Get the db host setting for the access priveliges
-- 
GitLab