summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c243712)
raw | patch | inline | side by side (parent: c243712)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Jul 2006 08:44:34 +0000 (08:44 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Jul 2006 08:44:34 +0000 (08:44 +0000) |
Better handle for object removement.
Fixed debug output
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4034 594d385d-05f5-0310-b6e9-bd551577e9d8
Fixed debug output
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4034 594d385d-05f5-0310-b6e9-bd551577e9d8
include/functions_FAI.inc | patch | blob | history |
index 15d18f373dcbcbc2c4e079a2cc813c3533153248..f565c07d1bd58d4fe2a44a0a24f6f7773135ff8a 100644 (file)
!!!!!!! No functionality just output
*/
-function prepare_to_save_FAI_object($Current_DN,$objectAttrs)
+function prepare_to_save_FAI_object($Current_DN,$objectAttrs,$removed = false)
{
/* Get ldap object */
global $config;
$is_new = false;
}
+ /* if parameter removed is true, we have to add FAIstate to the current attrs
+ FAIstate should end with ...|removed after this operation */
+ if($removed ){
+ $ldap->cat($Current_DN);
+
+ if((!$ldap->count()) && !empty($parent_obj)){
+ $ldap->cat($parent_obj);
+ }
+ if(!$ldap->count()){
+
+ echo "Error can't remove this object ".$Current_DN;
+ return;
+
+ }else{
+
+ $objectAttrs = prepare_ldap_fetch_to_be_saved($ldap->fetch());
+ if(isset($objectAttrs['FAIstate'][0])){
+ if(!preg_match("/removed$/",$objectAttrs['FAIstate'][0])){
+ $objectAttrs['FAIstate'][0] .= "|removed";
+ }
+ }else{
+ $objectAttrs['FAIstate'][0] = "|removed";
+ }
+ }
+ }
+
/* Check if this a leaf release or not */
if(count($following_releases) == 0 ){
echo "<b>Saving main object</b>".$Current_DN;
print_a($objectAttrs);
-
- $key = $r[key($r)];
- echo "<b>Saving parent to following release</b> ".$key;
- print_a($parent_attrs);
-
+
save_FAI_object($Current_DN,$objectAttrs);
- save_FAI_object($key,$parent_attrs);
+ foreach($r as $key){
+ echo "<b>Saving parent to following release</b> ".$key;
+ print_a($parent_attrs);
+ save_FAI_object($key,$parent_attrs);
+ }
}else{
echo "<b>Saving main object</b>".$Current_DN;
save_FAI_object($Current_DN,$objectAttrs);
- $key = $r[key($r)];
- echo "<b>Create an empty placeholder in follwing release</b> ".$key;
if(isset($objectAttrs['FAIstate'])){
$objectAttrs['FAIstate'] .= "|removed";
}else{
$objectAttrs['FAIstate'] = "|removed";
}
- print_a($objectAttrs);
- save_FAI_object($key,$objectAttrs);
+
+ foreach($r as $key ){
+ echo "<b>Create an empty placeholder in follwing release</b> ".$key;
+ print_a($objectAttrs);
+ save_FAI_object($key,$objectAttrs);
+ }
}
}else{
/* check if we must patch the follwing release */
if(!empty($r)){
- $key = $r[key($r)];
- echo "<b>Copy current objects original attributes to next release</b> ".$key;
- print_a($parent_attrs);
- save_FAI_object($key,$parent_attrs);
+ foreach($r as $key ){
+ echo "<b>Copy current objects original attributes to next release</b> ".$key;
+ print_a($parent_attrs);
+ save_FAI_object($key,$parent_attrs);
+ }
}
echo "<b>Saving current object</b>".$parent_obj;
echo "<b>Error they must be equal : </b>".$parent_obj."<br><b> and </b><br> ".$Current_DN."<br>";
}
}
- unset($r[key($r)]);
- echo "<br> the result will be inherited by .";
- foreach($r as $release => $value){
- echo "<br> : <i>".$release."</i>";
- }
}
echo "<br>.--------------------------------------------------------------------.<br>";
}
$base_release = get_release_dn($dn);
/* Get previous release dns */
- $sub_releases = get_sub_releases_of_this_release($base_release,true);
+ $sub_releases = get_sub_releases_of_this_release($base_release);
/* Get dn suffix. Example "FAIvairableEntry=keksdose,FAIvariable=Keksregal," */
$dn_suffix = str_ireplace($base_release,"",$dn);
-
+
/* Check if given object also exists whitin one of these releases */
foreach($sub_releases as $p_release => $name){
$ldap->cat($check_dn,array("dn","objectClass"));
if($ldap->count()){
- return($ret);
+ //return($ret);
}else{
$ret[$check_dn]=$check_dn;
}