Commit ec1ea49b authored by Till Brehm's avatar Till Brehm

Merge branch 'updater-interactive-service-config' into 'stable-3.1'

Updater interactive service config

I hope this is okay for you. Please have a quick look at docs/autoinstall_samples/autoinstall.ini.sample  if that syntax is okay.
This MR closes ispconfig/ispconfig3#4163
and also closes ispconfig/ispconfig3#4050

Tested on Master-Slave and confirmed working on both. See comments.

See merge request !431
parents b05d19ad 7bba85ef
......@@ -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
......@@ -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
......@@ -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;
}
?>
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment