Code

removed debug code.
[gosa.git] / gosa-core / include / class_plugin.inc
index 06336cd2e231b19302ff5051666c03444a612edc..3527494d88e01990e729d981e3ed15fb021018b2 100644 (file)
@@ -212,7 +212,7 @@ class plugin
           unset($this->saved_attributes[$index]);
           continue;
         }
-        if ($this->saved_attributes[$index]["count"] == 1){
+        if (isset($this->saved_attributes[$index][0]) || $this->saved_attributes[$index]["count"] == 1){
           $tmp= $this->saved_attributes[$index][0];
           unset($this->saved_attributes[$index]);
           $this->saved_attributes[$index]= $tmp;
@@ -817,7 +817,7 @@ class plugin
   {
     /* Rename dn in possible object groups */
     $ldap= $this->config->get_ldap_link();
-    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::preapre4filter($src_dn).'))',
+    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::prepare4filter($src_dn).'))',
         array('cn'));
     while ($attrs= $ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
@@ -855,6 +855,11 @@ class plugin
 
   function move($src_dn, $dst_dn)
   {
+    /* Do not copy if only upper- lowercase has changed */
+    if(strtolower($src_dn) == strtolower($dst_dn)){
+      return(TRUE);
+    }
+
     /* Copy source to destination */
     if (!$this->copy($src_dn, $dst_dn)){
       return (FALSE);
@@ -887,31 +892,11 @@ class plugin
       return (FALSE);
     }
 
-    /* Perform a search for all objects to be moved */
-    $objects= array();
-    $ldap->cd($src_dn);
-    $ldap->search("(objectClass=*)", array("dn"));
-    while($attrs= $ldap->fetch()){
-      $dn= $attrs['dn'];
-      $objects[$dn]= strlen($dn);
-    }
-
-    /* Sort objects by indent level */
-    asort($objects);
-    reset($objects);
-
-    /* Copy objects from small to big indent levels by replacing src_dn by dst_dn */
-    foreach ($objects as $object => $len){
-      $src= $object;
-      $dst= preg_replace("/$src_dn$/", "$dst_dn", $object);
-      if (!$this->copy($src, $dst)){
-        return (FALSE);
-      }
-    }
+    $this->copy($src_dn, $dst_dn);
 
     /* Remove src_dn */
     $ldap->cd($src_dn);
-    $ldap->recursive_remove();
+    $ldap->recursive_remove($src_dn);
     return (TRUE);
   }