Code

Apply patch from mba for #4170
[gosa.git] / trunk / gosa-plugins / fai / admin / fai / class_faiManagement.inc
index 4a20ab0e7ab7eede35916161b873cf317123e6eb..c0114568aab192844a91429f03e9d619435b6b80 100644 (file)
@@ -328,6 +328,11 @@ class faiManagement extends plugin
           $this->dialog= FALSE;
           FAI::save_release_changes_now();
           $to_del = FAI::clean_up_releases($dn);
+          /* Remove sub-objects (e.g. the variable key/value of a FAIvariable) from LDAP entirely */
+          $children = FAI::get_child_objects($dn);
+          if ($children) {
+            $to_del += $children;
+          }
           foreach($to_del as $dn){
             $ldap->rmdir_recursive($dn);
           }
@@ -971,6 +976,21 @@ class faiManagement extends plugin
                        }else{
                                $this->dialog->save();
         FAI::save_release_changes_now();
+        $to_del = FAI::clean_up_releases($this->dn, false);
+        $ldap = $this->config->get_ldap_link();
+        $ldap->cd($this->dn);
+        foreach($to_del as $dn){
+          /* Only delete subobjects of the current FAI class */
+          $ldap->cd($this->dn);
+          $ldap->search("(|(objectClass=FAIclass)(objectClass=FAIdebconfInfo))", array('dn'));
+          if ($ldap->count()){
+            while($attrs = $ldap->fetch()){
+              if ($attrs['dn'] == $dn) {
+                $ldap->rmdir_recursive($dn);
+              }
+            }
+          }
+        }
         if (!isset($_POST['edit_apply'])){
           $this->remove_lock();
           $this->dialog=FALSE;