From 08361e71aa0f0bf041fd0fc3ac54053809fecc47 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 2 Aug 2010 10:54:46 +0000 Subject: [PATCH] Ensure we either call the plugins constructor or manually set the initTime variable for the new statistics plugin. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19337 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_stats.inc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gosa-core/include/class_stats.inc b/gosa-core/include/class_stats.inc index e2d64986c..06cf3f85a 100644 --- a/gosa-core/include/class_stats.inc +++ b/gosa-core/include/class_stats.inc @@ -45,7 +45,8 @@ class stats DURATION REAL, AMOUNT INTEGER, MEMORY_USAGE INTEGER, - CPU_LOAD FLOAT + CPU_LOAD FLOAT, + INFO BLOB )"; $ret = sqlite_query($query, $res); } @@ -55,7 +56,7 @@ class stats - static function log($type, $plugin, $category, $action, $amount = 1, $duration = 0) + static function log($type, $plugin, $category, $action, $amount = 1, $duration = 0, $info ='') { global $config; global $clicks; @@ -67,6 +68,7 @@ class stats $uuid = $config->getGOsaUUID(); $amount = sqlite_escape_string($amount); $duration = sqlite_escape_string($duration); + $info = sqlite_escape_string($info); $clicks = sqlite_escape_string($clicks); $memory_usage = sqlite_escape_string(stats::get_memory_usage()); $cpu_load = sqlite_escape_string(stats::get_cpu_load()); @@ -81,10 +83,10 @@ class stats $TABLE_NAME = 'stats'; $query = " INSERT INTO {$TABLE_NAME} - (ACTID, TYPE, PLUGIN, CATEGORY, ACTION, UUID, MTIMESTAMP, TIMESTAMP, AMOUNT, DURATION, MEMORY_USAGE, CPU_LOAD) + (ACTID, TYPE, PLUGIN, CATEGORY, ACTION, UUID, MTIMESTAMP, TIMESTAMP, AMOUNT, DURATION, MEMORY_USAGE, CPU_LOAD, INFO) VALUES ('{$clicks}','{$type}','{$plugin}','{$category}','{$action}','{$uuid}', - '{$mtimestamp}','{$timestamp}','{$amount}','{$duration}','{$memory_usage}','{$cpu_load}')"; + '{$mtimestamp}','{$timestamp}','{$amount}','{$duration}','{$memory_usage}','{$cpu_load}','{$info}')"; sqlite_query($query, $res); } @@ -176,10 +178,10 @@ class stats echo "------ \n"; $query = " - SELECT SUM(DURATION) AS DUR, PLUGIN + SELECT SUM(DURATION) AS DUR, PLUGIN, UUID FROM {$TABLE_NAME} WHERE plugin != 'LDAP' - GROUP BY PLUGIN + GROUP BY PLUGIN, UUID ORDER BY DUR DESC LIMIT 10"; $ret = sqlite_query($query, $res); @@ -309,12 +311,12 @@ class stats echo "------ \n"; $query = " - SELECT COUNT(ACTION) as CNT, ACTION, PLUGIN + SELECT COUNT(ACTION) as CNT, ACTION, PLUGIN, UUID FROM {$TABLE_NAME} WHERE TYPE = 'plugin' AND PLUGIN != 'LDAP' AND ACTION = 'open' - GROUP BY ACTION,PLUGIN + GROUP BY ACTION,PLUGIN, UUID ORDER BY CNT DESC LIMIT 5"; $ret = sqlite_query($query, $res); -- 2.30.2