Code

Updated FAI Package
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 14 Apr 2008 10:02:27 +0000 (10:02 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 14 Apr 2008 10:02:27 +0000 (10:02 +0000)
-Do not load the packages from ldap directly, use the copy&write methods to fetch all objects.

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

gosa-plugins/fai/admin/fai/class_faiPackage.inc

index 1814daf6f3275e359a797d847e7d9e6b5532a451..cc6a20b0e626ed07456a2427e0840a4da8dfcf9c 100644 (file)
@@ -89,38 +89,41 @@ class faiPackage extends plugin
       }
       $PackageFilter = "(&(objectClass=FAIdebconfInfo)(|".$PackageFilter."))";
 
-      /* Search for configuration objects */ 
+      $res = FAI::get_all_objects_for_given_base(FAI::get_release_dn($dn),$PackageFilter);
       $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->dn);
-      $ldap->search($PackageFilter,array("FAIvariable","FAIvariableType",
-            "FAIvariableContent","FAIpackage","FAIdebianSection","FAIstate"));
+      $ldap->cd($this->config->current['BASE']);
+      foreach($res as $dn_v){
+        if(preg_match("/".normalizePreg($dn)."$/",$dn_v['dn'])){
 
-      /* Walk through configurations and append them to our list of ConfiguredPackages 
-       */
-      while($attr = $ldap->fetch()){
+          $ldap->cat($dn_v['dn']);
+          $attr = $ldap->fetch();
 
-        /* Skip objects, that are tagged as removed */
-        if(isset($object['FAIstate'][0])){
-          if(preg_match("/removed$/",$attr['FAIstate'][0])){
-            continue;
-          }
-        }
+          /* Walk through configurations and append them to our list of ConfiguredPackages 
+           */
 
-        $tmp =array(); 
-        $tmp['Name']  = $attr['FAIvariable'][0];
-        $tmp['Type']  = $attr['FAIvariableType'][0];
+          /* Skip objects, that are tagged as removed */
+          if(isset($object['FAIstate'][0])){
+            if(preg_match("/removed$/",$attr['FAIstate'][0])){
+              continue;
+            }
+          }
 
-        if (isset($attr['FAIvariableContent'][0])){
-          if(!in_array($attr['FAIvariableType'],array("multiselect"))){
-            $tmp['Value'] = $attr['FAIvariableContent'][0];
-          }else{
-            $content = array();        
-            unset($attr['FAIvariableContent']['count']);
-            foreach($attr['FAIvariableContent'] as $attr){
-              $tmp['Value'][] = $attr;
+          $tmp =array(); 
+          $tmp['Name']  = $attr['FAIvariable'][0];
+          $tmp['Type']  = $attr['FAIvariableType'][0];
+
+          if (isset($attr['FAIvariableContent'][0])){
+            if(!in_array($attr['FAIvariableType'],array("multiselect"))){
+              $tmp['Value'] = $attr['FAIvariableContent'][0];
+            }else{
+              $content = array();        
+              unset($attr['FAIvariableContent']['count']);
+              foreach($attr['FAIvariableContent'] as $attr){
+                $tmp['Value'][] = $attr;
+              }
             }
+            $this->ConfiguredPackages[$attr['FAIpackage'][0]][$attr['FAIvariable'][0]]=$tmp;
           }
-          $this->ConfiguredPackages[$attr['FAIpackage'][0]][$attr['FAIvariable'][0]]=$tmp;
         }
       }