From dedbc14b7301852d91d43ac19ad68946986f027d Mon Sep 17 00:00:00 2001 From: alban Date: Sun, 6 Jul 2014 00:13:29 +0200 Subject: [PATCH] [fix] diagnostic:dns custom records --- lib/Alternc/Diagnostic/Service/Dns.php | 37 +++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/lib/Alternc/Diagnostic/Service/Dns.php b/lib/Alternc/Diagnostic/Service/Dns.php index 5a2411f1..2791395c 100644 --- a/lib/Alternc/Diagnostic/Service/Dns.php +++ b/lib/Alternc/Diagnostic/Service/Dns.php @@ -88,6 +88,10 @@ class Alternc_Diagnostic_Service_Dns return $res; } + /** + * Lists domains `host $DOMAIN` data + * @return array + */ function getHosts(){ $resultArray = array(); foreach ($this->domainList as $domain => $domainInfo) { @@ -100,6 +104,11 @@ class Alternc_Diagnostic_Service_Dns return $resultArray; } + /** + * Lists domains NS + * + * @return array + */ function getNameservers(){ $resultArray = array(); foreach ($this->domainList as $domain => $domainInfo) { @@ -112,6 +121,11 @@ class Alternc_Diagnostic_Service_Dns return $resultArray; } + /** + * Lists zones content + * + * @return array + */ function getZonesList(){ $resultArray = array(); foreach ($this->domainList as $domain => $domainInfo) { @@ -124,6 +138,11 @@ class Alternc_Diagnostic_Service_Dns return $resultArray; } + /** + * Lists which domains zones are locked + * + * @return array + */ function getZonesLocked(){ $resultArray = array(); foreach ($this->domainList as $domain => $domainInfo) { @@ -136,14 +155,19 @@ class Alternc_Diagnostic_Service_Dns return $resultArray; } + /** + * Lists which domains zones have custom records + * + * @return array + */ function getZonesCustomRecords(){ $resultArray = array(); - $regexp = ".*;;; END ALTERNC AUTOGENERATE CONFIGURATION.*\w.*"; + $regexp = ";;; END ALTERNC AUTOGENERATE CONFIGURATION\n(.+\w+.+)"; foreach ($this->zonesList as $domain => $zone) { $is_custom = false; try{ - if(preg_match("/$regexp/", $zone)){ - $is_custom = true; + if(preg_match("/$regexp/ms", $zone, $matches)){ + $is_custom = $matches[1]; } }catch( \Exception $e){ echo $e->getMessage()."\n"; @@ -152,7 +176,12 @@ class Alternc_Diagnostic_Service_Dns } return $resultArray; } - + + /** + * Lists servers DNS slaves accounts + * + * @return array + */ function getSlaves(){ return $this->dom->enum_slave_account(); }