From bab36b51e6cf65db4557125a11ec584e005fefaa Mon Sep 17 00:00:00 2001 From: agoston <agoston@ispconfig3> Date: Thu, 03 Dec 2009 10:17:24 -0500 Subject: [PATCH] - removed number from conf[version] because it is the version of baselayout - as apache 2.2.14 the ssl directory moved to /etc/ssl/apache2 from /etc/apache2/ssl --- install/update.php | 64 +++++++++++++++++++++++++------- 1 files changed, 50 insertions(+), 14 deletions(-) diff --git a/install/update.php b/install/update.php index fcec0a8..479ad9e 100644 --- a/install/update.php +++ b/install/update.php @@ -149,18 +149,46 @@ system("mysqldump -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -c -t --add-drop-table --all --quick ".$conf['mysql']['database']." > existing_db.sql"); } +// create a backup copy of the ispconfig database in the root folder +$backup_db_name = '/root/ispconfig_db_backup_'.@date('Y-m-d_h-i').'.sql'; +copy('existing_db.sql',$backup_db_name); +exec("chmod 700 $backup_db_name"); +exec("chown root:root $backup_db_name"); + //* initialize the database $inst->db = new db(); //* initialize the master DB, if we have a multiserver setup if($conf['mysql']['master_slave_setup'] == 'y') { - $inst->dbmaster = new db(); - if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); - $inst->dbmaster->dbHost = $conf['mysql']["master_host"]; - $inst->dbmaster->dbName = $conf['mysql']["master_database"]; - $inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"]; - $inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"]; + //** Get MySQL root credentials + $finished = false; + do { + $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host']); + $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user']); + $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password']); + $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']); + + //* Initialize the MySQL server connection + if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { + $conf['mysql']['master_host'] = $tmp_mysql_server_host; + $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; + $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; + $conf['mysql']['master_database'] = $tmp_mysql_server_database; + $finished = true; + } else { + swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); + } + } while ($finished == false); + unset($finished); + + // initialize the connection to the master database + $inst->dbmaster = new db(); + if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); + $inst->dbmaster->dbHost = $conf['mysql']["master_host"]; + $inst->dbmaster->dbName = $conf['mysql']["master_database"]; + $inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"]; + $inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"]; } else { $inst->dbmaster = $inst->db; } @@ -188,8 +216,14 @@ //** Create the mysql database $inst->configure_database(); -//** Update master database rights -$inst->grant_master_database_rights(); +if($conf['mysql']['master_slave_setup'] == 'y') { + //** Update master database rights + $reconfigure_master_database_rights_answer = $inst->simple_query('Reconfigure Permissions in master database?', array('yes','no'),'no'); + + if($reconfigure_master_database_rights_answer == 'yes') { + $inst->grant_master_database_rights(); + } +} //** empty all databases $db_tables = $inst->db->getTables(); @@ -207,12 +241,6 @@ system("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' ".$conf['mysql']['database']." < existing_db.sql"); } - -// create a backup copy of the ispconfig database in the root folder -$backup_db_name = '/root/ispconfig_db_backup_'.@date('Y-m-d_h-i').'.sql'; -copy('existing_db.sql',$backup_db_name); -exec("chmod 700 $backup_db_name"); -exec("chown root:root $backup_db_name"); //** Update server ini @@ -314,6 +342,9 @@ if($conf['powerdns']['installed'] == true) { swriteln('Configuring PowerDNS'); $inst->configure_powerdns(); + } elseif($conf['bind']['installed'] == true) { + swriteln('Configuring BIND'); + $inst->configure_bind(); } else { swriteln('Configuring MyDNS'); $inst->configure_mydns(); @@ -328,6 +359,10 @@ //** Configure vlogger swriteln('Configuring vlogger'); $inst->configure_vlogger(); + + //** Configure apps vhost + swriteln('Configuring Apps vhost'); + $inst->configure_apps_vhost(); } @@ -381,6 +416,7 @@ if($conf['services']['dns']) { if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['mydns']['init_script'])) system($conf['init_scripts'].'/'.$conf['mydns']['init_script'].' restart &> /dev/null'); if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['powerdns']['init_script'])) system($conf['init_scripts'].'/'.$conf['powerdns']['init_script'].' restart &> /dev/null'); + if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['bind']['init_script'])) system($conf['init_scripts'].'/'.$conf['bind']['init_script'].' restart &> /dev/null'); } } -- Gitblit v1.9.1