Code

Moved snapshot routine here
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Jun 2006 07:43:51 +0000 (07:43 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Jun 2006 07:43:51 +0000 (07:43 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3740 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_plugin.inc

index 6b7eb8277a77da99d57727cee72f4106566b3515..d240213dc6bccc2a6a45cf4b20cce938abb38c77 100644 (file)
@@ -983,6 +983,25 @@ class plugin
     return $reason;
   }
 
+
+  /* Create a snapshot of the current object */
+  function create_snapshot($type= "snapshot", $description= "")
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    if ($ldap->dn_exists($this->$dn)){
+      $data= preg_replace('/^dn:.*\n/', '', $ldap->gen_ldif($this->dn));
+      $target= array();
+      $target['objectClass']= array("top", "gosaObjectSnapshot");
+      $target['gosaSnapshotData']= gzcompress($data, 6);
+      $target['gosaSnapshotType']= $type;
+      list($usec, $sec)= explode(" ", microtime());
+      $target['gosaShapshotTimestamp']= preg_replace("/\./", "", $sec.$usec);
+      $target['gosaShapshotDN']= $this->dn;
+      print_a($target);
+    }
+  }
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>