summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3e7b257)
raw | patch | inline | side by side (parent: 3e7b257)
author | blainett <blainett@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 27 Jul 2005 09:53:54 +0000 (09:53 +0000) | ||
committer | blainett <blainett@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 27 Jul 2005 09:53:54 +0000 (09:53 +0000) |
class_oxchangeAccount: change rmdir for rmdir_recursive for full clean of ldap subtree
of open-xchange users.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1010 594d385d-05f5-0310-b6e9-bd551577e9d8
of open-xchange users.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1010 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_ldap.inc | patch | blob | history | |
plugins/personal/connectivity/class_oxchangeAccount.inc | patch | blob | history |
diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index e6ed318e2f624375433b702a3c15cf42e20e6361..43c8b7b80b7ed2e41a91de829a146a0f6a702522 100644 (file)
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
}
}
+ /**
+ * Function rmdir_recursive
+ *
+ * Description: Based in recursive_remove, adding two thing: full subtree remove, and delete own node.
+ * Parameters: The dn to delete
+ * GiveBack: True on sucessfull , 0 in error, and "" when we don't get a ldap conection
+ *
+ */
+
+ function rmdir_recursive($deletedn)
+ {
+ if($this->hascon){
+ if ($this->reconnect) $this->connect();
+ $delarray= array();
+
+ /* Get sorted list of dn's to delete */
+ $this->ls ("(objectClass=*)",$deletedn);
+ while ($this->fetch()){
+ $deldn= $this->getDN();
+ $delarray[$deldn]= strlen($deldn);
+ }
+ arsort ($delarray);
+ reset ($delarray);
+
+ /* Really Delete ALL dn's in subtree */
+ foreach ($delarray as $key => $value){
+ $this->rmdir_recursive($key);
+ }
+
+ /* Finally Delete own Node */
+ $r = @ldap_delete($this->cid, $deletedn);
+ $this->error = @ldap_error($this->cid);
+ return($r ? $r : 0);
+ }else{
+ $this->error = "Could not connect to LDAP server";
+ return("");
+ }
+ }
+
+
function modify($attrs)
{
if($this->hascon){
diff --git a/plugins/personal/connectivity/class_oxchangeAccount.inc b/plugins/personal/connectivity/class_oxchangeAccount.inc
index 0083e985d3bd67de8a9cc61cceff290596324dc0..062ceb3aa4a75413b421c07782cedc5cc1399b5b 100644 (file)
$ldap= $this->config->get_ldap_link();
if($ldap->dn_exists("ou=addr,".$this->dn)){
- $ldap->rmdir("ou=addr,".$this->dn);
+ $ldap->rmdir_recursive("ou=addr,".$this->dn);
show_ldap_error($ldap->get_error());
}