From 02bbe16a20dbaf2fdf985017b4d8e1cf7fb95872 Mon Sep 17 00:00:00 2001 From: SJ Date: Thu, 23 Oct 2014 09:31:40 +0200 Subject: [PATCH] improved health page --- webui/model/health/health.php | 31 +++++++++++++------ .../theme/default/templates/health/worker.tpl | 7 ++++- .../theme/mobile/templates/health/worker.tpl | 7 ++++- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/webui/model/health/health.php b/webui/model/health/health.php index 5ee5f12d..68edc854 100644 --- a/webui/model/health/health.php +++ b/webui/model/health/health.php @@ -36,25 +36,38 @@ class ModelHealthHealth extends Model { public function count_processed_emails() { $today = $last_7_days = $last_30_days = 0; + $a = array(); $now = time(); $ts = $now - 3600; - $query = $this->db->query("select count(*) as count from " . TABLE_META . " where arrived > $ts"); - if(isset($query->row['count'])) { $last_60_mins = $query->row['count']; } + $query = $this->db->query("select count(*) as count, sum(size) as size from " . TABLE_META . " where arrived > $ts"); + if(isset($query->row['count'])) { + $a['last_60_mins_count'] = $query->row['count']; + $a['last_60_mins_size'] = $query->row['size']; + } $ts = $now - 86400; - $query = $this->db->query("select count(*) as count from " . TABLE_META . " where arrived > $ts"); - if(isset($query->row['count'])) { $today = $query->row['count']; } + $query = $this->db->query("select count(*) as count, sum(size) as size from " . TABLE_META . " where arrived > $ts"); + if(isset($query->row['count'])) { + $a['today_count'] = $query->row['count']; + $a['today_size'] = $query->row['size']; + } $ts = $now - 604800; - $query = $this->db->query("select count(*) as count from " . TABLE_META . " where arrived > $ts"); - if(isset($query->row['count'])) { $last_7_days = $query->row['count']; } + $query = $this->db->query("select count(*) as count, sum(size) as size from " . TABLE_META . " where arrived > $ts"); + if(isset($query->row['count'])) { + $a['last_7_days_count'] = $query->row['count']; + $a['last_7_days_size'] = $query->row['size']; + } $ts = $now - 2592000; - $query = $this->db->query("select count(*) as count from " . TABLE_META . " where arrived > $ts"); - if(isset($query->row['count'])) { $last_30_days = $query->row['count']; } + $query = $this->db->query("select count(*) as count, sum(size) as size from " . TABLE_META . " where arrived > $ts"); + if(isset($query->row['count'])) { + $a['last_30_days_count'] = $query->row['count']; + $a['last_30_days_size'] = $query->row['size']; + } - return array($last_60_mins, $today, $last_7_days, $last_30_days); + return $a; } diff --git a/webui/view/theme/default/templates/health/worker.tpl b/webui/view/theme/default/templates/health/worker.tpl index 9f28f451..a3b16d55 100644 --- a/webui/view/theme/default/templates/health/worker.tpl +++ b/webui/view/theme/default/templates/health/worker.tpl @@ -107,7 +107,12 @@ - ()
()
()
() + + / ()
+ / ()
+ / ()
+ / () + diff --git a/webui/view/theme/mobile/templates/health/worker.tpl b/webui/view/theme/mobile/templates/health/worker.tpl index 34a6bf7f..6a9a0b5a 100644 --- a/webui/view/theme/mobile/templates/health/worker.tpl +++ b/webui/view/theme/mobile/templates/health/worker.tpl @@ -52,7 +52,12 @@
-
()
()
()
()
+
+ / ()
+ / ()
+ / ()
+ / () +