From: hickert Date: Wed, 8 Sep 2010 07:30:34 +0000 (+0000) Subject: Applied LHM commit #1042 (r19542) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d7f304017b03a04b5aa396dc290e4daf3d43fb02;p=gosa.git Applied LHM commit #1042 (r19542) -Ensures that FAIprofiles wont be messed up while removing FAIclasses such as partition, scripts, aso. If a script named 'test' was removed and a profile contained test123 too, it now contained just '123'. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19555 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/fai/admin/fai/class_FAI.inc b/gosa-plugins/fai/admin/fai/class_FAI.inc index deddde2ba..e5d40a980 100644 --- a/gosa-plugins/fai/admin/fai/class_FAI.inc +++ b/gosa-plugins/fai/admin/fai/class_FAI.inc @@ -271,17 +271,21 @@ class FAI /* Check if this Profile uses the source class ($cn) */ - if(preg_match("/".preg_quote($cn, '/')."/",$attrs['FAIclass'])){ - $attrs['FAIclass'] = preg_replace("/[ ]*".preg_quote($cn, '/')."[ ]*/i"," ",$attrs['FAIclass']); - if(empty($attrs['FAIclass'])){ + $classlist = split(" ", $attrs['FAIclass']); + $new_classlist = ""; + foreach($classlist as $class){ + if($class != $cn){ + $new_classlist = $new_classlist." ".$class; + } + } + $attrs['FAIclass'] = $new_classlist; + if(empty($attrs['FAIclass'])){ $attrs['FAIclass'] = array(); - } - $ldap->cd($dn['dn']); - $ldap->modify($attrs); - - if (!$ldap->success()){ + } + $ldap->cd($dn['dn']); + $ldap->modify($attrs); + if (!$ldap->success()){ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class())); - } } } }