From 239ce82f07a17a0214db0198d5fcb26e2683d89d Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Sat, 11 Aug 2007 15:08:25 +0000 Subject: [PATCH] --- install/install.php | 23 +++++++++++++++-------- install/lib/install.lib.php | 4 ++-- install/lib/installer_base.lib.php | 19 ++++++++++++------- install/lib/mysql.lib.php | 1 + install/tpl/mydns.conf.master | 2 +- 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/install/install.php b/install/install.php index 59c1d4001d..7c6956bec1 100644 --- a/install/install.php +++ b/install/install.php @@ -53,7 +53,7 @@ $inst = new installer(); -swriteln($inst->lng("This application will install ISPConfig 3 on your server."); +swriteln($inst->lng("This application will install ISPConfig 3 on your server.")); // Select the language $conf["language"] = $inst->simple_query('Select language',array('en','de'),'en'); @@ -70,20 +70,27 @@ unset($tmp_out); // Get MySQL root password -include_once('lib/mysql.lib.php'); $finished = false; do { - $conf["mysql_server_admin_password"] = $inst->free_query('MySQL root password',''); + $tmp_mysql_server_host = $inst->free_query('MySQL server hostname',$conf["mysql_server_host"]); + $tmp_mysql_server_admin_user = $inst->free_query('MySQL root username',$conf["mysql_server_admin_user"]); + $tmp_mysql_server_admin_password = $inst->free_query('MySQL root password',$conf["mysql_server_admin_password"]); + // Initialize the MySQL server connection - $inst->db = new db(); - if($inst->db->connect() == false) { - swriteln($inst->db->errorMessage); - } else { + if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { + $conf["mysql_server_host"] = $tmp_mysql_server_host; + $conf["mysql_server_admin_user"] = $tmp_mysql_server_admin_user; + $conf["mysql_server_admin_password"] = $tmp_mysql_server_admin_password; $finished = true; + } else { + swriteln($inst->lng("Unable to connect to mysql server").' '.mysql_error()); } } while ($finished == false); +unset($finished); - +// initializing database connection +include_once('lib/mysql.lib.php'); +$inst->db = new db(); // Begin with standard or expert installation if($install_mode == 'Standard') { diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php index 9dc0686bd8..513f09eb88 100644 --- a/install/lib/install.lib.php +++ b/install/lib/install.lib.php @@ -49,11 +49,11 @@ function sread() { return rtrim($input); } -function swrite($text) { +function swrite($text = '') { echo $text; } -function swriteln($text) { +function swriteln($text = '') { echo $text."\n"; } diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index e152fe8953..c7bf3fd718 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -52,12 +52,13 @@ class installer_base { $finished = false; do { $answers_str = implode(",",$answers); - swriteln($this->lng($query).' ('.$answers_str.') ['.$default.']:'); + swrite($this->lng($query).' ('.$answers_str.') ['.$default.']: '); $input = sread(); // Stop the installation if($input == 'quit') { - die($this->lng('Installation interrupted.')); + swriteln($this->lng('Installation interrupted.')); + die(); } // Select the default @@ -72,26 +73,30 @@ class installer_base { } } while ($finished == false); + swriteln(); return $answer; } function free_query($query,$default) { global $conf; - $answers_str = implode(",",$answers); - swriteln($this->lng($query).' ['.$default.']:'); + swrite($this->lng($query).' ['.$default.']: '); $input = sread(); // Stop the installation if($input == 'quit') { - die($this->lng('Installation interrupted.')); + swriteln($this->lng('Installation interrupted.')); + die(); } // Select the default if($input == '') { $answer = $default; + } else { + $answer = $input; } - + swriteln(); + return $answer; } @@ -534,7 +539,7 @@ maildrop unix - n n - - pipe $content = str_replace('{mysql_server_ispconfig_user}',$conf["mysql_server_ispconfig_user"],$content); $content = str_replace('{mysql_server_ispconfig_password}',$conf["mysql_server_ispconfig_password"],$content); $content = str_replace('{mysql_server_database}',$conf["mysql_server_database"],$content); - $content = str_replace('{mysql_server_ip}',$conf["mysql_server_ip"],$content); + $content = str_replace('{mysql_server_host}',$conf["mysql_server_host"],$content); $content = str_replace('{server_id}',$conf["server_id"],$content); wf($conf["dist_mydns_config_dir"].'/'.$configfile,$content); exec('chmod 600 '.$conf["dist_mydns_config_dir"].'/'.$configfile); diff --git a/install/lib/mysql.lib.php b/install/lib/mysql.lib.php index 5cf4f0a594..dd85628ef0 100644 --- a/install/lib/mysql.lib.php +++ b/install/lib/mysql.lib.php @@ -73,6 +73,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. if($this->linkId == 0) { $this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass); + if(!$this->linkId) { $this->updateError('DB::connect()<br />mysql_connect'); diff --git a/install/tpl/mydns.conf.master b/install/tpl/mydns.conf.master index 4828cc1e9e..d790ab88fe 100644 --- a/install/tpl/mydns.conf.master +++ b/install/tpl/mydns.conf.master @@ -14,7 +14,7 @@ # DATABASE INFORMATION -db-host = {mysql_server_ip} # SQL server hostname +db-host = {mysql_server_host} # SQL server hostname db-user = {mysql_server_ispconfig_user} # SQL server username db-password = {mysql_server_ispconfig_password} # SQL server password database = {mysql_server_database} # MyDNS database name -- GitLab