Skip to content

Commit 934c7d1

Browse files
committed
Implemented: FS#1260 - Do not ask for port number during updates
- The updater still asks for the port number, but with this update the default number that is shown is read from the vhost file as xaver suggested.
1 parent 7ed7413 commit 934c7d1

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

install/autoupdate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271

272272

273273
//** Customise the port ISPConfig runs on
274-
$conf['apache']['vhost_port'] = '8080';
274+
$conf['apache']['vhost_port'] = get_ispconfig_port_number();;
275275

276276
$inst->install_ispconfig();
277277

install/lib/install.lib.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,26 @@ function compare_ispconfig_version($current,$new) {
677677

678678
}
679679

680+
/*
681+
* Get the port number of the ISPConfig controlpanel vhost
682+
*/
683+
684+
function get_ispconfig_port_number() {
685+
global $conf;
686+
$ispconfig_vhost_file = $conf['apache']['vhost_conf_dir'].'/ispconfig.vhost';
687+
688+
if(is_file($ispconfig_vhost_file)) {
689+
$tmp = file_get_contents($ispconfig_vhost_file);
690+
preg_match('/\<VirtualHost.*\:(\d{1,})\>/',$tmp,$matches);
691+
$port_number = intval($matches[1]);
692+
if($port_number > 0) {
693+
return $port_number;
694+
} else {
695+
return '8080';
696+
}
697+
}
698+
}
699+
680700

681701

682702
?>

install/update.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@
305305

306306

307307
//** Customise the port ISPConfig runs on
308-
$conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', '8080');
308+
$ispconfig_port_number = get_ispconfig_port_number();
309+
$conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', $ispconfig_port_number);
309310

310311
$inst->install_ispconfig();
311312

0 commit comments

Comments
 (0)