swriteln($inst->lng(' Default values are in [brackets] and can be accepted with <ENTER>.')); swriteln($inst->lng(' Tap in "quit" (without the quotes) to stop the installer.' . "\n\n")); //** Check log file is writable (probably not root or sudo) if (!is_writable(dirname(ISPC_LOG_FILE))) { die("ERROR: Cannot write to the " . dirname(ISPC_LOG_FILE) . " directory. Are you root or sudo ?\n\n"); } if (is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) { die('This software cannot be installed on a server wich runs ISPConfig 2.x.'); } if (is_dir('/usr/local/ispconfig')) { die('ISPConfig 3 installation found. Please use update.php instead if install.php to update the installation.'); } //** Detect the installed applications $inst->find_installed_apps(); //** Select the language and set default timezone $conf['language'] = $inst->simple_query('Select language', array('en', 'de'), 'en'); $conf['timezone'] = get_system_timezone(); //* Set defaukt theme $conf['theme'] = 'default'; //** Select installation mode $install_mode = $inst->simple_query('Installation mode', array('standard', 'expert'), 'standard'); //** Get the hostname $tmp_out = array(); exec('hostname -f', $tmp_out); $conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', @$tmp_out[0]); unset($tmp_out); // Check if the mysql functions are loaded in PHP if (!function_exists('mysql_connect')) { die('No PHP MySQL functions available. Please ensure that the PHP MySQL module is loaded.'); } //** Get MySQL root credentials
if ($conf["mysql"]["master_host"] != '' && $conf["mysql"]["host"] != $conf["mysql"]["master_host"]) { $conf['mysql']['master_slave_setup'] = 'y'; } // Resolve the IP address of the mysql hostname. if (!($conf['mysql']['ip'] = gethostbyname($conf['mysql']['host']))) { die('Unable to resolve hostname' . $conf['mysql']['host']); } $conf['server_id'] = intval($conf_old["server_id"]); $conf['ispconfig_log_priority'] = $conf_old["log_priority"]; $inst = new installer(); $inst->is_update = true; //** Detect the installed applications $inst->find_installed_apps(); echo "This application will update ISPConfig 3 on your server.\n\n"; //* Make a backup before we start the update $do_backup = $inst->simple_query('Shall the script create a ISPConfig backup in /var/backup/ now?', array('yes', 'no'), 'yes', 'do_backup'); if ($do_backup == 'yes') { //* Create the backup directory $backup_path = '/var/backup/ispconfig_' . @date('Y-m-d_H-i'); $conf['backup_path'] = $backup_path; exec("mkdir -p {$backup_path}"); exec("chown root:root {$backup_path}"); exec("chmod 700 {$backup_path}"); //* Do the backup swriteln('Creating backup of "/usr/local/ispconfig" directory...'); exec("tar pcfz {$backup_path}/ispconfig_software.tar.gz /usr/local/ispconfig 2> /dev/null", $out, $returnvar); if ($returnvar != 0) { die("Backup failed. We stop here...\n"); } swriteln('Creating backup of "/etc" directory...'); exec("tar pcfz {$backup_path}/etc.tar.gz /etc 2> /dev/null", $out, $returnvar);
/* * Check all tables */ checkDbHealth(); /* * dump the new Database and reconfigure the server.ini */ updateDbAndIni(); /* * Reconfigure the permisson if needed * (if this is done at client side, only this client is updated. * If this is done at server side, all clients are updated. */ //if($conf_old['dbmaster_user'] != '' or $conf_old['dbmaster_host'] != '') { //** 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(); } //} //** Shall the services be reconfigured during update $reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes', 'no'), 'yes'); if ($reconfigure_services_answer == 'yes') { if ($conf['services']['mail']) { //** Configure postfix swriteln('Configuring Postfix'); $inst->configure_postfix('dont-create-certs'); //** Configure mailman swriteln('Configuring Mailman'); $inst->configure_mailman('update'); //* Configure Jailkit