summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eabd287)
raw | patch | inline | side by side (parent: eabd287)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 20 Jul 2009 11:58:56 +0000 (11:58 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 20 Jul 2009 11:58:56 +0000 (11:58 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13940 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-plugins/fai/admin/fai/class_FAI.inc | patch | blob | history | |
trunk/gosa-plugins/fai/admin/fai/class_faiManagement.inc | patch | blob | history |
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc b/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc
index 2922694972d0b5606474214f985d3be3fdfeef3d..bb0e295e55a0ed583d6507be4c2aead135166e3a 100644 (file)
/* this function will remove all unused (deleted) objects,
- that have no parent object */
- static function clean_up_releases($Current_DN)
+ that have no parent object. If $recursive is set to true,
+ also check sub releases. */
+ static function clean_up_releases($Current_DN, $recursive=true)
{
global $config;
$ldap = $config->get_ldap_link();
/* We must also include the given release dn */
$previous_releases[] = $base_release;
- /* Merge parent, current and child releases into one big release to
- iterate over */
$all_releases = $previous_releases;
- foreach($sub_releases as $sub_release){
- $all_releases[] = $sub_release;
+
+ if ($recursive) {
+ /* Merge parent, current and child releases into one big release to
+ iterate over */
+ foreach($sub_releases as $sub_release){
+ $all_releases[] = $sub_release;
+ }
}
/* Walk through all releases */
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiManagement.inc
index ecbfd736d2b8d5ff8f2b62d96eb4806c44fb0772..7f40c58b622ca2f8f96ce3bf2cb7aa12f3b9a4ff 100644 (file)
}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 */
+ $cn = $ldap->getCn($dn);
+ $ldap->search("cn=$cn", 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;