X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Ffunctions_FAI.inc;h=26c0a572659f10287d156965b74bdb68579e2095;hb=aa64d91c3b51a232fe8bd1c8e112cadd8f8f1245;hp=2c9297cad61318ec18086630e0982d10710fb70a;hpb=cb20ea359185bd3d912dfdde1bddae0911ddc8cb;p=gosa.git diff --git a/include/functions_FAI.inc b/include/functions_FAI.inc index 2c9297cad..26c0a5726 100644 --- a/include/functions_FAI.inc +++ b/include/functions_FAI.inc @@ -37,14 +37,12 @@ function get_all_objects_for_given_base($Current_DN,$filter,$detailed = false) foreach($deps_to_search as $fai_base){ /* Ldap search for fai classes specified in this release */ - $ldap->cd($fai_base); - $ldap->search($filter,array("dn","objectClass","FAIstate")); - + $res_tmp = get_list($filter,"fai",$fai_base,array("dn","objectClass","FAIstate"),GL_SUBSEARCH | GL_SIZELIMIT); + /* check the returned objects, and add/replace them in our return variable */ - while($attr = $ldap->fetch()){ + foreach($res_tmp as $attr){ $buffer = array(); -# $name = str_ireplace($release,"",$attr['dn']); $name = preg_replace("/".normalizePreg($release)."/i","",$attr['dn']); if(isset($attr['FAIstate'][0])){ @@ -186,7 +184,7 @@ function array_diff_FAI($ar1,$ar2) } ksort($ar1); ksort($ar2); - if(count( array_diff($ar1,$ar2))){ + if(count( array_diff($ar1,$ar2)) || arr_diff($ar1,$ar2)){ return(true); }else{ return(false); @@ -194,6 +192,21 @@ function array_diff_FAI($ar1,$ar2) } +function arr_diff($ar1,$ar2) +{ + foreach($ar1 as $ak1 => $av1){ + if(!isset($ar2[$ak1]) || (!($av1 === $ar2[$ak1]))){ + return(true); + }elseif(is_array($av1)){ + return(arr_diff($av1,$ar2[$ak1])); + } + } + return(FALSE); +} + + + + /* check which objects must be saved, and save them */ function save_release_changes_now() { @@ -280,7 +293,7 @@ function save_release_changes_now() /* Check if this a leaf release or not */ if(count($following_releases) == 0 ){ - /* This is a leaf object. It isn't unherited by any other object */ + /* This is a leaf object. It isn't inherited by any other object */ if(DEBUG_FAI_FUNC) { echo "Saving directly, is a leaf object
".$Current_DN; print_a($objectAttrs); @@ -575,9 +588,7 @@ function get_previous_releases_of_this_release($dn,$flat) $ret = array(); /* Explode dns into pieces, to be able to build parent dns */ -# $dns_to_check = ldap_explode_dn(str_ireplace(",".$config->current['BASE'],"",$dn),0); - $dns_to_check = ldap_explode_dn(preg_replace("/".normalizePreg(",".$config->current['BASE'])."/i","",$dn),0); - echo "Replace ldap_explode_dn it is evil, it changes characters within result...
"; + $dns_to_check = gosa_ldap_explode_dn(preg_replace("/".normalizePreg(",".$config->current['BASE'])."/i","",$dn)); if(!is_array($dns_to_check)){ return; @@ -682,9 +693,7 @@ function get_release_dn($Current_DN) $ldap->cd($config->current['BASE']); /* Split dn into pices */ -# $dns_to_check = ldap_explode_dn(str_ireplace(",".$config->current['BASE'],"",$Current_DN),0); - $dns_to_check = ldap_explode_dn(preg_replace("/".normalizePreg(",".$config->current['BASE'])."/i","",$Current_DN),0); - echo "Replace ldap_explode_dn it is evil, it changes characters within result...
"; + $dns_to_check = gosa_ldap_explode_dn(preg_replace("/".normalizePreg(",".$config->current['BASE'])."/i","",$Current_DN)); if(!is_array($dns_to_check)){ return;