|
287 | 287 | */ |
288 | 288 | updateDbAndIni(); |
289 | 289 |
|
| 290 | +//** read server config from db into $conf['server_config'] |
| 291 | +$tmp = $inst->db->queryOneRecord("SELECT config FROM ?? WHERE server_id = ?", $conf["mysql"]["database"] . '.server', $conf['server_id']); |
| 292 | +$conf['server_config'] = ini_to_array(stripslashes($tmp['config'])); |
| 293 | +unset($tmp); |
| 294 | + |
290 | 295 | /* |
291 | 296 | * Reconfigure the permisson if needed |
292 | 297 | * (if this is done at client side, only this client is updated. |
|
307 | 312 | //** Check for current service config state and compare to our results |
308 | 313 | 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 | 314 | 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']); |
310 | | -$conf['postfix']['installed'] = check_service_config_state('mail_server', $conf['postfix']['installed']); |
| 315 | +$conf['services']['mail'] = check_service_config_state('mail_server', $conf['postfix']['installed']); |
311 | 316 | $conf['services']['dns'] = check_service_config_state('dns_server', ($conf['powerdns']['installed'] || $conf['bind']['installed'] || $conf['mydns']['installed'])); |
312 | 317 | $conf['services']['web'] = check_service_config_state('web_server', ($conf['apache']['installed'] || $conf['nginx']['installed'])); |
313 | 318 | $conf['services']['xmpp'] = check_service_config_state('xmpp_server', $conf['xmpp']['installed']); |
314 | 319 | $conf['services']['firewall'] = check_service_config_state('firewall_server', ($conf['ufw']['installed'] || $conf['firewall']['installed'])); |
315 | 320 | $conf['services']['vserver'] = check_service_config_state('vserver_server', $conf['services']['vserver']); |
316 | | -//** vv is this intended??? If you want to check adapt the lines above... vv |
317 | | -$conf['services']['db'] = true; |
| 321 | +$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... */ |
318 | 322 | unset($current_svc_config); |
319 | 323 |
|
| 324 | +//** Write new decisions into DB |
| 325 | +$sql = "UPDATE ?? SET mail_server = '{$conf['services']['mail']}', web_server = '{$conf['services']['web']}', dns_server = '{$conf['services']['dns']}', file_server = '{$conf['services']['file']}', db_server = '{$conf['services']['db']}', vserver_server = '{$conf['services']['vserver']}', proxy_server = '{$conf['services']['proxy']}', firewall_server = '$firewall_server_enabled', xmpp_server = '$xmpp_server_enabled' WHERE server_id = ?"; |
| 326 | +$inst->db->query($sql, $conf['mysql']['database'].'.server', $conf['server_id']); |
| 327 | +if($conf['mysql']['master_slave_setup'] == 'y') { |
| 328 | + $inst->dbmaster->query($sql, $conf['mysql']['master_database'].'.server', $conf['server_id']); |
| 329 | +} |
| 330 | + |
| 331 | +//** Is the ISPConfg Panel installed on this host? This might partially override user's preferences later. |
| 332 | +if($conf['apache']['installed'] == true){ |
| 333 | + if(!is_file($conf['apache']['vhost_conf_dir'].'/ispconfig.vhost')) $inst->install_ispconfig_interface = false; |
| 334 | +} |
| 335 | +if($conf['nginx']['installed'] == true){ |
| 336 | + if(!is_file($conf['nginx']['vhost_conf_dir'].'/ispconfig.vhost')) $inst->install_ispconfig_interface = false; |
| 337 | +} |
320 | 338 |
|
321 | 339 | //** Shall the services be reconfigured during update |
322 | 340 | $reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes', 'no', 'selected'), 'yes','reconfigure_services'); |
|
398 | 416 | } |
399 | 417 | } |
400 | 418 |
|
401 | | - if($conf['services']['web']) { |
| 419 | + if($conf['services']['web'] || $inst->install_ispconfig_interface) { |
402 | 420 |
|
403 | 421 | if($conf['pureftpd']['installed'] == true && $inst->reconfigure_app('Pureftpd', $reconfigure_services_answer)) { |
404 | 422 | //** Configure Pureftpd |
|
421 | 439 | $inst->configure_nginx(); |
422 | 440 | } |
423 | 441 |
|
424 | | - //** Configure apps vhost |
425 | | - swriteln('Configuring Apps vhost'); |
426 | | - $inst->configure_apps_vhost(); |
427 | | - } |
| 442 | + if ($conf['server_config']['web']['apps_vhost_enabled'] == 'y') { |
| 443 | + //** Configure apps vhost |
| 444 | + swriteln('Configuring Apps vhost'); |
| 445 | + $inst->configure_apps_vhost(); |
| 446 | + } else swriteln('Skipping config of Apps vhost'); |
| 447 | + } |
428 | 448 |
|
429 | | - //* Configure Jailkit |
430 | | - if($inst->reconfigure_app('Jailkit', $reconfigure_services_answer)) { |
431 | | - swriteln('Configuring Jailkit'); |
432 | | - $inst->configure_jailkit(); |
433 | | - } |
434 | | - |
| 449 | + //* Configure Jailkit |
| 450 | + if($inst->reconfigure_app('Jailkit', $reconfigure_services_answer)) { |
| 451 | + swriteln('Configuring Jailkit'); |
| 452 | + $inst->configure_jailkit(); |
435 | 453 | } |
436 | 454 |
|
| 455 | + } |
| 456 | + |
437 | 457 | if($conf['services']['xmpp'] && $inst->reconfigure_app('XMPP', $reconfigure_services_answer)) { |
438 | 458 | //** Configure Metronome XMPP |
439 | 459 | $inst->configure_xmpp('dont-create-certs'); |
|
469 | 489 |
|
470 | 490 | //** Configure ISPConfig |
471 | 491 | swriteln('Updating ISPConfig'); |
472 | | -if($conf['apache']['installed'] == true){ |
473 | | - if(!is_file($conf['apache']['vhost_conf_dir'].'/ispconfig.vhost')) $inst->install_ispconfig_interface = false; |
474 | | -} |
475 | | -if($conf['nginx']['installed'] == true){ |
476 | | - if(!is_file($conf['nginx']['vhost_conf_dir'].'/ispconfig.vhost')) $inst->install_ispconfig_interface = false; |
477 | | -} |
478 | 492 |
|
479 | | -if ($conf['services']['web'] && $inst->install_ispconfig_interface) { |
| 493 | +if ($inst->install_ispconfig_interface) { |
480 | 494 | //** Customise the port ISPConfig runs on |
481 | 495 | $ispconfig_port_number = get_ispconfig_port_number(); |
482 | 496 | if($autoupdate['ispconfig_port'] == 'default') $autoupdate['ispconfig_port'] = $ispconfig_port_number; |
|
524 | 538 | if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart')); |
525 | 539 | if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &'); |
526 | 540 | } |
527 | | - if($conf['services']['web']) { |
| 541 | + if($conf['services']['web'] || $inst->install_ispconfig_interface) { |
528 | 542 | if($conf['webserver']['server_type'] == 'apache' && $conf['apache']['init_script'] != '') system($inst->getinitcommand($conf['apache']['init_script'], 'restart')); |
529 | 543 | //* Reload is enough for nginx |
530 | 544 | if($conf['webserver']['server_type'] == 'nginx'){ |
|
0 commit comments