From: hickert Date: Fri, 22 Feb 2008 08:11:58 +0000 (+0000) Subject: Updated DNS class. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=902daa60006e88ac8f9ae907fe8e625d0211383a;p=gosa.git Updated DNS class. -Cache the result of getAvailableZones git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9045 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/dns/admin/systems/services/dns/class_DNS.inc b/gosa-plugins/dns/admin/systems/services/dns/class_DNS.inc index ade653d2d..4354c9a1b 100644 --- a/gosa-plugins/dns/admin/systems/services/dns/class_DNS.inc +++ b/gosa-plugins/dns/admin/systems/services/dns/class_DNS.inc @@ -637,28 +637,15 @@ class DNS */ static function getAvailableZones($config) { - $ret = array(); - - /* Search for zones ... - */ - $ou = preg_replace("/,.*$/","",get_ou("serverou")); - $deps = array(); - $ldap = $config->get_ldap_link(); - $ldap->cd ($config->current['BASE']); - $ldap->search("(&(objectClass=organizationalUnit)(".$ou."))",array("dn")); - while($attrs = $ldap->fetch()){ - $deps[] = $attrs['dn']; - } - - $ForwardZones = array(); - $ReverseZones = array(); - $zones = array(); - foreach($deps as $dep){ - $ldap->cd($dep); - $ldap->search("(&(objectClass=dNSZone)(sOARecord=*))",array("zoneName")); - + $runtime_cache = session::get("runtime_cache"); + if(!isset($runtime_cache['DNS']['getAvailableZones'])){ + + $ret = array(); + $ldap = $config->get_ldap_link(); + $tmp = get_sub_list("(&(objectClass=dNSZone)(sOARecord=*))","",get_ou("serverou"), + $config->current['BASE'],array("zoneName"),GL_NO_ACL_CHECK | GL_SUBSEARCH); - while($at = $ldap->fetch()){ + foreach($tmp as $at){ if(preg_match("/\.in\-addr\.arpa/",$at['zoneName'][0])){ $ReverseZones[$at['dn']] = $at; }else{ @@ -677,8 +664,10 @@ class DNS } } } + $runtime_cache['DNS']['getAvailableZones'] = $zones; + session::set("runtime_cache",$runtime_cache); } - return($zones); + return($runtime_cache['DNS']['getAvailableZones']); } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: