From b364f1dc126b549b243f81dd087ee2e345a1eb2c Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Wed, 19 Mar 2014 19:45:15 +0100 Subject: haproxy-devel, use global $aliastable for looking up aliases, call haproxy_check_run() on installation to start upgraded version if already enabled. --- config/haproxy-devel/haproxy.inc | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'config/haproxy-devel') diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc index 76b836b6..0c59a03d 100644 --- a/config/haproxy-devel/haproxy.inc +++ b/config/haproxy-devel/haproxy.inc @@ -212,21 +212,16 @@ function group_ports($ports) { function haproxy_portoralias_to_list($port_or_alias) { // input: a port or aliasname: 80 https MyPortAlias // returns: a array of ports and portranges 80 443 8000:8010 - global $config; + global $aliastable; $portresult = array(); - if (is_alias($port_or_alias)) { - if (is_array($config['aliases']['alias'])) { - foreach ($config['aliases']['alias'] as $alias) { - if ($alias['name'] == $port_or_alias && preg_match("/port/i", $alias['type'])) { - $ports = explode(' ',$alias['address']); - foreach($ports as $port) { - $portresults = haproxy_portoralias_to_list($port); - $portresult = array_merge($portresult, $portresults); - } - return $portresult; - } - } + if (alias_get_type($port_or_alias) == "port") { + $aliasports = $aliastable[$port_or_alias]; + $ports = explode(' ',$aliasports); + foreach($ports as $port) { + $portresults = haproxy_portoralias_to_list($port); + $portresult = array_merge($portresult, $portresults); } + return $portresult; } else if (is_portrange($port_or_alias)) { return (array)$port_or_alias; } else if (is_port($port_or_alias)) { @@ -436,9 +431,9 @@ EOD; update_output_window($static_output); conf_mount_ro(); - $static_output .= "HAProxy, calling: haproxy.sh start\n"; + $static_output .= "HAProxy, starting haproxy (if previously enabled)\n"; update_output_window($static_output); - exec("/usr/local/etc/rc.d/haproxy.sh start"); + haproxy_check_run(1); $static_output .= "HAProxy, running haproxy_custom_php_install_command() DONE\n"; update_output_window($static_output); -- cgit v1.2.3