From 39a2564c945f728ac665381ef0447144e24b5d0e Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:46:49 +0000 Subject: [PATCH 01/19] Update functions.inc.php --- src/includes/functions.inc.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index 9d267637..b810dd9e 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -236,6 +236,25 @@ function psm_log_uptime($server_id, $status, $latency) { ); } +/** + * Converts an interval into a string + * + * @param DateInterval $interval + * @return string + */ + function psm_format_interval(DateInterval $interval) { + $result = ""; + + if ($interval->y) { $result .= $interval->format("%y ") . ( ($interval->y == 1) ? psm_get_lang('system', 'year') : psm_get_lang('system', 'years') ) . " "; } + if ($interval->m) { $result .= $interval->format("%m ") . ( ($interval->m == 1) ? psm_get_lang('system', 'month') : psm_get_lang('system', 'months') ) . " "; } + if ($interval->d) { $result .= $interval->format("%d ") . ( ($interval->d == 1) ? psm_get_lang('system', 'day') : psm_get_lang('system', 'days') ) . " "; } + if ($interval->h) { $result .= $interval->format("%h ") . ( ($interval->h == 1) ? psm_get_lang('system', 'hour') : psm_get_lang('system', 'hours') ) . " "; } + if ($interval->i) { $result .= $interval->format("%i ") . ( ($interval->i == 1) ? psm_get_lang('system', 'minute') : psm_get_lang('system', 'minutes') ) . " "; } + if ($interval->s) { $result .= $interval->format("%s ") . ( ($interval->s == 1) ? psm_get_lang('system', 'second') : psm_get_lang('system', 'seconds') ) . " "; } + + return $result; +} + /** * Parses a string from the language file with the correct variables replaced in the message * @@ -254,6 +273,11 @@ function psm_parse_msg($status, $type, $vars) { } $vars['date'] = date('Y-m-d H:i:s'); + $online_date = new DateTime($vars['last_online']); + $offline_date = new DateTime($vars['last_offline']); + $difference = $online_date->diff($offline_date); + $vars['downtime'] = psm_format_interval($difference); + foreach($vars as $k => $v) { $message = str_replace('%' . strtoupper($k) . '%', $v, $message); } From fc90dd7fc7887dda21b737ac575f75176731ca7d Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:49:32 +0000 Subject: [PATCH 02/19] Update en_US.lang.php --- src/lang/en_US.lang.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index 9c47eca6..ee9b2eb5 100644 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'about a minute ago', 'seconds_ago' => '%d seconds ago', 'a_second_ago' => 'a second ago', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Config', @@ -263,9 +275,9 @@ $sm_lang = array( 'off_pushover_message' => "Failed to connect to the following server:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%", 'on_sms' => 'Server \'%LABEL%\' is RUNNING: ip=%IP%, port=%PORT%', 'on_email_subject' => 'IMPORTANT: Server \'%LABEL%\' is RUNNING', - 'on_email_body' => "Server '%LABEL%' is running again:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%", + 'on_email_body' => "Server '%LABEL%' is running again, it was down for %DOWNTIME%:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%", 'on_pushover_title' => 'Server \'%LABEL%\' is RUNNING', - 'on_pushover_message' => 'Server \'%LABEL%\' is running again:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%', + 'on_pushover_message' => 'Server \'%LABEL%\' is running again, it was down for %DOWNTIME%:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%', ), 'login' => array( 'welcome_usermenu' => 'Welcome, %user_name%', From 29a0bb7f7a59b25bfb38240fe03a3a2db999698a Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:50:00 +0000 Subject: [PATCH 03/19] Update bg_BG.lang.php --- src/lang/bg_BG.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/bg_BG.lang.php b/src/lang/bg_BG.lang.php index e9a2469f..27477d2b 100644 --- a/src/lang/bg_BG.lang.php +++ b/src/lang/bg_BG.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'преди минута', 'seconds_ago' => 'преди %d секунди', 'a_second_ago' => 'преди секунда', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Настройки', From 3d9b3484d3c059adbab6dc04ae98d09bf2663778 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:50:16 +0000 Subject: [PATCH 04/19] Update cs_CZ.lang.php --- src/lang/cs_CZ.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/cs_CZ.lang.php b/src/lang/cs_CZ.lang.php index 8222f150..6d3cae5c 100644 --- a/src/lang/cs_CZ.lang.php +++ b/src/lang/cs_CZ.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'cca před minutou', 'seconds_ago' => 'před %d vteřinami', 'a_second_ago' => 'před chvílí', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Konfigurace', From 1bfb7aaceaab460d66ada7926f5edaa2cc19ea66 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:50:34 +0000 Subject: [PATCH 05/19] Update da_DK.lang.php --- src/lang/da_DK.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/da_DK.lang.php b/src/lang/da_DK.lang.php index 5dd633b7..084cc573 100644 --- a/src/lang/da_DK.lang.php +++ b/src/lang/da_DK.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'omkring et minut siden', 'seconds_ago' => '%d sekunder siden', 'a_second_ago' => 'et sekund siden', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Indstillinger', From b33eb5423d5b0667114ca11c500306231bf2e0cf Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:50:51 +0000 Subject: [PATCH 06/19] Update de_DE.lang.php --- src/lang/de_DE.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/de_DE.lang.php b/src/lang/de_DE.lang.php index 0d5ba6b3..09c698d9 100644 --- a/src/lang/de_DE.lang.php +++ b/src/lang/de_DE.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'vor über einer Minute', 'seconds_ago' => 'vor %d Sekunden', 'a_second_ago' => 'vor über einer Sekunde', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Einstellungen', From d86f880cf0b5a10acc090c73882c3552c7408d0f Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:51:25 +0000 Subject: [PATCH 07/19] Update es_ES.lang.php --- src/lang/es_ES.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/es_ES.lang.php b/src/lang/es_ES.lang.php index a2691d0b..f215f808 100644 --- a/src/lang/es_ES.lang.php +++ b/src/lang/es_ES.lang.php @@ -59,6 +59,18 @@ $sm_lang = array( 'a_minute_ago' => 'Hace aproximadamente un minuto', 'seconds_ago' => 'Hace %d segundos', 'a_second_ago' => 'Hace aproximadamente un segundo', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Configurar', From 3a80895d41c9f9e9ad84a4310558fde47551a109 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:51:43 +0000 Subject: [PATCH 08/19] Update fr_FR.lang.php --- src/lang/fr_FR.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/fr_FR.lang.php b/src/lang/fr_FR.lang.php index dbe24135..5aa0d917 100644 --- a/src/lang/fr_FR.lang.php +++ b/src/lang/fr_FR.lang.php @@ -59,6 +59,18 @@ $sm_lang = array( 'a_minute_ago' => 'Il y a une minute', 'seconds_ago' => 'Il y a %d secondes', 'a_second_ago' => 'Il y a une seconde', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Configuration', From 5e46abc53555de304712b6219267f8d28459b2d0 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:52:09 +0000 Subject: [PATCH 09/19] Update it_IT.lang.php --- src/lang/it_IT.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/it_IT.lang.php b/src/lang/it_IT.lang.php index 86da1063..8da1717d 100644 --- a/src/lang/it_IT.lang.php +++ b/src/lang/it_IT.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'about a minute ago', 'seconds_ago' => '%d seconds ago', 'a_second_ago' => 'a second ago', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Configurazione', From efccc7a0c29c314b1ed4189585c65b73f32df39e Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:52:29 +0000 Subject: [PATCH 10/19] Update ko_KR.lang.php --- src/lang/ko_KR.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/ko_KR.lang.php b/src/lang/ko_KR.lang.php index cda96b74..bce462e1 100644 --- a/src/lang/ko_KR.lang.php +++ b/src/lang/ko_KR.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'about a minute ago', 'seconds_ago' => '%d seconds ago', 'a_second_ago' => 'a second ago', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => '설정', From 411fb43100955c794771718392aec914c70df2e2 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:52:47 +0000 Subject: [PATCH 11/19] Update nl_NL.lang.php --- src/lang/nl_NL.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/nl_NL.lang.php b/src/lang/nl_NL.lang.php index 8a273710..eb60b708 100644 --- a/src/lang/nl_NL.lang.php +++ b/src/lang/nl_NL.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'een minuut geleden', 'seconds_ago' => '%d seconden geleden', 'a_second_ago' => 'een seconde geleden', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Configuratie', From a7a08ab63f3a91568c5a601af24e5eafdbb26f1a Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:53:06 +0000 Subject: [PATCH 12/19] Update pl_PL.lang.php --- src/lang/pl_PL.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/pl_PL.lang.php b/src/lang/pl_PL.lang.php index 0e2cf5f1..d0e047b6 100644 --- a/src/lang/pl_PL.lang.php +++ b/src/lang/pl_PL.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'minutę temu', 'seconds_ago' => '%d sekund temu', 'a_second_ago' => 'sekundę temu', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Konfiguracja', From 00745795b47f543a48959e2685fd22480984907c Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:53:22 +0000 Subject: [PATCH 13/19] Update pt_BR.lang.php --- src/lang/pt_BR.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/pt_BR.lang.php b/src/lang/pt_BR.lang.php index bc80a053..cf0fae6e 100644 --- a/src/lang/pt_BR.lang.php +++ b/src/lang/pt_BR.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'cerca de um minuto atrás', 'seconds_ago' => '%d segundos atrás', 'a_second_ago' => 'um segundo atrás', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Configuração', From 8f8de9ba309ab5e97db6cb8c9fe67117a8ea5737 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:53:37 +0000 Subject: [PATCH 14/19] Update ru_RU.lang.php --- src/lang/ru_RU.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/ru_RU.lang.php b/src/lang/ru_RU.lang.php index d9d1603f..dc5aa7d1 100644 --- a/src/lang/ru_RU.lang.php +++ b/src/lang/ru_RU.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'минуту назад', 'seconds_ago' => '%d секунд назад', 'a_second_ago' => 'секунду назад', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Параметры', From c0f934096586b9925fedfafbd63a7a75d0e41b97 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:53:55 +0000 Subject: [PATCH 15/19] Update tr_TR.lang.php --- src/lang/tr_TR.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/tr_TR.lang.php b/src/lang/tr_TR.lang.php index c16a78e7..75ed4a70 100644 --- a/src/lang/tr_TR.lang.php +++ b/src/lang/tr_TR.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => 'yaklaşık bir dakika önce', 'seconds_ago' => '%d saniye önce', 'a_second_ago' => 'bir saniye önce', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => 'Ayarlar', From 67dc5ae19f2b1472dba010f9996eb665075ebc81 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:54:12 +0000 Subject: [PATCH 16/19] Update zh_CN.lang.php --- src/lang/zh_CN.lang.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lang/zh_CN.lang.php b/src/lang/zh_CN.lang.php index 81703b3a..ad85261d 100644 --- a/src/lang/zh_CN.lang.php +++ b/src/lang/zh_CN.lang.php @@ -58,6 +58,18 @@ $sm_lang = array( 'a_minute_ago' => '1分钟前', 'seconds_ago' => '%d 秒前', 'a_second_ago' => '刚刚', + 'year' => 'year', + 'years' => 'years', + 'month' => 'month', + 'months' => 'months', + 'day' => 'day', + 'days' => 'days', + 'hour' => 'hour', + 'hours' => 'hours', + 'minute' => 'minute', + 'minutes' => 'minutes', + 'second' => 'second', + 'seconds' => 'seconds', ), 'menu' => array( 'config' => '设置', From aedc6318c987dd8a3d7cd1cec6f2029af5809ea5 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:56:03 +0000 Subject: [PATCH 17/19] Update StatusNotifier.class.php --- src/psm/Util/Server/Updater/StatusNotifier.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/psm/Util/Server/Updater/StatusNotifier.class.php b/src/psm/Util/Server/Updater/StatusNotifier.class.php index 154b4c3e..5b699e42 100644 --- a/src/psm/Util/Server/Updater/StatusNotifier.class.php +++ b/src/psm/Util/Server/Updater/StatusNotifier.class.php @@ -121,7 +121,7 @@ class StatusNotifier { $this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array( 'server_id' => $server_id, ), array( - 'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'error', 'active', 'email', 'sms', 'pushover', + 'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'error', 'active', 'email', 'sms', 'pushover', 'last_online', 'last_offline', )); if(empty($this->server)) { return false; @@ -315,4 +315,4 @@ class StatusNotifier { "); return $users; } -} \ No newline at end of file +} From da2b19212b6c8cb067be3adc6097fbced1473c77 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 12:57:29 +0000 Subject: [PATCH 18/19] 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; From 6b550ed9191094c47f72e8c19e67a9f837313a07 Mon Sep 17 00:00:00 2001 From: mpattman Date: Thu, 6 Nov 2014 13:02:39 +0000 Subject: [PATCH 19/19] Update Installer.class.php --- src/psm/Util/Install/Installer.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/psm/Util/Install/Installer.class.php b/src/psm/Util/Install/Installer.class.php index 30e3ad25..8760a819 100644 --- a/src/psm/Util/Install/Installer.class.php +++ b/src/psm/Util/Install/Installer.class.php @@ -126,7 +126,7 @@ class Installer { $this->log('Populating database...'); $queries = array(); - $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "servers` (`ip`, `port`, `label`, `type`, `pattern`, `status`, `error`, `rtime`, `last_online`, `last_check`, `active`, `email`, `sms`, `pushover`) VALUES ('http://sourceforge.net/index.php', 80, 'SourceForge', 'website', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes'), ('smtp.gmail.com', 465, 'Gmail SMTP', 'service', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes')"; + $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "servers` (`ip`, `port`, `label`, `type`, `pattern`, `status`, `error`, `rtime`, `last_online`, `last_check`, `active`, `email`, `sms`, `pushover`, `last_offline`) VALUES ('http://sourceforge.net/index.php', 80, 'SourceForge', 'website', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes', '0000-00-00 00:00:00'), ('smtp.gmail.com', 465, 'Gmail SMTP', 'service', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes', '0000-00-00 00:00:00')"; $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "users_servers` (`user_id`,`server_id`) VALUES (1, 1), (1, 2);"; $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUE ('language', 'en_US'), @@ -226,6 +226,7 @@ class Installer { `warning_threshold` mediumint(1) unsigned NOT NULL DEFAULT '1', `warning_threshold_counter` mediumint(1) unsigned NOT NULL DEFAULT '0', `timeout` smallint(1) unsigned NULL DEFAULT NULL, + `last_offline` datetime NULL, PRIMARY KEY (`server_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;", PSM_DB_PREFIX . 'servers_uptime' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "servers_uptime` ( @@ -301,6 +302,7 @@ class Installer { $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `last_online` `last_online` DATETIME NULL;"; $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `last_check` `last_check` DATETIME NULL;"; $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `pattern` VARCHAR( 255 ) NOT NULL AFTER `type`;"; + $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL AFTER `timeout`;"; $this->execSQL($queries); } @@ -332,6 +334,7 @@ class Installer { $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `server_id` `server_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;"; $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `warning_threshold` MEDIUMINT( 1 ) UNSIGNED NOT NULL DEFAULT '1';"; $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `warning_threshold_counter` MEDIUMINT( 1 ) UNSIGNED NOT NULL DEFAULT '0';"; + $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL AFTER `timeout`;"; $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` CHANGE `user_id` `user_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;"; $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` @@ -411,6 +414,7 @@ class Installer { $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "log` CHANGE `type` `type` ENUM( 'status', 'email', 'sms', 'pushover' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;"; $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `timeout` smallint(1) unsigned NULL DEFAULT NULL;"; + $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL AFTER `timeout`;"; $queries[] = "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users_preferences` ( `user_id` int(11) unsigned NOT NULL,