Code

Updated workstation startup
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 10 Jan 2008 14:13:28 +0000 (14:13 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 10 Jan 2008 14:13:28 +0000 (14:13 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8293 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/functions_FAI.inc
gosa-core/plugins/admin/systems/class_workstationStartup.inc

index 7b2b6170fa0212b9197fd43fe74fec490882308b..03cde063708f4d7e0a3237bd0480073777cc1560 100644 (file)
@@ -37,7 +37,8 @@ function get_all_objects_for_given_base($Current_DN,$filter,$detailed = false)
     foreach($deps_to_search as $fai_base){
 
       /* Ldap search for fai classes specified in this release */
-      $res_tmp = get_list($filter,"fai",$fai_base,array("dn","objectClass","FAIstate"),GL_SUBSEARCH | GL_SIZELIMIT);
+      $attributes  = array("dn","objectClass","FAIstate","cn","FAIdebianSection");
+      $res_tmp = get_list($filter,"fai",$fai_base,$attributes,GL_SUBSEARCH | GL_SIZELIMIT);
   
       /* check the returned objects, and add/replace them in our return variable */
       foreach($res_tmp as $attr){
@@ -54,7 +55,6 @@ function get_all_objects_for_given_base($Current_DN,$filter,$detailed = false)
           }
         }
 
-
         /* In detailed mode are some additonal informations visible */
         if($detailed){
 
@@ -67,8 +67,12 @@ function get_all_objects_for_given_base($Current_DN,$filter,$detailed = false)
           }
 
           /* Append objectClass to resulsts */
-          $buffer['objectClass']  = $attr['objectClass'];
-          unset($buffer['objectClass'][0]);
+          foreach($attributes as $val){
+            if(isset($attr[$val])){
+              $buffer[$val] = $attr[$val];
+            }
+          }
+          unset($buffer['objectClass']['count']);
         }
 
         /* Add this object to our list */
index c0373ee3d6c94f73752b560b444f94463c11f4ed..e6763346366a3f4b8837794fbebb187ddb9f76e4 100644 (file)
@@ -1068,7 +1068,12 @@ class workstartup extends plugin
     /* Get classes for release from cache. 
      * Or build cache
      */
-    if($force || !isset($this->cache['CLASSES'][$this->FAIrelease])){
+    if($this->FAIdebianMirror == "inherited"){
+      $release = $this->InheritedFAIrelease;
+    }else{
+      $release = $this->FAIrelease;
+    }
+    if($force || !isset($this->cache['CLASSES'][$release])){
 
       /*  Create a list of available releases.
        *  $this->cache['RELEASE_DNS'][ou=siga...,c=de]         = "siga";
@@ -1089,25 +1094,23 @@ class workstartup extends plugin
 
       /* Create list of available classes for the currenlty selected release.
        */
-      foreach(array($this->FAIrelease,$this->InheritedFAIrelease) as $release){
-        $base = array_search($release,$this->cache['RELEASE_DNS']);
-        $this->cache['CLASSES'][$release] = array();
-        if(!empty($base)){
-          $ldap = $this->config->get_ldap_link();
-          $ldap->cd($base);
-          $ldap->search("(|(objectClass=FAIpackageList)(objectClass=FAItemplate)(objectClass=FAIvariable)".
-              "(objectClass=FAIscript)(objectClass=FAIhook)(objectClass=FAIprofile)".
-              "(objectClass=FAIpartitionTable))",array("cn","objectClass","FAIdebianSection",'description'));
-
-          while($attrs = $ldap->fetch()){
-            $info = $this->analyse_fai_object($attrs);
-            if(count($info)){
-              $this->cache['CLASSES'][$release][$attrs['cn'][0]][] = $info;
-            }
+      $base = array_search($release,$this->cache['RELEASE_DNS']);
+      $this->cache['CLASSES'][$release] = array();
+
+      if(!empty($base)){
+        $filter = "(|(objectClass=FAIpackageList)(objectClass=FAItemplate)(objectClass=FAIvariable)".
+          "(objectClass=FAIscript)(objectClass=FAIhook)(objectClass=FAIprofile)".
+          "(objectClass=FAIpartitionTable))";
+        $list = get_all_objects_for_given_base($base,$filter,TRUE);
+        foreach($list as $attrs){
+          $info = $this->analyse_fai_object($attrs);
+          if(count($info)){
+            $this->cache['CLASSES'][$release][$attrs['cn'][0]][] = $info;
           }
         }
       }
 
+
       /* Add object caught from external hook
        */
       $lines= $this->GetHookElements();