Code

Fixed snapshot creation
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 20 Jun 2006 10:50:59 +0000 (10:50 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 20 Jun 2006 10:50:59 +0000 (10:50 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3833 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_ldap.inc
include/class_plugin.inc
plugins/admin/departments/class_departmentManagement.inc

index 39482bf6a0a6193e244742f4b4eb64292cdd96e9..13da40948e31f36d373bc416cc6cc576b56dea0c 100644 (file)
@@ -797,7 +797,7 @@ class LDAP{
   }
 
 
-  function gen_ldif ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $recursive= TRUE)
+  function gen_ldif ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $recursive= TRUE,$first = true)
   {
     $display= "";
 
@@ -805,6 +805,11 @@ class LDAP{
       $this->cd($dn);
       $this->ls($filter,$dn, array('dn','objectClass'));
       $deps = array();
+
+      if($first){
+        $display .= $this->gen_one_entry($dn)."\n";
+      }
+
       while ($attrs= $this->fetch()){
         $display.= $this->gen_one_entry($attrs['dn'], $filter, $attributes);
         $display.= "\n";
@@ -814,7 +819,7 @@ class LDAP{
         }
       }
       foreach($deps as $dn){
-        $display .= $this->gen_ldif($dn, $filter,$attributes,$recursive);
+        $display .= $this->gen_ldif($dn, $filter,$attributes,$recursive,false);
       }
     } else {
       $display.= $this->gen_one_entry($dn);
@@ -1017,8 +1022,6 @@ class LDAP{
   {
     if($this->reconnect) $this->connect();
 
-    
-
     $ret = false;
     $rows= split("\n",$str_attr);
     $data= false;
@@ -1061,7 +1064,8 @@ class LDAP{
           }
         }
       }
-    } 
+    }
+
     /* If dn is an index of data, we should try to insert the data */
     if(isset($data['dn'])) {
       /* Creating Entry */
index d3515c98cb954b5eaef0b900d739cd558d49960b..1b0e3837d319d397fcef08139bffee6f1511feb0 100644 (file)
@@ -1023,7 +1023,8 @@ class plugin
       $new_base       = preg_replace("/".normalizePreg($base)."$/","",$base_of_object).$snap_base;
 
       /* Create object */
-      $data             = preg_replace('/^dn:.*\n/', '', $ldap->gen_ldif($this->dn,"(!(objectClass=gosaDepartment))"));
+      #$data             = preg_replace('/^dn:.*\n/', '', $ldap->gen_ldif($this->dn,"(!(objectClass=gosaDepartment))"));
+      $data             = $ldap->gen_ldif($this->dn,"(!(objectClass=gosaDepartment))");
       $newName          = preg_replace("/\./", "", $sec."-".$usec);
       $target= array();
       $target['objectClass']            = array("top", "gosaSnapshotObject");
@@ -1228,8 +1229,8 @@ class plugin
     
     /* Prepare import string */
     $data  = gzuncompress($ldap_to->get_attribute($dn,'gosaSnapshotData'));
-    $data =  "dn: ".$restoreObject['gosaSnapshotDN'][0]."\n".$data; 
-  
+//    $data =  "dn: ".$restoreObject['gosaSnapshotDN'][0]."\n".$data; 
     /* Import the given data */
     $ldap->import_complete_ldif($data,$err,true,true);
     show_ldap_error($ldap_to->get_error().$err, _("Restore snapshot failed."));
index eeb9d53eae2bd18050a6a8c2a828b4a489927d1f..abcf27081e829650c397a29f9655c4759edc8213 100644 (file)
@@ -306,7 +306,7 @@ class departmentManagement extends plugin
     }else{
 
       /* Check if there is a snapshot dialog open */
-      if($str = $this->showSnapshotDialog($this->DivListDepartment->selectedBase,"")){
+      if($str = $this->showSnapshotDialog($this->DivListDepartment->selectedBase,$this->DivListDepartment->selectedBase)){
         return($str);
       }