summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: da362fc)
raw | patch | inline | side by side (parent: da362fc)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Jul 2006 10:19:08 +0000 (10:19 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Jul 2006 10:19:08 +0000 (10:19 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4036 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/fai/class_faiScript.inc | patch | blob | history |
index 73028ecb2b20c0dbb2f0700a537e5f899f31c970..9a398886ce00d66ed95eb75f1e3326c5ea5fd206 100644 (file)
$ldap->cd ($this->dn);
$use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
-
- $attr = prepare_ldap_fetch_to_be_saved($this->attrs);
- if(isset($attr['FAIstate'][0])){
- if(!preg_match("/removed$/",$attr['FAIstate'][0])){
- $attr['FAIstate'][0] .= "|removed";
- }
- }else{
- $attr['FAIstate'][0] = "|removed";
+ if($_SESSION['faifilter']['branch'] == "main"){
+ $use_dn = $this->dn;
}
-
- prepare_to_save_FAI_object($use_dn,$attr);
+
+ $del = array();
+ $del[] = prepare_to_save_FAI_object($use_dn,array(),true);
foreach($this->SubObjects as $name => $obj){
-
$use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']);
+ if($_SESSION['faifilter']['branch'] == "main"){
+ $use_dn = $obj['dn'];
+ }
+ $del[] = prepare_to_save_FAI_object($use_dn,array(),true);
+ }
- $ldap->cat($obj['dn']);
- $attr = prepare_ldap_fetch_to_be_saved($ldap->fetch());
- if(isset($attr['FAIstate'][0])){
- if(!preg_match("/removed$/",$attr['FAIstate'][0])){
- $attr['FAIstate'][0] .= "|removed";
- }
- }else{
- $attr['FAIstate'][0] = "|removed";
+ /* Delete unused objects */
+ foreach($del as $dn){
+ if(!empty($dn)){
+ $ldap->cat($dn);
+ if($ldap->count()){
+ $ldap->rmdir_recursive($dn);
+ }
}
- prepare_to_save_FAI_object($use_dn,$attr);
}
}
if($obj['status'] == "delete"){
-
- $tmp['FAIstate'] = "|removed";
- prepare_to_save_FAI_object($sub_dn,$tmp);
-
- $ldap->cd($sub_dn);
- //$ldap->rmdir_recursive($sub_dn);
+ prepare_to_save_FAI_object($sub_dn,array(),true);
$this->handle_post_events("remove");
- show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/script entry with dn '%s' failed."),$this->dn));
}elseif($obj['status'] == "edited"){
- $ldap->cd($sub_dn);
- $this->cleanup();
prepare_to_save_FAI_object($sub_dn,$tmp);
- // $ldap->modify ($tmp);
-
$this->handle_post_events("modify");
}elseif($obj['status']=="new"){
- if($tmp['description']==array()){
- unset($tmp['description']);
- }
- if($tmp['FAIscript']==array()){
- $tmp['FAIscript']=" ";
- }
- $ldap->cd($this->config->current['BASE']);
- $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
- $ldap->cd($sub_dn);
prepare_to_save_FAI_object($sub_dn,$tmp);
- // $ldap->add($tmp);
$this->handle_post_events("add");
- show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/script entry with dn '%s' failed."),$this->dn));
}
$this->handle_object_tagging($sub_dn, $this->gosaUnitTag);