From: hickert Date: Tue, 20 Jun 2006 10:50:59 +0000 (+0000) Subject: Fixed snapshot creation X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c0eb555e5c33de4b0c5277d7c7b6593a4fcdb928;p=gosa.git Fixed snapshot creation git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3833 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_ldap.inc b/include/class_ldap.inc index 39482bf6a..13da40948 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -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 */ diff --git a/include/class_plugin.inc b/include/class_plugin.inc index d3515c98c..1b0e3837d 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -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.")); diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index eeb9d53ea..abcf27081 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -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); }