| | |
| | | ISPConfig 3 updater. |
| | | */ |
| | | |
| | | die("Autoupdate has been removed.\nPlease start the update on the shell with the command ispconfig_update.sh as root user.\n"); |
| | | |
| | | error_reporting(E_ALL|E_STRICT); |
| | | |
| | | /* |
| | |
| | | //** Get distribution identifier |
| | | $dist = get_distname(); |
| | | |
| | | if($dist['id'] == '') die('Linux Dustribution or Version not recognized.'); |
| | | |
| | | //** Include the distribution specific installer class library and configuration |
| | | if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php'); |
| | | include_once('dist/lib/'.$dist['id'].'.lib.php'); |
| | | include_once('dist/conf/'.$dist['id'].'.conf.php'); |
| | | |
| | | include_once("/usr/local/ispconfig/server/lib/config.inc.php"); |
| | | $conf_old = $conf; |
| | | unset($conf); |
| | | |
| | | if($dist['id'] == '') die('Linux distribution or version not recognized.'); |
| | | |
| | | //** Include the distribution-specific installer class library and configuration |
| | | if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php'); |
| | | include_once('dist/lib/'.$dist['id'].'.lib.php'); |
| | | include_once('dist/conf/'.$dist['id'].'.conf.php'); |
| | | |
| | | //** Get hostname |
| | | exec('hostname -f', $tmp_out); |
| | |
| | | |
| | | /* |
| | | * Try to read the DB-admin settings |
| | | */ |
| | | */ |
| | | $clientdb_host = ''; |
| | | $clientdb_user = ''; |
| | | $clientdb_password = ''; |
| | |
| | | die("internal error - MYSQL-Root passord not known"); |
| | | } |
| | | |
| | | //** Test mysql root connection |
| | | if(!@mysql_connect($conf["mysql"]["host"],$conf["mysql"]["admin_user"],$conf["mysql"]["admin_password"])) { |
| | | die("internal error - MYSQL-Root passord wrong"); |
| | | } |
| | | |
| | | /* |
| | | * Check all tables |
| | | */ |
| | | checkDbHealth(); |
| | | |
| | | /* |
| | | * Prepare the dump of the database |
| | | */ |
| | |
| | | $inst->db = new db(); |
| | | |
| | | /* |
| | | * The next line is a bit tricky! |
| | | * At the automated update we have no connection to the master-db (we don't need it, because |
| | | * there are only TWO points, where this is needed) |
| | | * 1) update the rights --> the autoupdater sets the rights of all clients when the server is |
| | | * autoupdated) |
| | | * 2) update the server-settings (is web installed, is mail installed) --> the autoupdates |
| | | * doesn't change any of this settings, so there ist no need to update this. |
| | | * This means, the autoupdater did not need any connection to the master-db (only to the local bd |
| | | * of the master-server). To avoid any problems, we set the master-db to the local one. |
| | | */ |
| | | $inst->dbmaster = $inst->db; |
| | | |
| | | /* |
| | | * If it is NOT a master-slave - Setup then we are at the Master-DB. So set all rights |
| | | */ |
| | | if($conf['mysql']['master_slave_setup'] != 'y') { |
| | | $inst->dbmaster = $inst->db; |
| | | $inst->grant_master_database_rights(); |
| | | echo "done rights"; |
| | | $inst->grant_master_database_rights(true); |
| | | } |
| | | |
| | | /* |
| | | * dump the new Database and reconfigure the server.ini |
| | | */ |
| | | */ |
| | | updateDbAndIni(); |
| | | |
| | | /* |
| | | * Reconfigure all Services |
| | | */ |
| | | */ |
| | | if($conf['services']['mail'] == true) { |
| | | //** Configure postfix |
| | | swriteln('Configuring Postfix'); |
| | | $inst->configure_postfix('dont-create-certs'); |
| | | |
| | | //** Configure mailman |
| | | swriteln('Configuring Mailman'); |
| | | $inst->configure_mailman('update'); |
| | | |
| | | //* Configure Jailkit |
| | | swriteln('Configuring Jailkit'); |
| | | $inst->configure_jailkit(); |
| | | |
| | | //** Configure saslauthd |
| | | swriteln('Configuring SASL'); |
| | | $inst->configure_saslauthd(); |
| | | |
| | | //** Configure PAM |
| | | swriteln('Configuring PAM'); |
| | | $inst->configure_pam(); |
| | | |
| | | if($conf['dovecot']['installed'] == true) { |
| | | //* Configure dovecot |
| | | swriteln('Configuring Dovecot'); |
| | | $inst->configure_dovecot(); |
| | | } else { |
| | | //** Configure saslauthd |
| | | swriteln('Configuring SASL'); |
| | | $inst->configure_saslauthd(); |
| | | |
| | | //** Configure PAM |
| | | swriteln('Configuring PAM'); |
| | | $inst->configure_pam(); |
| | | |
| | | //* Configure courier |
| | | swriteln('Configuring Courier'); |
| | | $inst->configure_courier(); |
| | |
| | | } |
| | | } |
| | | |
| | | if($conf['services']['web'] == true) { |
| | | //** Configure Apache |
| | | swriteln('Configuring Apache'); |
| | | $inst->configure_apache(); |
| | | |
| | | //** Configure vlogger |
| | | swriteln('Configuring vlogger'); |
| | | $inst->configure_vlogger(); |
| | | |
| | | if($conf['services']['web']) { |
| | | if($conf['webserver']['server_type'] == 'apache'){ |
| | | //** Configure Apache |
| | | swriteln('Configuring Apache'); |
| | | $inst->configure_apache(); |
| | | |
| | | //** Configure vlogger |
| | | swriteln('Configuring vlogger'); |
| | | $inst->configure_vlogger(); |
| | | } else { |
| | | //** Configure nginx |
| | | swriteln('Configuring nginx'); |
| | | $inst->configure_nginx(); |
| | | } |
| | | |
| | | //** Configure apps vhost |
| | | swriteln('Configuring Apps vhost'); |
| | | $inst->configure_apps_vhost(); |
| | |
| | | |
| | | |
| | | //** Customise the port ISPConfig runs on |
| | | $conf['apache']['vhost_port'] = '8080'; |
| | | $conf['apache']['vhost_port'] = get_ispconfig_port_number(); |
| | | |
| | | $inst->install_ispconfig(); |
| | | |
| | |
| | | |
| | | //** Restart services: |
| | | swriteln('Restarting services ...'); |
| | | if($conf['mysql']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['mysql']['init_script'])) system($conf['init_scripts'].'/'.$conf['mysql']['init_script'].' restart'); |
| | | if($conf['mysql']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mysql']['init_script'])) system($conf['init_scripts'].'/'.$conf['mysql']['init_script'].' reload'); |
| | | if($conf['services']['mail']) { |
| | | if($conf['postfix']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['postfix']['init_script'])) system($conf['init_scripts'].'/'.$conf['postfix']['init_script'].' restart'); |
| | | if($conf['saslauthd']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'])) system($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'].' restart'); |
| | | if($conf['amavis']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['amavis']['init_script'])) system($conf['init_scripts'].'/'.$conf['amavis']['init_script'].' restart'); |
| | | if($conf['clamav']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['clamav']['init_script'])) system($conf['init_scripts'].'/'.$conf['clamav']['init_script'].' restart'); |
| | | if($conf['courier']['courier-authdaemon'] != '' && is_file($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'].' restart'); |
| | | if($conf['courier']['courier-imap'] != '' && is_file($conf['init_scripts'].'/'.$conf['courier']['courier-imap'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap'].' restart'); |
| | | if($conf['courier']['courier-imap-ssl'] != '' && is_file($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'].' restart'); |
| | | if($conf['courier']['courier-pop'] != '' && is_file($conf['init_scripts'].'/'.$conf['courier']['courier-pop'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart'); |
| | | if($conf['courier']['courier-pop-ssl'] != '' && is_file($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart'); |
| | | if($conf['dovecot']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['dovecot']['init_script'])) system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart'); |
| | | if($conf['postfix']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['postfix']['init_script'])) system($conf['init_scripts'].'/'.$conf['postfix']['init_script'].' restart'); |
| | | if($conf['saslauthd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'])) system($conf['init_scripts'].'/'.$conf['saslauthd']['init_script'].' restart'); |
| | | if($conf['amavis']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['amavis']['init_script'])) system($conf['init_scripts'].'/'.$conf['amavis']['init_script'].' restart'); |
| | | if($conf['clamav']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['clamav']['init_script'])) system($conf['init_scripts'].'/'.$conf['clamav']['init_script'].' restart'); |
| | | if($conf['courier']['courier-authdaemon'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-authdaemon'].' restart'); |
| | | if($conf['courier']['courier-imap'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap'].' restart'); |
| | | if($conf['courier']['courier-imap-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-imap-ssl'].' restart'); |
| | | if($conf['courier']['courier-pop'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop'].' restart'); |
| | | if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart'); |
| | | if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script'])) system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart'); |
| | | if($conf['mailman']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mailman']['init_script'])) system($conf['init_scripts'].'/'.$conf['mailman']['init_script'].' restart'); |
| | | } |
| | | if($conf['services']['web']) { |
| | | if($conf['apache']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart'); |
| | | if($conf['pureftpd']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart'); |
| | | if($conf['webserver']['server_type'] == 'apache' && $conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart'); |
| | | //* Reload is enough for nginx |
| | | if($conf['webserver']['server_type'] == 'nginx' && $conf['nginx']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['nginx']['init_script'])) system($conf['init_scripts'].'/'.$conf['nginx']['init_script'].' reload'); |
| | | if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart'); |
| | | } |
| | | 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'); |
| | | if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '' && is_executable($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_executable($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_executable($conf['init_scripts'].'/'.$conf['bind']['init_script'])) system($conf['init_scripts'].'/'.$conf['bind']['init_script'].' restart &> /dev/null'); |
| | | } |
| | | |
| | | echo "Update finished.\n"; |
| | | |
| | | ?> |
| | | ?> |