| | |
| | | // Include the base class of the installer class |
| | | require_once('lib/installer_base.lib.php'); |
| | | |
| | | include_once("options.conf.php"); |
| | | $conf['dist'] = $dist; |
| | | //** Install logfile |
| | | define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); |
| | | |
| | | //** Get distribution identifier |
| | | $distname = get_distname(); |
| | | |
| | | include_once("/usr/local/ispconfig/server/lib/config.inc.php"); |
| | |
| | | |
| | | // Initialize the MySQL server connection |
| | | include_once('lib/mysql.lib.php'); |
| | | $inst->db = new db(); |
| | | |
| | | // Database update is a bit brute force and should be rebuild later ;) |
| | | |
| | | // export the current database data |
| | | if($conf["mysql"]["admin_password"] != '') { |
| | | system("mysqldump -h $conf[mysql_server_host] -u $conf[mysql_server_admin_user] -p$conf[mysql_server_admin_password] -c -t --add-drop-table --all --quick $conf[mysql_server_database] > existing_db.sql"); |
| | | } else { |
| | | system("mysqldump -h $conf[mysql_server_host] -u $conf[mysql_server_admin_user] -c -t --add-drop-table --all --quick $conf[mysql_server_database] > existing_db.sql"); |
| | | if( empty($conf["mysql"]["admin_password"]) ) { |
| | | |
| | | $conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']); |
| | | } |
| | | |
| | | if( !empty($conf["mysql"]["admin_password"]) ) { |
| | | |
| | | system("mysqldump -h ".$conf['mysql']['host']." -u ".$conf['mysql']['admin_user']." -p".$conf['mysql']['admin_password']." -c -t --add-drop-table --all --quick ".$conf['mysql']['database']." > existing_db.sql"); |
| | | } |
| | | else { |
| | | |
| | | system("mysqldump -h ".$conf['mysql']['host']." -u ".$conf['mysql']['admin_user']." -c -t --add-drop-table --all --quick ".$conf['mysql']['database']." > existing_db.sql"); |
| | | } |
| | | |
| | | // Delete the old database |
| | | $inst->db = new db(); |
| | | |
| | | if( !$inst->db->query('DROP DATABASE IF EXISTS '.$conf['mysql']['database']) ) { |
| | | |
| | | $inst->error('Unable to drop MySQL database: '.$conf['mysql']['database'].'.'); |
| | | } |
| | | |
| | | |
| | | // Delete the old database |
| | | exec("/etc/init.d/mysql stop"); |
| | | /*exec("/etc/init.d/mysql stop"); |
| | | sleep(3); |
| | | if($conf["mysql"]["database"] != '') exec("rm -rf /var/lib/mysql/".$conf["mysql"]["database"]); |
| | | exec("/etc/init.d/mysql start"); |
| | | sleep(5); |
| | | sleep(5);*/ |
| | | |
| | | // Create the mysql database |
| | | $inst->configure_database(); |
| | |
| | | |
| | | // load old data back into database |
| | | if($conf["mysql"]["admin_password"] != '') { |
| | | system("mysql -h $conf[mysql_server_host] -u $conf[mysql_server_admin_user] -p$conf[mysql_server_admin_password] $conf[mysql_server_database] < existing_db.sql"); |
| | | system("mysql -h ".$conf['mysql']['host']." -u ".$conf['mysql']['admin_user']." -p".$conf['mysql']['admin_password']." ".$conf['mysql']['database']." < existing_db.sql"); |
| | | } else { |
| | | system("mysql -h $conf[mysql_server_host] -u $conf[mysql_server_admin_user] $conf[mysql_server_database] < existing_db.sql"); |
| | | system("mysql -h ".$conf['mysql']['host']." -u ".$conf['mysql']['admin_user']." ".$conf['mysql']['database']." < existing_db.sql"); |
| | | } |
| | | // Configure postfix |
| | | $inst->configure_postfix('dont-create-certs'); |