Commit bd494ec7 authored by A. Täffner's avatar A. Täffner

uüdater: implemented request on new/vanished service detection

parent 83e5ef3c
......@@ -418,4 +418,31 @@ 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;
if ($current_svc_config[$servicename] == 1) $current_state = true;
else $current_state = false;
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;
else return $current_state;
} else return $current_state;
}
?>
......@@ -304,12 +304,15 @@ 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
$current_svc_config = $inst->dbmaster->queryOneRecord("SELECT * FROM `server` WHERE server_id=?", $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;
......
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