From ed100cc58c323a086442b465844ecbb55cc71cc1 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 3 Aug 2010 08:37:47 +0000 Subject: [PATCH] Updated class stats git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19350 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_stats.inc | 37 ++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/gosa-core/include/class_stats.inc b/gosa-core/include/class_stats.inc index 09f9f9726..3f9a9d2c2 100644 --- a/gosa-core/include/class_stats.inc +++ b/gosa-core/include/class_stats.inc @@ -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; -- 2.30.2