index a54100c03e90b5125f14a7af7d982b81e3b6b26e..6843c0d48610a32c24fdfcf0b5dbf5515a6f75c5 100644 (file)
global $config;
$ldap = $config->get_ldap_link();
$ldap->cd($config->current['BASE']);
+ $res = array();
+ $tmp = array();
+
+ if(!is_release_department($Current_DN)) {
+ return($res);
+ }
/* Collect some basic informations and initialize some variables */
$base_release = get_release_dn($Current_DN);
$previous_releases = array_reverse(get_previous_releases_of_this_release($base_release,true));
- $res = array();
- $tmp = array();
/* We must also include the given release dn */
$previous_releases[] = $base_release;
}
-
-/* Return the object defining ObjectClass e.g. FAIscriptEntry */
-function get_FAI_type($attr)
-{
- $arr = array( "FAIprofile","FAIpartitionTable", "FAIpartitionDisk","FAIpartitionEntry","FAIhook","FAIhookEntry",
- "FAIscriptEntry","FAIscript","FAIvariable","FAIvariableEntry","FAIpackageList","FAItemplate",
- "FAItemplateEntry","FAIdebconfInfo","FAIrepository","FAIrepositoryServer","FAIbranch","FAIreleaseTag");
- foreach($arr as $name){
- if(in_array($name,$attr['objectClass'])){
- preg_match("");
- return($name);
- }
- }
- if(DEBUG_FAI_FUNC) { echo "Not found"; }
- return("");
-}
-
-
/* Return all relevant FAI departments */
function get_FAI_departments($suffix = "")
{
function get_all_releases_from_base($dn,$appendedName=false)
{
global $config;
- $base = "ou=fai,ou=configs,ou=systems,".$dn;
+
+ if(!preg_match("/ou=fai,ou=configs,ou=systems,/",$dn)){
+ $base = "ou=fai,ou=configs,ou=systems,".$dn;
+ }else{
+ $base = $dn;
+ }
$res = array();
$ldap = $config->get_ldap_link();
@@ -169,21 +160,31 @@ function prepare_to_save_FAI_object($Current_DN,$objectAttrs,$removed = false)
/* Detect differences in attribute arrays */
function array_diff_FAI($ar1,$ar2)
{
+
+ if((!isset($ar1['description'])) || (isset($ar1['description']) && (count($ar1['description']) == 0))){
+ $ar1['description'] = "";
+ }
+ if((!isset($ar2['description'])) || (isset($ar2['description']) && (count($ar2['description']) == 0))){
+ $ar2['description'] = "";
+ }
+
+ if(count($ar1) != count($ar2)) {
+ return (true);
+ }
+
foreach($ar1 as $key1 => $val1){
if((is_array($val1)) && (count($val1)==1)){
$ar1[$key1] = $val1[0];
}
- if(!isset($ar2[$key1])){
- return(true);
- }
-
if((is_array($ar2[$key1])) && (count($ar2[$key1])==1)){
$val1 = $val1[0];
$ar2[$key1] = $ar2[$key1][0];
}
}
+ ksort($ar1);
+ ksort($ar2);
if(count( array_diff($ar1,$ar2))){
return(true);
}else{
}
+/* Remove numeric index and 'count' from ldap->fetch result */
function prepare_ldap_fetch_to_be_saved($attrs)
{
foreach($attrs as $key => $value){
}
+/* Save given attrs to specified dn*/
function save_FAI_object($dn,$attrs)
{
global $config;
$ldap->cat($dn,array("dn"));
if($ldap->count()){
+ /* Remove FAIstate*/
if(!isset($attrs['FAIstate'])){
$attrs['FAIstate'] = array();
}
$ldap->modify($attrs);
}else{
+
+ /* Unset description if empty */
+ if(empty($attrs['description'])){
+ unset($attrs['description']);
+ }
+
$ldap->add($attrs);
}
show_ldap_error($ldap->get_error(),sprintf(_("Release management failed, can't save '%s'"),$dn));
}
+/* Return FAIstate freeze branch or "" for specified release department */
function get_release_tag($dn)
{
global $config;