diff --git a/docs/autoinstall_samples/autoinstall.conf_sample.php b/docs/autoinstall_samples/autoinstall.conf_sample.php index 187dc68b5c3d65f88f4f3e938b4c0eff754e564b..c55add3a8ab8aa05dc423289d71d4a314a3beb14 100644 --- a/docs/autoinstall_samples/autoinstall.conf_sample.php +++ b/docs/autoinstall_samples/autoinstall.conf_sample.php @@ -49,4 +49,14 @@ $autoupdate['reconfigure_services'] = 'yes'; // yes (default), no $autoupdate['ispconfig_port'] = '8080'; // default: 8080 $autoupdate['create_new_ispconfig_ssl_cert'] = 'no'; // no (default), yes $autoupdate['reconfigure_crontab'] = 'yes'; // yes (default), no + +/* These are for service-detection (defaulting to old behaviour where alle changes were automatically accepted) */ +$autoupdate['svc_detect_change_mail_server'] = 'yes'; // yes (default), no +$autoupdate['svc_detect_change_web_server'] = 'yes'; // yes (default), no +$autoupdate['svc_detect_change_dns_server'] = 'yes'; // yes (default), no +$autoupdate['svc_detect_change_xmpp_server'] = 'yes'; // yes (default), no +$autoupdate['svc_detect_change_firewall_server'] = 'yes'; // yes (default), no +$autoupdate['svc_detect_change_vserver_server'] = 'yes'; // yes (default), no +$autoupdate['svc_detect_change_db_server'] = 'yes'; // yes (default), no + ?> \ No newline at end of file diff --git a/docs/autoinstall_samples/autoinstall.ini.sample b/docs/autoinstall_samples/autoinstall.ini.sample index bfe4c2d8f8cf2d90719ad8919fe5f60dab9f673f..4abb28dec5b5109faeff2b58375abdeef9904096 100644 --- a/docs/autoinstall_samples/autoinstall.ini.sample +++ b/docs/autoinstall_samples/autoinstall.ini.sample @@ -47,4 +47,13 @@ reconfigure_permissions_in_master_database=no reconfigure_services=yes ispconfig_port=8080 create_new_ispconfig_ssl_cert=no -reconfigure_crontab=yes \ No newline at end of file +reconfigure_crontab=yes + +; These are for service-detection (defaulting to old behaviour where alle changes were automatically accepted) +svc_detect_change_mail_server=yes +svc_detect_change_web_server=yes +svc_detect_change_dns_server=yes +svc_detect_change_xmpp_server=yes +svc_detect_change_firewall_server=yes +svc_detect_change_vserver_server=yes +svc_detect_change_db_server=yes diff --git a/install/lib/update.lib.php b/install/lib/update.lib.php index acc00517945e6385c0c9f94f4aed6318f6a4ab51..a4df4d8328c314ed192eec569e7caa7476a095b6 100644 --- a/install/lib/update.lib.php +++ b/install/lib/update.lib.php @@ -418,4 +418,22 @@ function setDefaultServers(){ } + + +/** Checks if a detected service differs from db setup and asks the user what to do + * @param $servicename string the name of the Database-Field in "servers" for this service + * @param $detected_value boolean The result of service detection + */ +function check_service_config_state($servicename, $detected_value) { + global $current_svc_config, $inst, $conf; + + if ($current_svc_config[$servicename] == 1) $current_state = 1; + else $current_state = 0; + + if ($detected_value != $current_state) { + if ($inst->simple_query('Service \''.$servicename.'\' '.($detected_value ? 'has been' : 'has not been').' detected ('.($current_state ? 'strongly recommended, currently enabled' : 'currently disabled').') do you want to '.($detected_value ? 'enable and configure' : 'disable').' it? ', array('yes', 'no'), ($current_state ? 'yes' : 'no'), 'svc_detect_change_'.$servicename) == 'yes') return $detected_value; + else return $current_state; + } else return $current_state; +} + ?> diff --git a/install/update.php b/install/update.php index 4626b5044e91147c954410eb32ef8100d5d33821..466f9faac7194e4de1a04d27c628514bd9d5b023 100644 --- a/install/update.php +++ b/install/update.php @@ -304,13 +304,18 @@ if($reconfigure_master_database_rights_answer == 'yes') { //** Detect the installed applications $inst->find_installed_apps(); -$conf['services']['mail'] = $conf['postfix']['installed']; -if ($conf['powerdns']['installed'] || $conf['bind']['installed'] || $conf['mydns']['installed']) $conf['services']['dns'] = true; -if ($conf['apache']['installed'] || $conf['nginx']['installed']) $conf['services']['web'] = true; -$conf['services']['xmpp'] = $conf['xmpp']['installed'];; -if ($conf['ufw']['installed'] || $conf['firewall']['installed']) $conf['services']['firewall'] = true; -$conf['services']['vserver'] = $conf['services']['vserver']; +//** Check for current service config state and compare to our results +if ($conf['mysql']['master_slave_setup'] == 'y') $current_svc_config = $inst->dbmaster->queryOneRecord("SELECT mail_server,web_server,dns_server,xmpp_server,firewall_server,vserver_server,db_server FROM ?? WHERE server_id=?", $conf['mysql']['master_database'] . '.server', $conf['server_id']); +else $current_svc_config = $inst->db->queryOneRecord("SELECT mail_server,web_server,dns_server,xmpp_server,firewall_server,vserver_server,db_server FROM ?? WHERE server_id=?", $conf["mysql"]["database"] . '.server', $conf['server_id']); +$conf['postfix']['installed'] = check_service_config_state('mail_server', $conf['postfix']['installed']); +$conf['services']['dns'] = check_service_config_state('dns_server', ($conf['powerdns']['installed'] || $conf['bind']['installed'] || $conf['mydns']['installed'])); +$conf['services']['web'] = check_service_config_state('web_server', ($conf['apache']['installed'] || $conf['nginx']['installed'])); +$conf['services']['xmpp'] = check_service_config_state('xmpp_server', $conf['xmpp']['installed']); +$conf['services']['firewall'] = check_service_config_state('firewall_server', ($conf['ufw']['installed'] || $conf['firewall']['installed'])); +$conf['services']['vserver'] = check_service_config_state('vserver_server', $conf['services']['vserver']); +//** vv is this intended??? If you want to check adapt the lines above... vv $conf['services']['db'] = true; +unset($current_svc_config); //** Shall the services be reconfigured during update