From c98b37e992e237594d57ef86bddfb54de5f38a7b Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 13 Jun 2006 07:17:46 +0000 Subject: [PATCH] Updated snapshot mangement git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3791 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_plugin.inc | 24 +++++++++++-- plugins/admin/systems/class_divListSystem.inc | 34 ++++++++++++------- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/include/class_plugin.inc b/include/class_plugin.inc index b4f7b1efb..b30cdcb1d 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -987,6 +987,8 @@ class plugin /* Create a snapshot of the current object */ function create_snapshot($type= "snapshot", $description= array()) { + if(!$this->snapshotEnabled()) return; + /* Create 2 ldap connections one connection points to the snapshot server and one to our basic ldap server */ @@ -1052,11 +1054,26 @@ class plugin } } + + /* returns true if snapshots are enabled */ + 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'])){ + return(TRUE); + } + } + return(false); + } + /* Return available snapshots for the given base */ function Available_SnapsShots($dn,$raw = false) { + if(!$this->snapshotEnabled()) return(array()); + /* Create an additional ldap object which points to our ldap snapshot server */ $ldap= $this->config->get_ldap_link(); @@ -1064,7 +1081,7 @@ class plugin $tmp = $this->config->data['MAIN']; if(!isset($tmp['SNAPSHOT_BASE'])){ - print_red(_("Please specify the attribute SNAPSHOT_SERVER in your gosa.conf.")); + print_red(_("Please specify the attribute SNAPSHOT_BASE in your gosa.conf.")); return(array()); } @@ -1094,7 +1111,7 @@ class plugin array("gosaSnapshotType","gosaSnapshotTimestamp","gosaSnapshotDN","description")); /* Put results into a list and add description if missing */ - while($entry = $ldap->fetch()){ + while($entry = $ldap_to->fetch()){ if(!isset($entry['description'][0])){ $entry['description'][0] = ""; } @@ -1116,6 +1133,7 @@ class plugin function getAllDeletedSnapshots($base_of_object,$raw = false) { + if(!$this->snapshotEnabled()) return(array()); /* Create an additional ldap object which points to our ldap snapshot server */ @@ -1177,6 +1195,8 @@ class plugin /* Restore selected snapshot */ function restore_snapshot($dn) { + if(!$this->snapshotEnabled()) return(array()); + $ldap= $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); $tmp = $this->config->data['MAIN']; diff --git a/plugins/admin/systems/class_divListSystem.inc b/plugins/admin/systems/class_divListSystem.inc index d92ffacbe..d92675614 100644 --- a/plugins/admin/systems/class_divListSystem.inc +++ b/plugins/admin/systems/class_divListSystem.inc @@ -91,11 +91,15 @@ class divListSystem extends MultiSelectWindow "  ". "  ". - "  ". - " ". - "  ". - "  "; + + if($this->parent->snapshotEnabled()){ + $listhead .= " ". + "  "; + } + + $listhead .= " ". " ". @@ -125,14 +129,18 @@ class divListSystem extends MultiSelectWindow function GetSnapShotActions($dn) { $str = ""; - $str .=" "; - - if(count($this->parent->Available_SnapsShots($dn))){ - $str .=" "; - }else{ - $str.= " "; + + if($this->parent->snapshotEnabled()){ + + $str .=" "; + + if(count($this->parent->Available_SnapsShots($dn))){ + $str .=" "; + }else{ + $str.= " "; + } } return($str); } -- 2.30.2