From: cajus Date: Wed, 10 May 2006 08:56:13 +0000 (+0000) Subject: Make it resist to non existing objects X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=da3cd1ec47581e95b7a66d39f2aad442f196085e;p=gosa.git Make it resist to non existing objects git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3259 594d385d-05f5-0310-b6e9-bd551577e9d8 --- 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 */