Skip to content

Commit b77400a

Browse files
author
A. Täffner
committed
updater: db-query working, requests working. This will be my MR and hopefully fixes ispconfig/ispconfig3#4163 and hopefully also fixes ispconfig/ispconfig3#4050
1 parent bd494ec commit b77400a

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

install/lib/update.lib.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -425,22 +425,13 @@ function setDefaultServers(){
425425
* @param $detected_value boolean The result of service detection
426426
*/
427427
function check_service_config_state($servicename, $detected_value) {
428-
global $current_svc_config, $inst;
428+
global $current_svc_config, $inst, $conf;
429429

430-
if ($current_svc_config[$servicename] == 1) $current_state = true;
431-
else $current_state = false;
430+
if ($current_svc_config[$servicename] == 1) $current_state = 1;
431+
else $current_state = 0;
432432

433433
if ($detected_value != $current_state) {
434-
if ($detected_value) {
435-
$svcdetect_state1 = 'has been';
436-
$svcdetect_state2 = 'configure';
437-
$svcdetect_defaultanswer = 'no';
438-
} else {
439-
$svcdetect_state1 = 'has not been';
440-
$svcdetect_state2 = '(strongly recommended) disable';
441-
$svcdetect_defaultanswer = 'yes';
442-
}
443-
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;
434+
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;
444435
else return $current_state;
445436
} else return $current_state;
446437
}

install/update.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@
305305
$inst->find_installed_apps();
306306

307307
//** Check for current service config state and compare to our results
308-
$current_svc_config = $inst->dbmaster->queryOneRecord("SELECT * FROM `server` WHERE server_id=?", $conf['server_id']);
308+
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']);
309+
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']);
309310
$conf['postfix']['installed'] = check_service_config_state('mail_server', $conf['postfix']['installed']);
310311
$conf['services']['dns'] = check_service_config_state('dns_server', ($conf['powerdns']['installed'] || $conf['bind']['installed'] || $conf['mydns']['installed']));
311312
$conf['services']['web'] = check_service_config_state('web_server', ($conf['apache']['installed'] || $conf['nginx']['installed']));
@@ -314,6 +315,7 @@
314315
$conf['services']['vserver'] = check_service_config_state('vserver_server', $conf['services']['vserver']);
315316
//** vv is this intended??? If you want to check adapt the lines above... vv
316317
$conf['services']['db'] = true;
318+
unset($current_svc_config);
317319

318320

319321
//** Shall the services be reconfigured during update

0 commit comments

Comments
 (0)