Update StatusUpdater.class.php
parent
aedc6318c9
commit
da2b19212b
|
@ -82,7 +82,7 @@ class StatusUpdater {
|
||||||
$this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array(
|
$this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array(
|
||||||
'server_id' => $server_id,
|
'server_id' => $server_id,
|
||||||
), array(
|
), 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)) {
|
if(empty($this->server)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -113,6 +113,9 @@ class StatusUpdater {
|
||||||
$save['status'] = 'on';
|
$save['status'] = 'on';
|
||||||
$save['last_online'] = date('Y-m-d H:i:s');
|
$save['last_online'] = date('Y-m-d H:i:s');
|
||||||
$save['warning_threshold_counter'] = 0;
|
$save['warning_threshold_counter'] = 0;
|
||||||
|
if ($this->server['status'] == 'off') {
|
||||||
|
$save['last_offline'] = $this->server['last_online'];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// server is offline, increase the error counter
|
// server is offline, increase the error counter
|
||||||
$save['warning_threshold_counter'] = $this->server['warning_threshold_counter'] + 1;
|
$save['warning_threshold_counter'] = $this->server['warning_threshold_counter'] + 1;
|
||||||
|
|
Loading…
Reference in New Issue