From 3be7ea4f474223b2b1ba08ab06dc0fe2d06451f0 Mon Sep 17 00:00:00 2001 From: SJ Date: Wed, 6 May 2015 12:21:41 +0200 Subject: [PATCH] performance improvement for the health page --- webui/model/health/health.php | 12 ++++-------- webui/view/theme/default/templates/health/worker.tpl | 8 ++++---- webui/view/theme/mobile/templates/health/worker.tpl | 8 ++++---- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/webui/model/health/health.php b/webui/model/health/health.php index 9f7c1fd6..620c0c0e 100644 --- a/webui/model/health/health.php +++ b/webui/model/health/health.php @@ -40,31 +40,27 @@ class ModelHealthHealth extends Model { $now = time(); $ts = $now - 3600; - $query = $this->db->query("select count(*) as count, sum(size) as size from " . TABLE_META . " where arrived > $ts"); + $query = $this->db->query("select count(*) as count 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, sum(size) as size from " . TABLE_META . " where arrived > $ts"); + $query = $this->db->query("select count(*) as count 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, sum(size) as size from " . TABLE_META . " where arrived > $ts"); + $query = $this->db->query("select count(*) as count 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, sum(size) as size from " . TABLE_META . " where arrived > $ts"); + $query = $this->db->query("select count(*) as count 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 $a; diff --git a/webui/view/theme/default/templates/health/worker.tpl b/webui/view/theme/default/templates/health/worker.tpl index 4ee0f848..7ce8db0c 100644 --- a/webui/view/theme/default/templates/health/worker.tpl +++ b/webui/view/theme/default/templates/health/worker.tpl @@ -113,10 +113,10 @@ - / ()
- / ()
- / ()
- / () + ()
+ ()
+ ()
+ () diff --git a/webui/view/theme/mobile/templates/health/worker.tpl b/webui/view/theme/mobile/templates/health/worker.tpl index 3f4ba0cd..cb12e406 100644 --- a/webui/view/theme/mobile/templates/health/worker.tpl +++ b/webui/view/theme/mobile/templates/health/worker.tpl @@ -58,10 +58,10 @@
- / ()
- / ()
- / ()
- / () + ()
+ ()
+ ()
+ ()