From fb52d3ed534be087b95640b3f86257fa815f3bd7 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sat, 20 Jun 2026 11:54:24 -0500 Subject: [PATCH] fix(heartbeat): add diagnostic logging to all bail-out points Log reason when sendHeartbeat() exits early: missing params, empty health token, or unconfigured base URL. Helps diagnose why heartbeat doesn't reach MokoSuiteClientHQ after install/update. --- source/script.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/source/script.php b/source/script.php index 3d10bdf7..6d528c74 100644 --- a/source/script.php +++ b/source/script.php @@ -836,11 +836,22 @@ class Pkg_MokosuiteclientInstallerScript ->where($db->quoteName('element') . ' = ' . $db->quote('mokosuiteclient')) ->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) ->where($db->quoteName('folder') . ' = ' . $db->quote('system')); - $coreParams = json_decode((string) $db->setQuery($query)->loadResult()); + $rawParams = (string) $db->setQuery($query)->loadResult(); + $coreParams = json_decode($rawParams); + + if (!$coreParams) + { + Log::add('Heartbeat skipped: core plugin params empty or not found', Log::WARNING, 'mokosuiteclient'); + + return; + } + $healthToken = $coreParams->health_api_token ?? ''; if (empty($healthToken)) { + Log::add('Heartbeat skipped: health_api_token not configured', Log::INFO, 'mokosuiteclient'); + return; } @@ -873,9 +884,13 @@ class Pkg_MokosuiteclientInstallerScript if (empty($baseUrl)) { + Log::add('Heartbeat skipped: monitor_base_url not configured and manifest fallback failed', Log::WARNING, 'mokosuiteclient'); + return; } + Log::add('Heartbeat sending to: ' . $baseUrl, Log::INFO, 'mokosuiteclient'); + $siteUrl = rtrim(\Joomla\CMS\Uri\Uri::root(), '/'); $domain = parse_url($siteUrl, PHP_URL_HOST) ?: ''; $timestamp = time();