From da2b19212b6c8cb067be3adc6097fbced1473c77 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:57:29 +0000 Subject: [PATCH] Update StatusUpdater.class.php --- src/psm/Util/Server/Updater/StatusUpdater.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/psm/Util/Server/Updater/StatusUpdater.class.php b/src/psm/Util/Server/Updater/StatusUpdater.class.php index acd7bd9e..46c1ba89 100644 --- a/src/psm/Util/Server/Updater/StatusUpdater.class.php +++ b/src/psm/Util/Server/Updater/StatusUpdater.class.php @@ -82,7 +82,7 @@ class StatusUpdater { $this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array( 'server_id' => $server_id, ), array( - 'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'active', 'warning_threshold', 'warning_threshold_counter', 'timeout', + 'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'active', 'warning_threshold', 'warning_threshold_counter', 'timeout', 'last_online', )); if(empty($this->server)) { return false; @@ -113,6 +113,9 @@ class StatusUpdater { $save['status'] = 'on'; $save['last_online'] = date('Y-m-d H:i:s'); $save['warning_threshold_counter'] = 0; + if ($this->server['status'] == 'off') { + $save['last_offline'] = $this->server['last_online']; + } } else { // server is offline, increase the error counter $save['warning_threshold_counter'] = $this->server['warning_threshold_counter'] + 1;