From da3cd1ec47581e95b7a66d39f2aad442f196085e Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 10 May 2006 08:56:13 +0000 Subject: [PATCH] Make it resist to non existing objects git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3259 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_plugin.inc | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/include/class_plugin.inc b/include/class_plugin.inc index 81e317daa..52a2a0379 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -909,18 +909,22 @@ class plugin echo "DEBUG: $dn is already tagged
"; return; } - echo "DEBUG: Add tagging ($tag) to $dn.
"; - $nattrs= array("gosaUnitTag" => $this->gosaUnitTag); - $nattrs['objectClass']= array(); - for ($i= 0; $i<$attrs['objectClass']['count']; $i++){ - $oc= $attrs['objectClass'][$i]; - if ($oc != "gosaAdministrativeUnitTag"){ - $nattrs['objectClass'][]= $oc; + if (count($attrs)){ + echo "DEBUG: Add tagging ($tag) to $dn.
"; + $nattrs= array("gosaUnitTag" => $this->gosaUnitTag); + $nattrs['objectClass']= array(); + for ($i= 0; $i<$attrs['objectClass']['count']; $i++){ + $oc= $attrs['objectClass'][$i]; + if ($oc != "gosaAdministrativeUnitTag"){ + $nattrs['objectClass'][]= $oc; + } } + $nattrs['objectClass'][]= "gosaAdministrativeUnitTag"; + $ldap->cd($dn); + $ldap->modify($nattrs); + } else { + echo "DEBUG: not tagging ($tag) $dn - seems to have moved away
"; } - $nattrs['objectClass'][]= "gosaAdministrativeUnitTag"; - $ldap->cd($dn); - $ldap->modify($nattrs); } else { /* Remove objectclass and attribute */ -- 2.30.2