From 4eada416b09245b96e3f9c6b38f1a9c2f3290bd8 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 18 Sep 2006 07:10:27 +0000 Subject: [PATCH] Fixed fai package. Package configuration wasn't loaded from correct base git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4703 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiPackage.inc | 67 ++++++++++++++------------ 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc index 9114c3bb9..f40c1eaea 100644 --- a/plugins/admin/fai/class_faiPackage.inc +++ b/plugins/admin/fai/class_faiPackage.inc @@ -100,45 +100,48 @@ class faiPackage extends plugin $this->usedPackages = array(); } + if($dn != "new"){ - /* Create one filter with all package names, - instead of calling $ldap->search for every single package - */ - $PackageFilter = ""; - foreach($this->usedPackages as $name){ - $PackageFilter .= "(FAIpackage=".$name.")"; - } - $PackageFilter = "(&(objectClass=FAIdebconfInfo)(|".$PackageFilter."))"; - - /* Search for configuration objects */ - $ldap = $this->config->get_ldap_link(); - $ldap->search($PackageFilter,array("FAIvariable","FAIvariableType","FAIvariableContent","FAIpackage","FAIdebianSection","FAIstate")); + /* Create one filter with all package names, + instead of calling $ldap->search for every single package + */ + $PackageFilter = ""; + foreach($this->usedPackages as $name){ + $PackageFilter .= "(FAIpackage=".$name.")"; + } + $PackageFilter = "(&(objectClass=FAIdebconfInfo)(|".$PackageFilter."))"; - /* Walk through configurations and append them to our list of ConfiguredPackages */ - while($attr = $ldap->fetch()){ + /* Search for configuration objects */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $ldap->search($PackageFilter,array("FAIvariable","FAIvariableType","FAIvariableContent","FAIpackage","FAIdebianSection","FAIstate")); - /* Skip objects, that are tagged as removed */ - if(isset($object['FAIstate'][0])){ - if(preg_match("/removed$/",$attr['FAIstate'][0])){ - continue; - } - } + /* Walk through configurations and append them to our list of ConfiguredPackages */ + while($attr = $ldap->fetch()){ - $tmp =array(); - $tmp['Name'] = $attr['FAIvariable'][0]; - $tmp['Type'] = $attr['FAIvariableType'][0]; + /* Skip objects, that are tagged as removed */ + if(isset($object['FAIstate'][0])){ + if(preg_match("/removed$/",$attr['FAIstate'][0])){ + continue; + } + } - if (isset($attr['FAIvariableContent'][0])){ - if(!in_array($attr['FAIvariableType'],array("multiselect"))){ - $tmp['Value'] = $attr['FAIvariableContent'][0]; - }else{ - $content = array(); - unset($attr['FAIvariableContent']['count']); - foreach($attr['FAIvariableContent'] as $attr){ - $tmp['Value'][] = $attr; + $tmp =array(); + $tmp['Name'] = $attr['FAIvariable'][0]; + $tmp['Type'] = $attr['FAIvariableType'][0]; + + if (isset($attr['FAIvariableContent'][0])){ + if(!in_array($attr['FAIvariableType'],array("multiselect"))){ + $tmp['Value'] = $attr['FAIvariableContent'][0]; + }else{ + $content = array(); + unset($attr['FAIvariableContent']['count']); + foreach($attr['FAIvariableContent'] as $attr){ + $tmp['Value'][] = $attr; + } } + $this->ConfiguredPackages[$attr['FAIpackage'][0]][$attr['FAIvariable'][0]]=$tmp; } - $this->ConfiguredPackages[$attr['FAIpackage'][0]][$attr['FAIvariable'][0]]=$tmp; } } -- 2.30.2