diff --git a/install/autoupdate.php b/install/autoupdate.php index 2c388c4e0a904eabb6785ebbc41ebabe7ef9136b..116c375e95a7581e01137ce7fa89aa1856db4605 100644 --- a/install/autoupdate.php +++ b/install/autoupdate.php @@ -271,7 +271,7 @@ swriteln('Updating ISPConfig'); //** Customise the port ISPConfig runs on -$conf['apache']['vhost_port'] = '8080'; +$conf['apache']['vhost_port'] = get_ispconfig_port_number();; $inst->install_ispconfig(); diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php index a4e388054be18c82d6dc1ba8d088a197783ddd82..f964445bf67b32f2de96b092c835e270b72dc340 100644 --- a/install/lib/install.lib.php +++ b/install/lib/install.lib.php @@ -677,6 +677,26 @@ function compare_ispconfig_version($current,$new) { } +/* +* Get the port number of the ISPConfig controlpanel vhost +*/ + +function get_ispconfig_port_number() { + global $conf; + $ispconfig_vhost_file = $conf['apache']['vhost_conf_dir'].'/ispconfig.vhost'; + + if(is_file($ispconfig_vhost_file)) { + $tmp = file_get_contents($ispconfig_vhost_file); + preg_match('/\<VirtualHost.*\:(\d{1,})\>/',$tmp,$matches); + $port_number = intval($matches[1]); + if($port_number > 0) { + return $port_number; + } else { + return '8080'; + } + } +} + ?> diff --git a/install/update.php b/install/update.php index a1ec71e84349c032c79766f0195f50bfb4125ed2..a0b9514512d59a9f19fdd9bb81807a8ea53581be 100644 --- a/install/update.php +++ b/install/update.php @@ -305,7 +305,8 @@ swriteln('Updating ISPConfig'); //** Customise the port ISPConfig runs on -$conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', '8080'); +$ispconfig_port_number = get_ispconfig_port_number(); +$conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', $ispconfig_port_number); $inst->install_ispconfig();