summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4b44e1f)
raw | patch | inline | side by side (parent: 4b44e1f)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 21 Jun 2006 06:56:06 +0000 (06:56 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 21 Jun 2006 06:56:06 +0000 (06:56 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3842 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_plugin.inc | patch | blob | history |
index 4e83bf9dde8bce43fcbd2f918e64affe4c8ea9fc..30743f55a719819db773c0a032d7e80eb5de8064 100644 (file)
--- a/include/class_plugin.inc
+++ b/include/class_plugin.inc
/* Get configuration from gosa.conf */
$tmp = $this->config->data['MAIN'];
-
- /* Check if the snapshot_base is defined */
- if(!isset($tmp['SNAPSHOT_BASE'])){
- print_red(_("Can't create a new snapshot, the required variable SNAPSHOT_BASE in not configured in your gosa.conf."));
- return;
- }
-
/* Check if the undo level is specified */
if(isset($tmp['SNAPSHOT_UNDO_LEVEL'])){
$UndoLvl = $tmp['SNAPSHOT_UNDO_LEVEL'];
$ldap_to = $ldap;
}else{
+ $server = $tmp['SNAPSHOT_SERVER'];
+ $user = $tmp['SNAPSHOT_USER'];
+ $password = $tmp['SNAPSHOT_PASSWORD'];
+ $snapldapbase = $tmp['SNAPSHOT_LDAP_BASE'];
- /* check if all required vars are available to create a new ldap connection */
- $missing = "";
- foreach(array("SNAPSHOT_SERVER","SNAPSHOT_USER","SNAPSHOT_PASSWORD","SNAPSHOT_LDAP_BASE") as $var){
- if(!isset($tmp[$var])){
- $missing .= $var." ";
- }
- }
-
- /* All vars are available, create a seperate ldap connection to store snapshots */
- if($missing == ""){
- $server = $tmp['SNAPSHOT_SERVER'];
- $user = $tmp['SNAPSHOT_USER'];
- $password = $tmp['SNAPSHOT_PASSWORD'];
- $snapldapbase = $tmp['SNAPSHOT_LDAP_BASE'];
-
- $ldap_to = new LDAP($user,$password, $server);
- $ldap_to -> cd($snapldapbase);
- show_ldap_error($ldap_to->get_error(), _("Snapshot failed."));
-
- }else{
- print_red(sprintf(_("Can't create a new snapshot the following variables are not configured in your gosa.conf '%s'."),$missing));
- return;
- }
+ $ldap_to = new LDAP($user,$password, $server);
+ $ldap_to -> cd($snapldapbase);
+ show_ldap_error($ldap_to->get_error(), _("Snapshot failed."));
}
$target['gosaSnapshotTimestamp'] = $newName;
}
-
/* Inset this new snapshot */
$ldap_to->create_missing_trees($new_base);
$ldap_to->cd($new_dn);
}
- /* returns true if snapshots are enabled */
+ /* returns true if snapshots are enabled, and false if it is disalbed
+ There will also be some errors psoted, if the configuration failed */
function snapshotEnabled()
{
$tmp = $this->config->data['MAIN'];
if(isset($tmp['ENABLE_SNAPSHOT'])){
if (preg_match("/^true$/i", $tmp['ENABLE_SNAPSHOT']) || preg_match("/yes/i", $tmp['ENABLE_SNAPSHOT'])){
+
+ /* Check if the snapshot_base is defined */
+ if(!isset($tmp['SNAPSHOT_BASE'])){
+ print_red(_("The snapshot functionality is enabled, but the required variable SNAPSHOT_BASE is not configured in your gosa.conf."));
+ return(FALSE);
+ }
+
+ /* check if there are special server configurations for snapshots */
+ if(isset($tmp['SNAPSHOT_SERVER'])){
+
+ /* check if all required vars are available to create a new ldap connection */
+ $missing = "";
+ foreach(array("SNAPSHOT_SERVER","SNAPSHOT_USER","SNAPSHOT_PASSWORD","SNAPSHOT_LDAP_BASE") as $var){
+ if(!isset($tmp[$var])){
+ $missing .= $var." ";
+ print_red(sprintf(_("The snapshot functionality is enabled, but the required variable(s) '%s' is not configured in your gosa.conf."),$missing));
+ return(FALSE);
+ }
+ }
+ }
return(TRUE);
}
}
$ldap->cd($this->config->current['BASE']);
$tmp = $this->config->data['MAIN'];
- if(!isset($tmp['SNAPSHOT_BASE'])){
- print_red(_("Please specify the attribute SNAPSHOT_BASE in your gosa.conf."));
- return(array());
- }
-
/* check if there are special server configurations for snapshots */
if(isset($tmp['SNAPSHOT_SERVER'])){
$server = $tmp['SNAPSHOT_SERVER'];
}
}
-
-
/* Format result as requested */
if($raw) {
return($tmp);
/* Prepare import string */
$data = gzuncompress($ldap_to->get_attribute($dn,'gosaSnapshotData'));
-// $data = "dn: ".$restoreObject['gosaSnapshotDN'][0]."\n".$data;
/* Import the given data */
$ldap->import_complete_ldif($data,$err,true,true);