Skip to content
Snippets Groups Projects
Commit b77400a9 authored by A. Täffner's avatar A. Täffner
Browse files

updater: db-query working, requests working. This will be my MR and hopefully...

updater: db-query working, requests working. This will be my MR and hopefully fixes ispconfig/ispconfig3#4163 and hopefully also fixes ispconfig/ispconfig3#4050
parent bd494ec7
No related branches found
No related tags found
No related merge requests found
......@@ -425,22 +425,13 @@ function setDefaultServers(){
* @param $detected_value boolean The result of service detection
*/
function check_service_config_state($servicename, $detected_value) {
global $current_svc_config, $inst;
global $current_svc_config, $inst, $conf;
if ($current_svc_config[$servicename] == 1) $current_state = true;
else $current_state = false;
if ($current_svc_config[$servicename] == 1) $current_state = 1;
else $current_state = 0;
if ($detected_value != $current_state) {
if ($detected_value) {
$svcdetect_state1 = 'has been';
$svcdetect_state2 = 'configure';
$svcdetect_defaultanswer = 'no';
} else {
$svcdetect_state1 = 'has not been';
$svcdetect_state2 = '(strongly recommended) disable';
$svcdetect_defaultanswer = 'yes';
}
if ($inst->simple_query('Service \''.$servicename.'\' '.$svcdetect_state1.' detected do you want to '.$svcdetect_state2.' it? ', array('yes', 'no'), $svcdetect_defaultanswer, 'svc_detect_change_'.$servicename) == 'yes') return $detected_value;
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;
}
......
......@@ -305,7 +305,8 @@ if($reconfigure_master_database_rights_answer == 'yes') {
$inst->find_installed_apps();
//** Check for current service config state and compare to our results
$current_svc_config = $inst->dbmaster->queryOneRecord("SELECT * FROM `server` WHERE server_id=?", $conf['server_id']);
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']));
......@@ -314,6 +315,7 @@ $conf['services']['firewall'] = check_service_config_state('firewall_server', ($
$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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment