X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_stats.inc;h=c9b7dd80f08fa379c1cbe4ec947a1665e7d65d6e;hb=493d1dc4fdec711a57d1ffffa954c649fd17beef;hp=2ae68eaf85fe6173773247dcb06e556555a1bdaf;hpb=fc06063e2b4d0739ec8b808bd9b6fa325074b7f7;p=gosa.git diff --git a/gosa-core/include/class_stats.inc b/gosa-core/include/class_stats.inc index 2ae68eaf8..c9b7dd80f 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}"; + $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; @@ -568,6 +603,8 @@ class stats SELECT PLUGIN, RENDER_TIME AS RM FROM {$TABLE_NAME} GROUP BY PLUGIN + ORDER BY RM DESC + LIMIT 10 "; $ret = sqlite_query($query, $res);