Code

Added snapshot check.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Feb 2009 13:46:52 +0000 (13:46 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Feb 2009 13:46:52 +0000 (13:46 +0000)
-Check for missing compression extension

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13452 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_plugin.inc

index 1c57be2cc96bd77e92e8edd950d568e6db171e58..805190ea799994f253385ebaf7bb7951fdba2e1b 100644 (file)
@@ -1320,23 +1320,50 @@ class plugin
   {
     $config = $this->config;
     if($config->get_cfg_value("enableSnapshots") == "true"){
+
            /* Check if the snapshot_base is defined */
            if ($config->get_cfg_value("snapshotBase") == ""){
-                   msg_dialog::display(_("Configuration error"), sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not set."),"snapshotBase"), ERROR_DIALOG);
+
+        /* Send message if not done already */
+        if(!session::is_set("snapshotFailMessageSend")){
+          session::set("snapshotFailMessageSend",TRUE);
+          msg_dialog::display(_("Configuration error"), 
+              sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not set."),
+                "snapshotBase"), ERROR_DIALOG);
+        }
                    return(FALSE);
            }
 
+      /* Check if the snapshot_base is defined */
+      if (!is_callable("gzcompress")){
+
+        /* Send message if not done already */
+        if(!session::is_set("snapshotFailMessageSend")){
+          session::set("snapshotFailMessageSend",TRUE);
+          msg_dialog::display(_("Configuration error"), 
+              sprintf(_("The snapshot functionality is enabled, but the required compression package is missing, try to install '%s'."),"php5-zip / php5-gzip"), ERROR_DIALOG);
+        }
+        return(FALSE);
+      }
+
            /* check if there are special server configurations for snapshots */
            if ($config->get_cfg_value("snapshotURI") != ""){
 
                    /* check if all required vars are available to create a new ldap connection */
                    $missing = "";
                    foreach(array("snapshotURI","snapshotAdminDn","snapshotAdminPassword","snapshotBase") as $var){
-                           if($config->get_cfg_value($var) == ""){
-                                   $missing .= $var." ";
-                                   msg_dialog::display(_("Configuration error"), sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not set."), $missing), ERROR_DIALOG);
-                                   return(FALSE);
-                           }
+          if($config->get_cfg_value($var) == ""){
+            $missing .= $var." ";
+
+            /* Send message if not done already */
+            if(!session::is_set("snapshotFailMessageSend")){
+              ession::set("snapshotFailMessageSend",TRUE);
+              msg_dialog::display(_("Configuration error"), 
+                  sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not set."), 
+                    $missing), ERROR_DIALOG);
+            }
+            return(FALSE);
+          }
                    }
            }
            return(TRUE);