From ee0e974edb3102370aa82ecad20100b868193e0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Thu, 13 Oct 2016 11:49:24 +0200
Subject: [PATCH] Removed recursive_remove (unused and did the same thing as
 rmdir_recursive)

---
 include/class_ldap.inc            | 29 +++--------------------------
 include/class_ldapMultiplexer.inc |  2 +-
 2 files changed, 4 insertions(+), 27 deletions(-)

diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 77ee3aa9c..fd6a35561 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -668,7 +668,7 @@ class LDAP
   /*!
    * \brief Function rmdir_recursive
    *
-   * Based in recursive_remove, adding two thing: full subtree remove, and delete own node.
+   * Based on recursive_remove, adding two thing: full subtree remove, and delete own node.
    *
    * \param $srp srp
    *
@@ -686,7 +686,7 @@ class LDAP
 
       /* Get sorted list of dn's to delete */
       $this->cd($deletedn);
-      $this->search($srp, "(objectClass=*)", array('dn'));
+      $this->search($srp, '(objectClass=*)', array('dn'));
       while ($attrs = $this->fetch($srp)) {
         $delarray[$attrs['dn']] = strlen($attrs['dn']);
       }
@@ -695,7 +695,7 @@ class LDAP
 
       /* Really Delete ALL dn's in subtree */
       foreach (array_keys($delarray) as $key) {
-        $r = @ldap_delete($this->cid, LDAP::fix($key));
+        $r = @ldap_delete($this->cid, $key);
         if ($r === FALSE) {
           break;
         }
@@ -912,29 +912,6 @@ class LDAP
     return TRUE;
   }
 
-  /*!
-   * \brief Recursive remove
-   *
-   * \param integer $srp
-   */
-  function recursive_remove($srp)
-  {
-    $delarray = array();
-
-    /* Get sorted list of dn's to delete */
-    $this->search($srp, '(objectClass=*)');
-    while ($attrs = $this->fetch($srp)) {
-      $delarray[$attrs['dn']] = strlen($attrs['dn']);
-    }
-    arsort($delarray);
-    reset($delarray);
-
-    /* Delete all dn's in subtree */
-    foreach (array_keys($delarray) as $key) {
-      $this->rmdir($key);
-    }
-  }
-
   /*!
    * \brief Read a entry from a directory
    *
diff --git a/include/class_ldapMultiplexer.inc b/include/class_ldapMultiplexer.inc
index 89c1fddec..add456b28 100644
--- a/include/class_ldapMultiplexer.inc
+++ b/include/class_ldapMultiplexer.inc
@@ -60,7 +60,7 @@ class ldapMultiplexer {
   public function __call($methodName, $parameters)
   {
     /* Add resource pointer if the mentioned methods are used */
-    if (in_array($methodName, array('search','ls','cat','fetch','clearResult','resetResult','count','getDN','recursive_remove','rmdir_recursive','create_missing_trees','import_single_entry','import_complete_ldif'))) {
+    if (in_array($methodName, array('search','ls','cat','fetch','clearResult','resetResult','count','getDN','rmdir_recursive','create_missing_trees','import_single_entry','import_complete_ldif'))) {
       array_unshift($parameters, $this->sr);
     }
 
-- 
GitLab