Skip to content

Commit 3da0397

Browse files
author
A. Täffner
committed
Implementation of detection override to configure webserver wheenver the panel is installed on the host regardless of user's preference
1 parent 63e4afa commit 3da0397

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

install/lib/update.lib.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,12 @@ function check_service_config_state($servicename, $detected_value) {
431431
else $current_state = 0;
432432

433433
if ($detected_value != $current_state) {
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;
435-
else return $current_state;
434+
$answer = $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)
435+
if ($answer == 'yes') return $detected_value;
436+
else {
437+
if ($servicename == 'web_server') echo "If ISPConfig-Panel is installed on this Server we will configure the Web Server anyways but will not enable it in ISPConfig.\n";
438+
return $current_state;
439+
}
436440
} else return $current_state;
437441
}
438442

install/update.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,13 @@
316316
$conf['services']['db'] = check_service_config_state('db_server', true); /* Will always offer as MySQL is of course installed on this host as it's a requirement for ISPC to work... */
317317
unset($current_svc_config);
318318

319+
//** Is the ISPConfg Panel installed on this host? This might partially override user's preferences later.
320+
if($conf['apache']['installed'] == true){
321+
if(!is_file($conf['apache']['vhost_conf_dir'].'/ispconfig.vhost')) $inst->install_ispconfig_interface = false;
322+
}
323+
if($conf['nginx']['installed'] == true){
324+
if(!is_file($conf['nginx']['vhost_conf_dir'].'/ispconfig.vhost')) $inst->install_ispconfig_interface = false;
325+
}
319326

320327
//** Shall the services be reconfigured during update
321328
$reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes', 'no', 'selected'), 'yes','reconfigure_services');
@@ -391,7 +398,7 @@
391398
}
392399
}
393400

394-
if($conf['services']['web']) {
401+
if($conf['services']['web'] || $inst->install_ispconfig_interface) {
395402

396403
if($conf['pureftpd']['installed'] == true && $inst->reconfigure_app('Pureftpd', $reconfigure_services_answer)) {
397404
//** Configure Pureftpd
@@ -462,14 +469,8 @@
462469

463470
//** Configure ISPConfig
464471
swriteln('Updating ISPConfig');
465-
if($conf['apache']['installed'] == true){
466-
if(!is_file($conf['apache']['vhost_conf_dir'].'/ispconfig.vhost')) $inst->install_ispconfig_interface = false;
467-
}
468-
if($conf['nginx']['installed'] == true){
469-
if(!is_file($conf['nginx']['vhost_conf_dir'].'/ispconfig.vhost')) $inst->install_ispconfig_interface = false;
470-
}
471472

472-
if ($conf['services']['web'] && $inst->install_ispconfig_interface) {
473+
if ($inst->install_ispconfig_interface) {
473474
//** Customise the port ISPConfig runs on
474475
$ispconfig_port_number = get_ispconfig_port_number();
475476
if($autoupdate['ispconfig_port'] == 'default') $autoupdate['ispconfig_port'] = $ispconfig_port_number;

0 commit comments

Comments
 (0)