Code

Udpated loggign
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 May 2007 12:26:02 +0000 (12:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 May 2007 12:26:02 +0000 (12:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6456 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_log.inc
plugins/addons/logview/class_logview.inc

index e10b25ad468965d348e9cdf4904a87bbf4d68f63..c2f05639157eacd1ee871a10ea50c1984da2c364 100644 (file)
@@ -102,7 +102,7 @@ class log {
   #    $msgs[] = "Currently active user is empty.";
   #  }
 
-    if(!isset($entry['action']) || !in_array($entry['action'],array("modify","create","remove","copy","snapshot","view","security"))){
+    if(!isset($entry['action']) || !in_array($entry['action'],array("modify","create","remove","copy","snapshot","view","security","debug"))){
       $msgs[] = "Invalid option specified '".$entry['action']."'";
     }
 
index 1a00f4d1eed2a91daac51ef4b7b14e6b658f0681..abf4af9f9c98c3efa87bd10a08798d0d07e3d20b 100644 (file)
@@ -91,12 +91,14 @@ class logview extends plugin
       $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
       if ($link === FALSE){
         print_red(_("Can't connect to log database, no logs can be shown!"));
+        new log("debug","logview","",array(),@mysql_error());
         return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
       }
 
       /* check of log database is available */
       if (! @mysql_select_db("gomon")){
         print_red(_("Can't select log database for log generation!"));
+        new log("debug","logview","",array(),@mysql_error());
         return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
       }
 
@@ -109,6 +111,7 @@ class logview extends plugin
         $result = @mysql_query($query);
         if ($result === false){
           print_red(_("Query for log database failed!. Requesting host names failed."));
+          new log("debug","logview","",array(),@mysql_error());
           return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
         }
 
@@ -129,6 +132,7 @@ class logview extends plugin
         @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query");
         $result = @mysql_query($query);
         if ($result === false){
+          new log("debug","logview","",array(),@mysql_error());
           print_red(_("Query for log database failed!"));
           return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
         }
@@ -187,9 +191,11 @@ class logview extends plugin
     /* Test connection object && create up query string */
     if ($link === FALSE){
       print_red(_("Can't connect to log database, no logs can be shown!"));
+      new log("debug","logview","",array(),@mysql_error());
     } else {
       if (! @mysql_select_db("gomon")){
         print_red(_("Can't select log database for log generation!"));
+        new log("debug","logview","",array(),@mysql_error());
       } else {
 
         /* Assemble time query */
@@ -261,6 +267,9 @@ class logview extends plugin
         /* Get number of entries */
         $query= "SELECT COUNT(*)".$query_base.";";
         $result = @mysql_query($query);
+        if(!$result){
+          new log("debug","logview","",array(),@mysql_error());
+        }
         $line= mysql_fetch_array($result, MYSQL_ASSOC);
         $count= $line['COUNT(*)'];
         if ($count > 25){
@@ -273,7 +282,9 @@ class logview extends plugin
         $query= "SELECT *".$query_base." ORDER BY ".$this->fields[$this->sort]." $desc LIMIT ".$this->start.",".$this->range.";";
         @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query");
         $result = @mysql_query($query);
-
+        if(!$result){
+          new log("debug","logview","",array(),@mysql_error());
+        }
         /* Display results */
         $mod= 0;