From: hickert Date: Thu, 15 May 2008 13:19:38 +0000 (+0000) Subject: Added new function which allows renaming of entries without creating copies and remov... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=008af225edbe869973abffeed65c51bca6333505;p=gosa.git Added new function which allows renaming of entries without creating copies and removing old entries. -Just added the function without any implementing it anywhere. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10918 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_ldap.inc b/gosa-core/include/class_ldap.inc index bfd429c52..67921e0ba 100644 --- a/gosa-core/include/class_ldap.inc +++ b/gosa-core/include/class_ldap.inc @@ -443,6 +443,34 @@ class LDAP{ } } + + /*! \brief Move the given Ldap entry from $source to $dest + @param String $source The source dn. + @param String $dest The destination dn. + @return Boolean TRUE on success else FALSE. + */ + function rename_dn($source,$dest) + { + /* Extract the name and the parent part out ouf source dn. + e.g. cn=herbert,ou=department,dc=... + parent => ou=department,dc=... + dest => cn=herbert + */ + $parent = preg_replace("/^[^,]+,/","",$dest); + $dest = preg_replace("/,.*$/","",$dest); + + if($this->hascon){ + if ($this->reconnect) $this->connect(); + $r= @ldap_rename($this->cid,$source,$dest,$parent,TRUE); + $this->error = @ldap_error($this->cid); + return(!$r ? $r : TRUE); + }else{ + $this->error = "Could not connect to LDAP server"; + return(FALSE); + } + } + + /** * Function rmdir_recursive * @@ -451,7 +479,6 @@ class LDAP{ * GiveBack: True on sucessfull , 0 in error, and "" when we don't get a ldap conection * */ - function rmdir_recursive($srp, $deletedn) { if($this->hascon){