Code

Updated DNS class.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Feb 2008 08:11:58 +0000 (08:11 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Feb 2008 08:11:58 +0000 (08:11 +0000)
-Cache the result of  getAvailableZones

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9045 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/dns/admin/systems/services/dns/class_DNS.inc

index ade653d2d5e447ba740c64ca194b70fa8a4a1521..4354c9a1b0361a35fc9d533358f8e637a632de39 100644 (file)
@@ -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: