From dd3bc350095ad9476b83d327a853da44bcf87f8d Mon Sep 17 00:00:00 2001 From: Arkhee Date: Tue, 17 Sep 2019 14:53:56 +0200 Subject: [PATCH] "Last online" stuck on "never" when checking some websites (#770) Fixes #765 * // PATCH Arkhee : fix/last-online-stuck-on-never-if-webpage-too-large // The update un "servers" table does not work // Symptom : "Last online" stays stuck on "never" // Reason: last_output contains the full webpage, too long for the query // _This may depend on mysql configuration on the server_, explaining why some have the problem or not // Field is 255 Chars, and request does not work anyway is loaded web page is too large in last_output // So force truncate to 250 or less before query * Spelling * Update varchar to text * Update tot 3.4.1 * Update tot 3.4.1 * Update README.rst * Updated to 5000 characters --- README.rst | 2 +- docs/conf.py | 2 +- src/includes/psmconfig.inc.php | 2 +- src/psm/Util/Install/Installer.php | 13 +++++++++++++ src/psm/Util/Server/Updater/StatusUpdater.php | 10 +++++++++- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 40d2f2ca..0cdc7729 100755 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ PHP Server Monitor :alt: Join the chat at https://gitter.im/erickrf/nlpnet :target: https://gitter.im/phpservermon/phpservermon -Version 3.4.0 (Updated design!) +Version 3.4.1 (Updated design!) PHP Server Monitor is a script that checks whether your websites and servers are up and running. diff --git a/docs/conf.py b/docs/conf.py index 4383a4d2..0a95ccd2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -51,7 +51,7 @@ copyright = u'2008-2017, Pepijn Over' # built documents. # # The short X.Y version. -version = '3.4.0' +version = '3.4.1' # The full version, including alpha/beta/rc tags. release = version diff --git a/src/includes/psmconfig.inc.php b/src/includes/psmconfig.inc.php index f4435097..a5644657 100644 --- a/src/includes/psmconfig.inc.php +++ b/src/includes/psmconfig.inc.php @@ -29,7 +29,7 @@ /** * Current PSM version */ -define('PSM_VERSION', '3.4.0'); +define('PSM_VERSION', '3.4.1'); /** * URL to check for updates. Will not be checked if turned off on config page. diff --git a/src/psm/Util/Install/Installer.php b/src/psm/Util/Install/Installer.php index 6cda0b38..002a004f 100644 --- a/src/psm/Util/Install/Installer.php +++ b/src/psm/Util/Install/Installer.php @@ -573,4 +573,17 @@ class Installer { $this->execSQL($queries); $this->log('Combined notifications enabled. Check out the config page for more info.'); } + /** + * Patch for v3.4.1 release + */ + protected function upgrade341() { + $queries = array(); + /** + * Redirect_check is first set to default ok. + * If you have a lot of server that are redirecting, + * this will make sure you're servers stay online. + */ + $queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ALTER COLUMN `last_output` text;"; + $this->execSQL($queries); + } } diff --git a/src/psm/Util/Server/Updater/StatusUpdater.php b/src/psm/Util/Server/Updater/StatusUpdater.php index 85b89bcd..2e615576 100644 --- a/src/psm/Util/Server/Updater/StatusUpdater.php +++ b/src/psm/Util/Server/Updater/StatusUpdater.php @@ -152,7 +152,15 @@ class StatusUpdater { } } } - + // PATCH Arkhee: fix/last-online-stuck-on-never-if-webpage-too-large + // Updating table "servers" does not work + // Symptom: "Last online" stays stuck on "never" + // Reason: last_output contains the full webpage, too long for the query + // This may depend on mysql configuration on the server_, explaining why some have the problem or not + // Field is 255 Chars, and request does not work anyway is loaded web page is too large in last_output + // Solution: updated column to text and truncate to 5000 characters or less before the query + $save["last_output"] = substr($save["last_output"],0,5000); + // End PATCH $this->db->save(PSM_DB_PREFIX.'servers', $save, array('server_id' => $this->server_id)); return $this->status_new;