Code

Updated class stats
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 3 Aug 2010 08:37:47 +0000 (08:37 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 3 Aug 2010 08:37:47 +0000 (08:37 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19350 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_stats.inc

index 09f9f9726330a35264fe659d50d90a632ea4a3bc..3f9a9d2c28554d54be3152c824928001125bfe0f 100644 (file)
@@ -214,7 +214,37 @@ class stats
                     '{$memory_usage}','{$cpu_load}','{$info}')";
         sqlite_query($query, $res);
     }
-   
+  
+    /*! \brief      |
+     *  @param      |
+     *  @return     |
+     */  
+    static function dumpTables($from = NULL, $to = NULL)
+    {
+        // Get database connection
+        $TABLE_NAME = stats::$tableName;
+        $handle = stats::getDatabaseHandle();
+        if(!$handle) return;        
+
+        // Build up filter to limit dumped entries to the given range.
+        $tim = "";
+        if($from != NULL){
+            $from = sqlite_escape_string($from);
+            $tim.= "AND TIMESTAMP >= '{$from}' ";
+        }
+        if($to != NULL){
+            $to = sqlite_escape_string($to);
+            $tim.= "AND TIMESTAMP <= '{$to}' ";
+        }
+        $tim = preg_replace("/^AND /"," WHERE ",$tim);
+
+        // Create Filter and start query
+        $filter = "SELECT * FROM {$TABLE_NAME}{$tim} LIMIT 10";
+        $ret = sqlite_array_query($filter, $handle, SQLITE_ASSOC);
+        return($ret);
+    }
+
  
     /*! \brief      |
      *  @param      |
@@ -222,6 +252,11 @@ class stats
      */  
     static function show()
     {
+
+        stats::dumpTables();
+
+        return;
+
         $res = stats::getDatabaseHandle();
 #       stats::dropTable($res);
         if(!$res) return;