From 5c5fd7560c8fa5c01ae862af72a941746301227e Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Mon, 25 May 2015 15:55:23 +0200 Subject: haproxy-devel, code formatting & skip dns_get_record when nothing is requested. --- config/haproxy-devel/pkg/haproxy_utils.inc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/config/haproxy-devel/pkg/haproxy_utils.inc b/config/haproxy-devel/pkg/haproxy_utils.inc index 1e5a23fc..3d841a25 100644 --- a/config/haproxy-devel/pkg/haproxy_utils.inc +++ b/config/haproxy-devel/pkg/haproxy_utils.inc @@ -42,15 +42,21 @@ class haproxy_utils { $recordtypes = 0; foreach($types as $type){ switch ($type) { - case 'A': $recordtypes += DNS_A; break; - case 'AAAA': $recordtypes += DNS_AAAA; break; + case 'A': + $recordtypes += DNS_A; + break; + case 'AAAA': + $recordtypes += DNS_AAAA; + break; } } + if ($recordtypes == 0) + return $result; + $dnsresult = dns_get_record($host, $recordtypes); foreach($dnsresult as $item) { - $type = $item['type']; - $newitem["typeid"] = $type; - switch ($type) { + $newitem["typeid"] = $item['type']; + switch ($item['type']) { case 'A': $newitem["data"] = $item['ip']; break; -- cgit v1.2.3