Code

Fixed FAI problem with copy on write.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 18 Jul 2008 10:35:00 +0000 (10:35 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 18 Jul 2008 10:35:00 +0000 (10:35 +0000)
- Only works for scripts, yet.

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

gosa-plugins/fai/admin/fai/class_FAI.inc
gosa-plugins/fai/admin/fai/class_faiScript.inc

index e2421b4430e5c1b4a8cf0671de17ccfc7d910ac0..75a7b1f684f115f6b6c9489674ff8795b8a90da6 100644 (file)
@@ -21,7 +21,7 @@ class FAI
     $tmp = array();
 
     if(!FAI::is_release_department($Current_DN)) {
-      return($res);
+#      return($res);
     }
 
     /* Collect some basic informations and initialize some variables */ 
index dec9e21e71da30ee6ecada1d0545a1bb303e4b82..4f471c07a7b13b183a6d94121bd99df541cad4da 100644 (file)
@@ -47,44 +47,18 @@ class faiScript extends plugin
      * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
      */
     if($dn != "new"){
-
       $this->dn =$dn;
 
-      /* Get FAIstate
-       */
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-
       /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
        */
-      $ldap     = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-      
-      $attrs_to_search = $this->subAttributes;
-      $attrs_to_search[] = "FAIstate";
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
-      $data = array();
-      while($object = $ldap->fetch()){
-        $data[] = $object;
-      }
-      foreach($data as $object){
-
-        /* Skip objects, that are tagged as removed */
-        if(isset($object['FAIstate'][0])){
-          if(preg_match("/removed$/",$object['FAIstate'][0])){
-            continue;
-          }
-        }
-
-        /* Set status for save management */
+      $res = FAI::get_all_objects_for_given_base($this->dn,"(&(objectClass=FAIclass)(objectClass=".$this->subClass."))");
+      foreach($res as $obj){
         $objects = array();
         $objects['status']      = "FreshLoaded";
-        $objects['dn']          = $object['dn'];
+        $objects['dn']          = $obj['dn'];
         $objects                = $this->get_object_attributes($objects,$this->subAttributes);
         $this->SubObjects[$objects['cn']] = $objects;
       }
-    
     }
 
     $this->is_new = FALSE;
@@ -191,7 +165,7 @@ class faiScript extends plugin
       }
 
       /* Delete script requested */
-      if(preg_match("/^deletescript_/",$name) && preg_match("/freeze/i",$this->FAIstate)){
+      if(preg_match("/^deletescript_/",$name) && !preg_match("/freeze/i",$this->FAIstate)){
         $s_action = "remove";
         $s_entry = preg_replace("/^deletescript_/","",$name);
         $s_entry = base64_decode(preg_replace("/_.*/","",$s_entry));