MokoSuiteClient 02.35.00 — Rename, ticketing overhaul, security fixes #207

Open
jmiller wants to merge 135 commits from dev into main
67 changed files with 1075 additions and 593 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
# FILE INFORMATION
# DEFGROUP: Gitea.Workflow
# INGROUP: moko-platform.Automation
# VERSION: 01.00.00
# VERSION: 02.46.80
# BRIEF: Auto-create feature branch when an issue is opened
name: "Universal: Issue Branch"
+1 -1
View File
@@ -14,7 +14,7 @@
INGROUP: MokoSuiteClient.Documentation
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
PATH: ./CHANGELOG.md
VERSION: 02.44.00
VERSION: 02.46.80
BRIEF: Version history using `Keep a Changelog`
-->
+1 -1
View File
@@ -14,7 +14,7 @@
DEFGROUP: Joomla.Plugin
INGROUP: MokoSuiteClient.Documentation
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
VERSION: 02.44.00
VERSION: 02.46.80
PATH: ./CODE_OF_CONDUCT.md
BRIEF: Reference + packaging repo for Moko Consulting Developer GPT Other Default
-->
+1 -1
View File
@@ -19,7 +19,7 @@
DEFGROUP: mokoconsulting-tech.MokoSuiteClientBrand
INGROUP: MokoStandards.Governance
REPO: https://github.com/mokoconsulting-tech/MokoSuiteClientBrand
VERSION: 02.44.00
VERSION: 02.46.80
PATH: /GOVERNANCE.md
BRIEF: Project governance rules, roles, and decision process for MokoSuiteClientBrand
-->
+1 -1
View File
@@ -15,7 +15,7 @@
INGROUP: MokoSuiteClient.Documentation
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
PATH: ./LICENSE.md
VERSION: 02.44.00
VERSION: 02.46.80
BRIEF: Project license (GPL-3.0-or-later)
-->
GNU GENERAL PUBLIC LICENSE
+1 -1
View File
@@ -9,7 +9,7 @@
DEFGROUP: Joomla.Plugin
INGROUP: MokoSuiteClient
REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoSuiteClient
VERSION: 02.44.00
VERSION: 02.46.80
PATH: /README.md
BRIEF: MokoSuiteClient platform plugin for Joomla
-->
+1 -1
View File
@@ -23,7 +23,7 @@ DEFGROUP: [PROJECT_NAME]
INGROUP: [PROJECT_NAME].Documentation
REPO: [REPOSITORY_URL]
PATH: /SECURITY.md
VERSION: 02.44.00
VERSION: 02.46.80
BRIEF: Security vulnerability reporting and handling policy
-->
+2 -2
View File
@@ -11,13 +11,13 @@
INGROUP: MokoSuiteClient.Build
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
FILE: build-guide.md
VERSION: 02.44.00
VERSION: 02.46.80
PATH: /docs/guides/
BRIEF: Build and packaging guide for the MokoSuiteClient system plugin
NOTE: Defines environment setup, repository layout, packaging rules, and release preparation
-->
# MokoSuiteClient Build Guide (VERSION: 02.44.00)
# MokoSuiteClient Build Guide (VERSION: 02.46.80)
## 1. Purpose
+2 -2
View File
@@ -10,13 +10,13 @@
DEFGROUP: Joomla.Plugin
INGROUP: MokoSuiteClient.Guides
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
VERSION: 02.44.00
VERSION: 02.46.80
PATH: /docs/guides/configuration-guide.md
BRIEF: Configuration guide for the MokoSuiteClient system plugin
NOTE: Defines plugin parameters, expected behaviors, and recommended defaults
-->
# MokoSuiteClient Configuration Guide (VERSION: 02.44.00)
# MokoSuiteClient Configuration Guide (VERSION: 02.46.80)
## 1. Objective
+2 -2
View File
@@ -10,13 +10,13 @@
DEFGROUP: Joomla.Plugin
INGROUP: MokoSuiteClient.Guides
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
VERSION: 02.44.00
VERSION: 02.46.80
PATH: /docs/guides/installation-guide.md
BRIEF: Installation guide for the MokoSuiteClient system plugin
NOTE: First document in the guide set
-->
# MokoSuiteClient Installation Guide (VERSION: 02.44.00)
# MokoSuiteClient Installation Guide (VERSION: 02.46.80)
## Introduction
+2 -2
View File
@@ -10,13 +10,13 @@
DEFGROUP: Joomla.Plugin
INGROUP: MokoSuiteClient.Guides
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
VERSION: 02.44.00
VERSION: 02.46.80
PATH: /docs/guides/operations-guide.md
BRIEF: Operational guide for administering and managing the MokoSuiteClient system plugin
NOTE: Defines lifecycle, responsibilities, and operational behaviors
-->
# MokoSuiteClient Operations Guide (VERSION: 02.44.00)
# MokoSuiteClient Operations Guide (VERSION: 02.46.80)
## Introduction
+2 -2
View File
@@ -10,13 +10,13 @@
DEFGROUP: Joomla.Plugin
INGROUP: MokoSuiteClient.Guides
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
VERSION: 02.44.00
VERSION: 02.46.80
PATH: /docs/guides/rollback-and-recovery-guide.md
BRIEF: Rollback and recovery guide for restoring stable operation after plugin related incidents
NOTE: Completes the core guide set for Suite plugin governance
-->
# MokoSuiteClient Rollback and Recovery Guide (VERSION: 02.44.00)
# MokoSuiteClient Rollback and Recovery Guide (VERSION: 02.46.80)
## Introduction
+2 -2
View File
@@ -7,13 +7,13 @@
DEFGROUP: Joomla.Plugin
INGROUP: MokoSuiteClient.Guides
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
VERSION: 02.44.00
VERSION: 02.46.80
PATH: /docs/guides/testing-guide.md
BRIEF: Testing guide for MokoSuiteClient v02.01.08
NOTE: Covers manual test procedures for language overrides, install/uninstall, and configuration
-->
# MokoSuiteClient Testing Guide (VERSION: 02.44.00)
# MokoSuiteClient Testing Guide (VERSION: 02.46.80)
## 1. Prerequisites
+2 -2
View File
@@ -10,13 +10,13 @@
DEFGROUP: Joomla.Plugin
INGROUP: MokoSuiteClient.Guides
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
VERSION: 02.44.00
VERSION: 02.46.80
PATH: /docs/guides/troubleshooting-guide.md
BRIEF: Troubleshooting guide for diagnosing and resolving issues related to the MokoSuiteClient plugin
NOTE: Designed for administrators and Suite operations teams
-->
# MokoSuiteClient Troubleshooting Guide (VERSION: 02.44.00)
# MokoSuiteClient Troubleshooting Guide (VERSION: 02.46.80)
## Introduction
+2 -2
View File
@@ -10,13 +10,13 @@
DEFGROUP: Joomla.Plugin
INGROUP: MokoSuiteClient.Guides
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
VERSION: 02.44.00
VERSION: 02.46.80
PATH: /docs/guides/upgrade-and-versioning-guide.md
BRIEF: Guide for updating, versioning, and maintaining the MokoSuiteClient plugin
NOTE: Defines release flow, version rules, and upgrade validation
-->
# MokoSuiteClient Upgrade and Versioning Guide (VERSION: 02.44.00)
# MokoSuiteClient Upgrade and Versioning Guide (VERSION: 02.46.80)
## Introduction
+2 -2
View File
@@ -10,13 +10,13 @@
DEFGROUP: Joomla.Plugin
INGROUP: MokoSuiteClient.Documentation
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
VERSION: 02.44.00
VERSION: 02.46.80
PATH: /docs/index.md
BRIEF: Master index of all documentation for the MokoSuiteClient plugin
NOTE: Automatically maintained index for all guide canvases
-->
# MokoSuiteClient Documentation Index (VERSION: 02.44.00)
# MokoSuiteClient Documentation Index (VERSION: 02.46.80)
## Introduction
+2 -2
View File
@@ -11,12 +11,12 @@
INGROUP: MokoSuiteClient
REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
PATH: /docs/plugin-basic.md
VERSION: 02.44.00
VERSION: 02.46.80
BRIEF: Baseline documentation for the MokoSuiteClient system plugin
NOTE: Foundational reference for internal and external stakeholders
-->
# MokoSuiteClient Plugin Overview (VERSION: 02.44.00)
# MokoSuiteClient Plugin Overview (VERSION: 02.46.80)
## Introduction
+1 -1
View File
@@ -10,7 +10,7 @@ DEFGROUP: MokoSuiteClient.Documentation
INGROUP: MokoStandards.Templates
REPO: https://github.com/mokoconsulting-tech/MokoSuiteClient
PATH: /docs/update-server.md
VERSION: 02.44.00
VERSION: 02.46.80
BRIEF: How this extension's Joomla update server file (update.xml) is managed
-->
@@ -2,7 +2,7 @@
; Copyright (C) 2026 Moko Consulting. All rights reserved.
; License: GPL-3.0-or-later
COM_MOKOSUITECLIENT="MokoSuiteClient"
COM_MOKOSUITECLIENT="MokoSuite"
COM_MOKOSUITECLIENT_DESCRIPTION="MokoSuiteClient admin dashboard and REST API. Control panel for managing site features, health monitoring, and remote management."
COM_MOKOSUITECLIENT_DASHBOARD_TITLE="MokoSuiteClient Control Panel"
COM_MOKOSUITECLIENT_MENU_DASHBOARD="Dashboard"
@@ -215,3 +215,15 @@ INSERT IGNORE INTO `#__mokosuiteclient_retention_policies` (`id`, `content_type`
(4, 'inactive_users', 730, 'anonymize', 0, 'Anonymize users inactive for 2 years (disabled by default)'),
(5, 'closed_tickets', 365, 'anonymize', 0, 'Anonymize closed tickets older than 1 year (disabled by default)');
-- ============================================================
-- License Cache — stores MokoGitea validation results
-- ============================================================
CREATE TABLE IF NOT EXISTS `#__mokosuite_license_cache` (
`dlid_hash` CHAR(64) NOT NULL COMMENT 'SHA-256 of DLID (never store raw DLID)',
`response_data` TEXT NOT NULL COMMENT 'JSON validation response from MokoGitea',
`checked_at` DATETIME NOT NULL,
PRIMARY KEY (`dlid_hash`),
KEY `idx_checked` (`checked_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@@ -26,6 +26,7 @@ class HtmlView extends BaseHtmlView
protected $wafChartData = [];
protected $loginChartData = [];
protected $mokoExtensions = [];
public $supportPin = '';
public function display($tpl = null)
{
@@ -33,6 +34,28 @@ class HtmlView extends BaseHtmlView
$this->plugins = $model->getFeaturePlugins();
$this->siteInfo = $model->getSiteInfo();
// Daily support PIN from health token
try
{
$db = \Joomla\CMS\Factory::getDbo();
$db->setQuery(
$db->getQuery(true)
->select($db->quoteName('params'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('element') . ' = ' . $db->quote('mokosuiteclient'))
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
);
$token = (json_decode((string) $db->loadResult()))->health_api_token ?? '';
if (!empty($token))
{
$hash = hash_hmac('sha256', gmdate('Y-m-d'), $token);
$this->supportPin = 'MOKO-' . strtoupper(substr($hash, 0, 4)) . '-' . strtoupper(substr($hash, 4, 4));
}
}
catch (\Throwable $e) {}
$this->recentLogins = $model->getRecentLogins(5);
$this->pendingUpdates = $model->getPendingUpdates();
$this->checkedOutItems = $model->getCheckedOutItems();
@@ -48,6 +48,12 @@ $categoryOrder = ['core', 'security', 'monitoring', 'content', 'tools', 'api'];
<span class="mokosuiteclient-info-label">MokoSuiteClient</span>
<span class="mokosuiteclient-info-value"><span class="badge bg-primary"><?php echo $this->escape($siteInfo->mokosuiteclient_version); ?></span></span>
</div>
<?php if (!empty($this->supportPin)): ?>
<div class="mokosuiteclient-info-item">
<span class="mokosuiteclient-info-label">Support PIN</span>
<span class="mokosuiteclient-info-value"><span class="badge bg-dark" style="font-family:monospace;letter-spacing:0.08em;cursor:help;" title="Daily verification PIN — rotates at midnight UTC. Ask your provider for this code to verify identity."><span class="icon-key small me-1" aria-hidden="true"></span><?php echo $this->escape($this->supportPin); ?></span></span>
</div>
<?php endif; ?>
<div class="mokosuiteclient-info-item">
<span class="mokosuiteclient-info-label">Joomla</span>
<span class="mokosuiteclient-info-value"><span class="badge bg-secondary"><?php echo $this->escape($siteInfo->joomla_version); ?></span></span>
@@ -311,7 +317,7 @@ $categoryOrder = ['core', 'security', 'monitoring', 'content', 'tools', 'api'];
<tr>
<td class="text-muted"><?php echo $this->escape(mb_substr($item->title, 0, 30)); ?></td>
<td class="text-muted"><?php echo $this->escape($item->username ?? ''); ?></td>
<td class="text-muted"><?php echo HTMLHelper::_('date', $item->checked_out_time, 'M d H:i'); ?></td>
<td class="text-muted"><?php echo HTMLHelper::_('date', $item->checked_out_time, Text::_('DATE_FORMAT_LC4')); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
@@ -342,7 +348,7 @@ $categoryOrder = ['core', 'security', 'monitoring', 'content', 'tools', 'api'];
<tr>
<td class="text-muted"><code><?php echo $this->escape($block->ip); ?></code></td>
<td class="text-muted"><span class="badge bg-danger"><?php echo $this->escape($block->rule); ?></span></td>
<td class="text-muted"><?php echo HTMLHelper::_('date', $block->created, 'M d H:i'); ?></td>
<td class="text-muted"><?php echo HTMLHelper::_('date', $block->created, Text::_('DATE_FORMAT_LC4')); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
@@ -369,7 +375,7 @@ $categoryOrder = ['core', 'security', 'monitoring', 'content', 'tools', 'api'];
<tr>
<td class="text-muted"><?php echo $this->escape($login->username ?? ''); ?></td>
<td class="text-muted"><code><?php echo $this->escape($login->ip_address ?? ''); ?></code></td>
<td class="text-muted"><?php echo HTMLHelper::_('date', $login->log_date, 'M d H:i'); ?></td>
<td class="text-muted"><?php echo HTMLHelper::_('date', $login->log_date, Text::_('DATE_FORMAT_LC4')); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
@@ -3,6 +3,7 @@ defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
@@ -140,8 +141,8 @@ $typeBadge = [
<td><?php echo $this->escape($r->user_name ?? ''); ?><br><small class="text-muted"><?php echo $this->escape($r->user_email ?? ''); ?></small></td>
<td><span class="badge <?php echo $typeBadge[$r->type] ?? 'bg-secondary'; ?>"><?php echo ucfirst($r->type); ?></span></td>
<td><span class="badge <?php echo $statusBadge[$r->status] ?? 'bg-secondary'; ?>"><?php echo ucfirst($r->status); ?></span></td>
<td class="text-nowrap small"><?php echo HTMLHelper::_('date', $r->created, 'M d, Y H:i'); ?></td>
<td class="text-nowrap small"><?php echo $r->processed ? HTMLHelper::_('date', $r->processed, 'M d, Y H:i') : '—'; ?></td>
<td class="text-nowrap small"><?php echo HTMLHelper::_('date', $r->created, Text::_('DATE_FORMAT_LC2')); ?></td>
<td class="text-nowrap small"><?php echo $r->processed ? HTMLHelper::_('date', $r->processed, Text::_('DATE_FORMAT_LC2')) : '—'; ?></td>
<td>
<?php if ($r->status === 'pending'): ?>
<div class="btn-group btn-group-sm">
@@ -2,6 +2,7 @@
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
@@ -32,7 +33,7 @@ $priorities = $this->priorities ?? [];
<div class="card-header d-flex justify-content-between align-items-center">
<div>
<strong><?php echo $this->escape($t->created_by_name); ?></strong>
<small class="text-muted ms-2"><?php echo HTMLHelper::_('date', $t->created, 'M d, Y H:i'); ?></small>
<small class="text-muted ms-2"><?php echo HTMLHelper::_('date', $t->created, Text::_('DATE_FORMAT_LC2')); ?></small>
</div>
<span class="badge bg-dark">Original</span>
</div>
@@ -59,7 +60,7 @@ $priorities = $this->priorities ?? [];
<div class="card-header d-flex justify-content-between align-items-center">
<div>
<strong><?php echo $this->escape($reply->user_name ?? 'System'); ?></strong>
<small class="text-muted ms-2"><?php echo HTMLHelper::_('date', $reply->created, 'M d, Y H:i'); ?></small>
<small class="text-muted ms-2"><?php echo HTMLHelper::_('date', $reply->created, Text::_('DATE_FORMAT_LC2')); ?></small>
</div>
<?php if ($reply->is_internal): ?>
<span class="badge bg-warning text-dark">Internal Note</span>
@@ -147,9 +148,9 @@ $priorities = $this->priorities ?? [];
<?php if (!empty($t->contact_phone)): ?><br><small><?php echo $this->escape($t->contact_phone); ?></small><?php endif; ?>
</td></tr>
<?php endif; ?>
<tr><td class="text-muted">Created</td><td><?php echo HTMLHelper::_('date', $t->created, 'M d, Y H:i'); ?></td></tr>
<?php if ($t->resolved): ?><tr><td class="text-muted">Resolved</td><td><?php echo HTMLHelper::_('date', $t->resolved, 'M d, Y H:i'); ?></td></tr><?php endif; ?>
<?php if ($t->closed): ?><tr><td class="text-muted">Closed</td><td><?php echo HTMLHelper::_('date', $t->closed, 'M d, Y H:i'); ?></td></tr><?php endif; ?>
<tr><td class="text-muted">Created</td><td><?php echo HTMLHelper::_('date', $t->created, Text::_('DATE_FORMAT_LC2')); ?></td></tr>
<?php if ($t->resolved): ?><tr><td class="text-muted">Resolved</td><td><?php echo HTMLHelper::_('date', $t->resolved, Text::_('DATE_FORMAT_LC2')); ?></td></tr><?php endif; ?>
<?php if ($t->closed): ?><tr><td class="text-muted">Closed</td><td><?php echo HTMLHelper::_('date', $t->closed, Text::_('DATE_FORMAT_LC2')); ?></td></tr><?php endif; ?>
<tr><td class="text-muted">Replies</td><td><?php echo $t->reply_count; ?></td></tr>
</table>
</div>
@@ -167,7 +168,7 @@ $priorities = $this->priorities ?? [];
$responseOverdue = !$t->sla_responded && strtotime($t->sla_response_due) < time();
?>
<span class="<?php echo $t->sla_responded ? 'text-success' : ($responseOverdue ? 'text-danger fw-bold' : ''); ?>">
<?php echo $t->sla_responded ? 'Responded' : HTMLHelper::_('date', $t->sla_response_due, 'M d H:i'); ?>
<?php echo $t->sla_responded ? 'Responded' : HTMLHelper::_('date', $t->sla_response_due, Text::_('DATE_FORMAT_LC4')); ?>
<?php echo $responseOverdue ? ' OVERDUE' : ''; ?>
</span>
</div>
@@ -179,7 +180,7 @@ $priorities = $this->priorities ?? [];
$resolutionOverdue = !!empty($t->status_is_closed) && strtotime($t->sla_resolution_due) < time();
?>
<span class="<?php echo !empty($t->status_is_closed) ? 'text-success' : ($resolutionOverdue ? 'text-danger fw-bold' : ''); ?>">
<?php echo !empty($t->status_is_closed) ? 'Met' : HTMLHelper::_('date', $t->sla_resolution_due, 'M d H:i'); ?>
<?php echo !empty($t->status_is_closed) ? 'Met' : HTMLHelper::_('date', $t->sla_resolution_due, Text::_('DATE_FORMAT_LC4')); ?>
<?php echo $resolutionOverdue ? ' OVERDUE' : ''; ?>
</span>
</div>
@@ -112,12 +112,12 @@ $token = Session::getFormToken();
echo '<em>Unassigned</em>';
}
?></td>
<td class="small"><?php echo HTMLHelper::_('date', $t->created, 'M d H:i'); ?></td>
<td class="small"><?php echo HTMLHelper::_('date', $t->created, Text::_('DATE_FORMAT_LC4')); ?></td>
<td class="small">
<?php if ($t->sla_response_due && !$t->sla_responded): ?>
<span title="Response due"><?php echo HTMLHelper::_('date', $t->sla_response_due, 'M d H:i'); ?></span>
<span title="Response due"><?php echo HTMLHelper::_('date', $t->sla_response_due, Text::_('DATE_FORMAT_LC4')); ?></span>
<?php elseif ($t->sla_resolution_due): ?>
<span title="Resolution due"><?php echo HTMLHelper::_('date', $t->sla_resolution_due, 'M d H:i'); ?></span>
<span title="Resolution due"><?php echo HTMLHelper::_('date', $t->sla_resolution_due, Text::_('DATE_FORMAT_LC4')); ?></span>
<?php else: ?>—<?php endif; ?>
</td>
</tr>
@@ -3,6 +3,7 @@ defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
@@ -98,7 +99,7 @@ $ruleBadge = [
<?php else: ?>
<?php foreach ($logs as $log): ?>
<tr>
<td class="text-nowrap small"><?php echo HTMLHelper::_('date', $log->created, 'M d H:i:s'); ?></td>
<td class="text-nowrap small"><?php echo HTMLHelper::_('date', $log->created, Text::_('DATE_FORMAT_LC4')); ?></td>
<td><code><?php echo htmlspecialchars($log->ip); ?></code></td>
<td><span class="badge <?php echo $ruleBadge[$log->rule] ?? 'bg-secondary'; ?>"><?php echo htmlspecialchars($log->rule); ?></span></td>
<td class="small" style="max-width:250px;overflow:hidden;text-overflow:ellipsis" title="<?php echo htmlspecialchars($log->uri); ?>"><?php echo htmlspecialchars(mb_substr($log->uri, 0, 60)); ?></td>
@@ -148,7 +149,7 @@ $ruleBadge = [
<tr>
<td><code class="small"><?php echo htmlspecialchars($tip->ip); ?></code></td>
<td class="fw-bold"><?php echo $tip->cnt; ?></td>
<td class="small text-nowrap"><?php echo HTMLHelper::_('date', $tip->last_seen, 'M d'); ?></td>
<td class="small text-nowrap"><?php echo HTMLHelper::_('date', $tip->last_seen, Text::_('DATE_FORMAT_LC4')); ?></td>
<td>
<button type="button" class="btn btn-sm btn-outline-danger btn-ban-ip" data-ip="<?php echo htmlspecialchars($tip->ip); ?>"
data-url="<?php echo Route::_('index.php?option=com_mokosuiteclient&task=display.banIpFromLog&format=json'); ?>"
@@ -20,7 +20,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>MokoSuiteClient admin dashboard and REST API. Provides a control panel for managing MokoSuiteClient feature plugins, site health monitoring, and remote management endpoints.</description>
<namespace path="src">Moko\Component\MokoSuiteClient</namespace>
@@ -7,9 +7,9 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>MOD_MOKOSUITECLIENT_CACHE_DESC</description>
<namespace path="src">Moko\Module\MokoSuiteCache</namespace>
<namespace path="src">Moko\Module\MokoSuiteClientCache</namespace>
<files>
<folder module="mod_mokosuiteclient_cache">services</folder>
@@ -4,11 +4,15 @@ namespace Moko\Module\MokoSuiteClientCache\Administrator\Dispatcher;
defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
use Joomla\CMS\Uri\Uri;
class Dispatcher extends AbstractModuleDispatcher
{
protected function getLayoutData()
{
return parent::getLayoutData();
$data = parent::getLayoutData();
$data['domain'] = parse_url(Uri::root(), PHP_URL_HOST) ?: '';
return $data;
}
}
@@ -13,6 +13,7 @@ use Joomla\CMS\Session\Session;
$token = Session::getFormToken();
$cacheUrl = 'index.php?option=com_mokosuiteclient&task=clearCache&format=json';
$tempUrl = 'index.php?option=com_mokosuiteclient&task=clearTemp&format=json';
$domain = $domain ?? '';
?>
<style>
@@ -21,9 +22,15 @@ $tempUrl = 'index.php?option=com_mokosuiteclient&task=clearTemp&format=json';
.mokosuiteclient-cleaner-btn { cursor:pointer; padding:0.2rem 0.5rem; font-size:0.8rem; border-radius:3px; text-decoration:none; color:var(--template-text-dark,#495057); transition:background 0.15s; white-space:nowrap; }
.mokosuiteclient-cleaner-btn:hover { background:rgba(0,0,0,0.08); color:var(--template-text-dark,#212529); text-decoration:none; }
.mokosuiteclient-cleaner-sep { color:var(--template-text-dark,#adb5bd); padding:0 0.1rem; font-size:0.8rem; }
.mokosuiteclient-domain { font-family:monospace; font-size:0.75rem; color:var(--template-text-dark,#6c757d); cursor:pointer; padding:0.15rem 0.4rem; border-radius:3px; transition:background 0.15s; }
.mokosuiteclient-domain:hover { background:rgba(0,0,0,0.06); }
</style>
<div class="header-item-content mokosuiteclient-cleaner">
<?php if ($domain): ?>
<span class="mokosuiteclient-domain" id="mokosuiteclient-domain" title="Support key — click to copy"><?php echo htmlspecialchars($domain); ?></span>
<span class="mokosuiteclient-cleaner-sep">|</span>
<?php endif; ?>
<span class="mokosuiteclient-cleaner-label">Clear:</span>
<a href="#" class="mokosuiteclient-cleaner-btn" id="mokosuiteclient-clear-cache" title="Clear all Joomla cache">
<span class="icon-bolt" aria-hidden="true" id="mokosuiteclient-cache-icon"></span> Cache
@@ -85,5 +92,17 @@ document.addEventListener('DOMContentLoaded', function() {
setupCleaner('mokosuiteclient-clear-cache', 'mokosuiteclient-cache-icon', '<?php echo $cacheUrl; ?>', '<?php echo $token; ?>');
setupCleaner('mokosuiteclient-clear-temp', 'mokosuiteclient-temp-icon', '<?php echo $tempUrl; ?>', '<?php echo $token; ?>');
// Click-to-copy domain
var domainEl = document.getElementById('mokosuiteclient-domain');
if (domainEl) {
domainEl.addEventListener('click', function() {
navigator.clipboard.writeText(domainEl.textContent.trim()).then(function() {
var orig = domainEl.textContent;
domainEl.textContent = 'Copied!';
setTimeout(function() { domainEl.textContent = orig; }, 1500);
});
});
}
});
</script>
@@ -7,7 +7,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>MOD_MOKOSUITECLIENT_CATEGORIES_DESC</description>
<namespace path="src">Moko\Module\MokoSuiteClientCategories</namespace>
@@ -7,9 +7,9 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>MOD_MOKOSUITECLIENT_CPANEL_DESC</description>
<namespace path="src">Moko\Module\MokoSuiteCpanel</namespace>
<namespace path="src">Moko\Module\MokoSuiteClientCpanel</namespace>
<files>
<folder module="mod_mokosuiteclient_cpanel">services</folder>
@@ -28,14 +28,6 @@
label="MOD_MOKOSUITECLIENT_CPANEL_FIELDSET_DISPLAY"
description="MOD_MOKOSUITECLIENT_CPANEL_FIELDSET_DISPLAY_DESC">
<field name="collapsed" type="radio" default="1"
label="MOD_MOKOSUITECLIENT_CPANEL_COLLAPSED_LABEL"
description="MOD_MOKOSUITECLIENT_CPANEL_COLLAPSED_DESC"
layout="joomla.form.field.radio.switcher">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="show_health" type="radio" default="1"
label="MOD_MOKOSUITECLIENT_CPANEL_SHOW_HEALTH_LABEL"
layout="joomla.form.field.radio.switcher">
@@ -47,7 +47,7 @@ class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareI
$data['currentIp'] = $helper->getCurrentIp();
$data['ssl'] = $helper->getSslStatus();
// Support PIN derived from health token
// Daily support PIN derived from health token + today's date (UTC)
$data['supportPin'] = '';
try
@@ -65,7 +65,9 @@ class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareI
if (!empty($token))
{
$data['supportPin'] = 'MOKO-' . strtoupper(substr($token, 0, 4) . '-' . substr($token, 4, 4));
$date = gmdate('Y-m-d');
$hash = hash_hmac('sha256', $date, $token);
$data['supportPin'] = 'MOKO-' . strtoupper(substr($hash, 0, 4)) . '-' . strtoupper(substr($hash, 4, 4));
}
}
catch (\Throwable $e) {}
@@ -22,7 +22,7 @@ $healthOk = $healthOk ?? true;
$counts = $counts ?? (object) ['articles' => 0, 'users' => 0, 'extensions' => 0, 'updates' => 0];
$disk = $disk ?? (object) ['free_mb' => null, 'total_mb' => null];
$currentIp = $currentIp ?? '';
$collapsed = $params->get('collapsed', 0);
$collapsed = true;
$showHealth = $params->get('show_health', 1);
$showStats = $params->get('show_stats', 1);
$showDisk = $params->get('show_disk', 1);
@@ -7,7 +7,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>MokoSuiteClient admin sidebar menu — renders a dedicated MokoSuiteClient section in the admin menu before Joomla's default menu.</description>
<namespace path="src">Moko\Module\MokoSuiteClientMenu</namespace>
@@ -3,7 +3,7 @@
* MokoSuiteClient Admin Sidebar Menu
*
* Each installed Moko component gets its own top-level collapsible section.
* com_mokosuiteclienthq is always pinned first. com_mokosuiteclient uses static views
* com_mokosuitehq is always pinned first. com_mokosuiteclient uses static views
* as children. All other components auto-discover their submenu items.
*/
@@ -101,7 +101,7 @@ else
// com_mokosuiteclient not in admin menu — add it manually
$mokoComponents['com_mokosuiteclient'] = [
'id' => 0,
'title' => 'MokoSuiteClient',
'title' => 'MokoSuite',
'link' => 'index.php?option=com_mokosuiteclient',
'icon' => 'icon-shield-alt',
'element' => 'com_mokosuiteclient',
@@ -109,16 +109,37 @@ else
];
}
// ── Sort: com_mokosuiteclienthq first, then alphabetical by title ─────────
// ── Sort: HQ first, Client second, then alphabetical ─────────
$hq = null;
$client = null;
$rest = [];
foreach ($mokoComponents as $key => $comp)
{
if ($key === 'com_mokosuiteclienthq')
// Shorten display titles:
// MokoSuiteClient → MokoSuite, MokoSuiteHQ → MokoHQ
// Everything else: MokoSuiteBackup → Backup, MokoSuiteOpenGraph → OpenGraph
if ($key === 'com_mokosuiteclient')
{
$comp['title'] = 'MokoSuite';
}
elseif ($key === 'com_mokosuitehq')
{
$comp['title'] = preg_replace('/^MokoSuite/i', 'Moko', $comp['title']);
}
else
{
$comp['title'] = preg_replace('/^MokoSuite\s*/i', '', $comp['title']);
}
if ($key === 'com_mokosuitehq')
{
$hq = $comp;
}
elseif ($key === 'com_mokosuiteclient')
{
$client = $comp;
}
else
{
$rest[$key] = $comp;
@@ -132,6 +153,10 @@ if ($hq !== null)
{
$sorted[] = $hq;
}
if ($client !== null)
{
$sorted[] = $client;
}
foreach ($rest as $comp)
{
$sorted[] = $comp;
@@ -139,8 +164,7 @@ foreach ($rest as $comp)
?>
<style>
.sidebar-wrapper .mokosuiteclient-ext-item > a { padding-inline-start: 1.5rem; }
.sidebar-wrapper .mokosuiteclient-ext-child > a { padding-inline-start: 2.5rem; }
.sidebar-wrapper { padding-right: 0.5rem; }
</style>
<ul class="nav flex-column main-nav">
@@ -22,7 +22,7 @@
* DEFGROUP: Joomla.Plugin
* INGROUP: MokoSuiteClient
* REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
* VERSION: 02.44.00
* VERSION: 02.46.80
* PATH: /src/Extension/MokoSuiteClient.php
* NOTE: Core system plugin for MokoSuiteClient admin tools suite
*/
@@ -968,13 +968,21 @@ class MokoSuiteClient extends CMSPlugin implements BootableExtensionInterface
if (!in_array($akTable, $tables))
{
return [
'status' => 'ok',
'installed' => false,
];
// Check for MokoSuiteBackup instead
if (!in_array($prefix . 'mokosuitebackup_records', $tables))
{
return [
'status' => 'ok',
'installed' => false,
'message' => 'No backup solution installed (Akeeba Backup or MokoSuiteBackup)',
];
}
// MokoSuiteBackup is installed — query its table
return $this->checkMokoSuiteBackup($db);
}
// Get the most recent backup
// Get the most recent Akeeba Backup
$query = $db->getQuery(true)
->select([
$db->quoteName('id'),
@@ -1050,13 +1058,53 @@ class MokoSuiteClient extends CMSPlugin implements BootableExtensionInterface
}
catch (\Exception $e)
{
\Joomla\CMS\Log\Log::add('Backup check failed: ' . $e->getMessage(), \Joomla\CMS\Log\Log::WARNING, 'mokosuiteclient');
return [
'status' => 'ok',
'installed' => false,
'status' => 'error',
'message' => 'Backup check failed: ' . $e->getMessage(),
];
}
}
/**
* Query MokoSuiteBackup tables for backup status.
*/
protected function checkMokoSuiteBackup($db): array
{
$db->setQuery(
$db->getQuery(true)
->select(['id', 'description', 'status', 'backupstart', 'backupend', 'total_size'])
->from($db->quoteName('#__mokosuitebackup_records'))
->order($db->quoteName('id') . ' DESC'),
0, 1
);
$latest = $db->loadObject();
if (!$latest)
{
return ['status' => 'degraded', 'installed' => true, 'message' => 'MokoSuiteBackup installed but no backups found'];
}
$daysSince = 999;
if (!empty($latest->backupstart) && $latest->backupstart !== '0000-00-00 00:00:00')
{
$daysSince = (int) ((time() - strtotime($latest->backupstart)) / 86400);
}
$status = ($latest->status === 'complete' && $daysSince <= 7) ? 'ok' : 'degraded';
return [
'status' => $status,
'installed' => true,
'last_backup' => $latest->backupstart,
'last_status' => $latest->status,
'days_since' => $daysSince,
'message' => 'MokoSuiteBackup: last backup ' . $daysSince . 'd ago (' . $latest->status . ')',
];
}
/**
* Check Admin Tools status — WAF status, security exceptions.
*
@@ -1083,6 +1131,7 @@ class MokoSuiteClient extends CMSPlugin implements BootableExtensionInterface
return [
'status' => 'ok',
'installed' => false,
'message' => 'Admin Tools is not installed',
];
}
@@ -1189,7 +1238,7 @@ class MokoSuiteClient extends CMSPlugin implements BootableExtensionInterface
}
catch (\Exception $e)
{
return ['status' => 'ok', 'https' => false];
return ['status' => 'error', 'message' => 'SSL check failed: ' . $e->getMessage()];
}
}
@@ -1209,7 +1258,7 @@ class MokoSuiteClient extends CMSPlugin implements BootableExtensionInterface
if (!in_array($prefix . 'scheduler_tasks', $tables))
{
return ['status' => 'ok', 'available' => false];
return ['status' => 'ok', 'available' => false, 'message' => 'Task Scheduler not available'];
}
$db->setQuery(
@@ -1274,7 +1323,7 @@ class MokoSuiteClient extends CMSPlugin implements BootableExtensionInterface
}
catch (\Exception $e)
{
return ['status' => 'ok', 'available' => false];
return ['status' => 'error', 'message' => 'Scheduler check failed: ' . $e->getMessage()];
}
}
@@ -1701,6 +1750,7 @@ class MokoSuiteClient extends CMSPlugin implements BootableExtensionInterface
return [
'status' => $status,
'message' => $issues ? implode('; ', $issues) : 'All configuration settings are optimal',
'debug' => $debug,
'error_report' => $errorReport,
'gzip' => $gzip,
@@ -1709,7 +1759,6 @@ class MokoSuiteClient extends CMSPlugin implements BootableExtensionInterface
'force_ssl' => $forceSSL,
'caching' => $caching,
'lifetime' => $lifetime,
'issues' => $issues ?: null,
];
}
@@ -1786,6 +1835,36 @@ class MokoSuiteClient extends CMSPlugin implements BootableExtensionInterface
*/
protected function getDevAliasDomain(): string
{
// Check devtools plugin params for custom dev domain
try
{
$db = Factory::getDbo();
$db->setQuery(
$db->getQuery(true)
->select($db->quoteName('params'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('element') . ' = ' . $db->quote('mokosuiteclient_devtools'))
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
);
$devParams = json_decode((string) $db->loadResult());
if ($devParams && ($devParams->dev_domain_enabled ?? '1') === '0')
{
return '';
}
if (!empty($devParams->dev_domain))
{
return trim($devParams->dev_domain);
}
}
catch (\Throwable $e)
{
// Fall through to default
}
// Default: dev.{primary_domain}
$primary = $this->getPrimaryHost();
return !empty($primary) ? 'dev.' . $primary : '';
@@ -2506,9 +2585,12 @@ class MokoSuiteClient extends CMSPlugin implements BootableExtensionInterface
$config = Factory::getConfig();
$timestamp = time();
$devDomain = $this->getDevAliasDomain();
$payload = [
'token' => $healthToken,
'domain' => $domain,
'dev_domain' => $devDomain ?: null,
'site_name' => $config->get('sitename', 'Joomla'),
'site_url' => $siteUrl,
'joomla_version' => (new Version())->getShortVersion(),
@@ -2561,15 +2643,18 @@ class MokoSuiteClient extends CMSPlugin implements BootableExtensionInterface
if ($response->code >= 200 && $response->code < 300)
{
$this->app->enqueueMessage('MokoSuiteClientHQ heartbeat: site registered', 'message');
$this->app->enqueueMessage('MokoSuiteHQ heartbeat: site registered successfully.', 'message');
}
else
{
$body = json_decode($response->body, true);
$msg = $body['error'] ?? $body['message'] ?? ('HTTP ' . $response->code);
Log::add(
\sprintf('Heartbeat HTTP %d: %s', $response->code, $response->body),
Log::WARNING,
'mokosuiteclient'
);
$this->app->enqueueMessage('MokoSuiteHQ heartbeat failed: ' . $msg, 'warning');
}
}
catch (\Throwable $e)
@@ -8,7 +8,7 @@
* FILE INFORMATION
* DEFGROUP: Joomla.Plugin
* INGROUP: MokoSuiteClient
* VERSION: 02.44.00
* VERSION: 02.46.80
* PATH: /src/Field/CopyableTokenField.php
* BRIEF: Read-only token field with a copy-to-clipboard button
*/
@@ -0,0 +1,367 @@
<?php
/**
* @package MokoSuiteClient
* @subpackage plg_system_mokosuiteclient
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
*/
namespace Moko\Plugin\System\MokoSuiteClient\Helper;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\Database\DatabaseInterface;
/**
* MokoGitea License Validator — core DRM enforcement for the MokoSuite platform.
*
* Validates the site's DLID against MokoGitea, caches the result,
* and provides entitlement checking for all suite modules.
*
* Default Gitea server: git.mokoconsulting.tech
*
* @since 02.45.00
*/
final class LicenseValidator
{
/** @var string Default MokoGitea server address */
private const DEFAULT_GITEA_URL = 'https://git.mokoconsulting.tech';
/** @var int Cache TTL in seconds (24 hours) */
private const CACHE_TTL = 86400;
/** @var int Grace period in days after expiry before deactivation */
private const DEFAULT_GRACE_DAYS = 7;
/** @var object|null Cached license data for current request */
private static ?object $cachedLicense = null;
/**
* Validate the site's DLID against MokoGitea.
* Returns cached result if still valid; calls API if expired.
*/
public static function validate(bool $forceRefresh = false): object
{
if (self::$cachedLicense && !$forceRefresh) {
return self::$cachedLicense;
}
$db = Factory::getContainer()->get(DatabaseInterface::class);
$dlid = self::getDlid();
if (!$dlid) {
return self::$cachedLicense = (object) [
'valid' => false,
'status' => 'no_dlid',
'message' => 'No license key configured',
'entitlements'=> [],
];
}
// Check DB cache first
if (!$forceRefresh) {
$cached = self::getCachedResult($db, $dlid);
if ($cached) {
return self::$cachedLicense = $cached;
}
}
// Call MokoGitea API
$result = self::callGiteaApi($dlid);
// Cache the result
self::cacheResult($db, $dlid, $result);
return self::$cachedLicense = $result;
}
/**
* Check if the current license includes entitlement for a specific extension.
*
* @param string $extension Extension element name (e.g., 'com_mokosuite_crm', 'com_mokosuiterestaurant')
* @return bool
*/
public static function isEntitled(string $extension): bool
{
$license = self::validate();
if (!$license->valid) return false;
// Map extension names to repo identifiers
$repoMap = [
'com_mokosuite' => 'MokoSuite',
'com_mokosuite_crm' => 'MokoSuiteCRM',
'com_mokosuite_erp' => 'MokoSuiteERP',
'com_mokosuitechild' => 'MokoSuiteChild',
'com_mokosuitecreate' => 'MokoSuiteCreate',
'com_mokosuitenpo' => 'MokoSuiteNPO',
'com_mokosuitefield' => 'MokoSuiteField',
'com_mokosuitepos' => 'MokoSuitePOS',
'com_mokoshop' => 'MokoSuiteShop',
'com_mokosuitehrm' => 'MokoSuiteHRM',
'com_mokosuitemrp' => 'MokoSuiteMRP',
'com_mokosuiterestaurant' => 'MokoSuiteRestaurant',
];
$repo = $repoMap[$extension] ?? $extension;
$entitlements = $license->entitlements ?? [];
// Base is always entitled if license is valid
if ($repo === 'MokoSuite') return true;
return in_array($repo, $entitlements, true);
}
/**
* Get the full license status for admin display.
*/
public static function getStatus(): object
{
$license = self::validate();
return (object) [
'valid' => $license->valid ?? false,
'status' => $license->status ?? 'unknown',
'tier' => $license->tier ?? 'none',
'entitlements' => $license->entitlements ?? [],
'expires_at' => $license->expires_at ?? null,
'seats' => $license->seats ?? 0,
'seats_used' => $license->seats_used ?? 0,
'days_remaining'=> self::getDaysRemaining($license),
'in_grace' => self::isInGracePeriod($license),
'gitea_url' => self::getGiteaUrl(),
'dlid_configured' => (bool) self::getDlid(),
];
}
/**
* Get available seat count.
*/
public static function getAvailableSeats(): int
{
$license = self::validate();
$total = (int) ($license->seats ?? 0);
$used = (int) ($license->seats_used ?? 0);
if ($total === 0) return PHP_INT_MAX; // Unlimited seats
return max(0, $total - $used);
}
/**
* Report a heartbeat to MokoGitea (active installation check).
* Called by task scheduler daily.
*/
public static function heartbeat(): object
{
$dlid = self::getDlid();
if (!$dlid) return (object) ['success' => false, 'error' => 'No DLID'];
$giteaUrl = self::getGiteaUrl();
$siteUrl = \Joomla\CMS\Uri\Uri::root();
$joomlaVersion = (new \Joomla\CMS\Version())->getShortVersion();
// Count installed suite modules
$db = Factory::getContainer()->get(DatabaseInterface::class);
$db->setQuery($db->getQuery(true)
->select('element')
->from('#__extensions')
->where($db->quoteName('element') . ' LIKE ' . $db->quote('com_mokosuite%'))
->where($db->quoteName('type') . ' = ' . $db->quote('component'))
->where($db->quoteName('enabled') . ' = 1'));
$installedModules = $db->loadColumn() ?: [];
$response = self::httpPost($giteaUrl . '/api/v1/licenses/heartbeat', [
'dlid' => $dlid,
'site_url' => $siteUrl,
'joomla_version' => $joomlaVersion,
'installed_modules' => $installedModules,
'php_version' => PHP_VERSION,
]);
return $response;
}
// ── Private methods ─────────────────────────────────
/**
* Get the configured DLID from component params.
*/
private static function getDlid(): string
{
try {
$params = Factory::getApplication()->getParams('com_mokosuite');
return trim($params->get('dlid', ''));
} catch (\Throwable $e) {
// Component not installed or params not available
try {
$db = Factory::getContainer()->get(DatabaseInterface::class);
$db->setQuery($db->getQuery(true)
->select('params')
->from('#__extensions')
->where($db->quoteName('element') . ' = ' . $db->quote('com_mokosuite'))
->where($db->quoteName('type') . ' = ' . $db->quote('component')));
$paramsJson = $db->loadResult();
$params = json_decode($paramsJson ?: '{}', false);
return trim($params->dlid ?? '');
} catch (\Throwable $e2) {
return '';
}
}
}
/**
* Get the MokoGitea server URL from config.
*/
private static function getGiteaUrl(): string
{
try {
$params = Factory::getApplication()->getParams('com_mokosuite');
return rtrim($params->get('gitea_url', self::DEFAULT_GITEA_URL), '/');
} catch (\Throwable $e) {
return self::DEFAULT_GITEA_URL;
}
}
/**
* Call MokoGitea license validation API.
*/
private static function callGiteaApi(string $dlid): object
{
$giteaUrl = self::getGiteaUrl();
$response = self::httpGet($giteaUrl . '/api/v1/licenses/validate?dlid=' . urlencode($dlid));
if (isset($response->valid)) {
return (object) [
'valid' => (bool) $response->valid,
'status' => $response->status ?? 'unknown',
'tier' => $response->tier ?? '',
'entitlements' => $response->entitlements ?? $response->repo_scope ?? [],
'expires_at' => $response->expires_at ?? null,
'seats' => (int) ($response->seats ?? 0),
'seats_used' => (int) ($response->seats_used ?? 0),
'message' => $response->message ?? '',
];
}
// API error — use cached result if available, otherwise fail gracefully
return (object) [
'valid' => false,
'status' => 'api_error',
'message' => $response->error ?? 'Could not reach license server',
'entitlements' => [],
];
}
/**
* Get cached validation result from database.
*/
private static function getCachedResult(DatabaseInterface $db, string $dlid): ?object
{
$dlidHash = hash('sha256', $dlid);
try {
$db->setQuery($db->getQuery(true)
->select('response_data, checked_at')
->from('#__mokosuite_license_cache')
->where($db->quoteName('dlid_hash') . ' = ' . $db->quote($dlidHash))
->where('checked_at > DATE_SUB(NOW(), INTERVAL ' . (int) self::CACHE_TTL . ' SECOND)'));
$cached = $db->loadObject();
if ($cached && $cached->response_data) {
$data = json_decode($cached->response_data, false);
if ($data) return $data;
}
} catch (\Throwable $e) {
// Table may not exist yet — that's fine
}
return null;
}
/**
* Cache validation result in database.
*/
private static function cacheResult(DatabaseInterface $db, string $dlid, object $result): void
{
$dlidHash = hash('sha256', $dlid);
try {
// Upsert
$db->setQuery('REPLACE INTO #__mokosuite_license_cache (dlid_hash, response_data, checked_at) VALUES ('
. $db->quote($dlidHash) . ', '
. $db->quote(json_encode($result)) . ', '
. $db->quote(Factory::getDate()->toSql()) . ')');
$db->execute();
} catch (\Throwable $e) {
// Cache table may not exist — non-fatal
}
}
/**
* Calculate days remaining on license.
*/
private static function getDaysRemaining(object $license): ?int
{
if (empty($license->expires_at)) return null;
$now = new \DateTime('today');
$expiry = new \DateTime($license->expires_at);
$diff = (int) $now->diff($expiry)->format('%r%a');
return $diff;
}
/**
* Check if license is in grace period (expired but within grace window).
*/
private static function isInGracePeriod(object $license): bool
{
$days = self::getDaysRemaining($license);
if ($days === null || $days >= 0) return false;
$graceDays = self::DEFAULT_GRACE_DAYS;
try {
$graceDays = (int) Factory::getApplication()->getParams('com_mokosuite')->get('license_grace_days', self::DEFAULT_GRACE_DAYS);
} catch (\Throwable $e) {}
return abs($days) <= $graceDays;
}
/**
* HTTP GET helper.
*/
private static function httpGet(string $url): object
{
$response = file_get_contents($url, false, stream_context_create([
'http' => [
'method' => 'GET',
'header' => 'Accept: application/json',
'ignore_errors' => true,
'timeout' => 10,
],
]));
return json_decode($response ?: '{}', false) ?: (object) ['error' => 'No response'];
}
/**
* HTTP POST helper.
*/
private static function httpPost(string $url, array $data): object
{
$response = file_get_contents($url, false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => "Content-Type: application/json\r\nAccept: application/json",
'ignore_errors' => true,
'timeout' => 10,
'content' => json_encode($data),
],
]));
return json_decode($response ?: '{}', false) ?: (object) ['error' => 'No response'];
}
}
@@ -30,7 +30,7 @@
<license>GNU General Public License version 3 or later; see LICENSE.md</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>MokoSuiteClient core system plugin — coordinates feature plugins, heartbeat, health checks, and admin customizations.</description>
<namespace path=".">Moko\Plugin\System\MokoSuiteClient</namespace>
<scriptfile>script.php</scriptfile>
@@ -100,7 +100,7 @@
filter="url" />
<field name="monitor_signing_key" type="hidden"
default="LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tDQpNSUlFdmdJQkFEQU5CZ2txaGtpRzl3MEJBUUVGQUFTQ0JLZ3dnZ1NrQWdFQUFvSUJBUUMvcnVrWE0zZHB0aDg2DQpGSkRXTjM0ZjQ2cUtJem1SMmFtTWUyZ2dWbWxsWnFyMHJkRFk4OTdtQ05FRkk4Q0NwNGR5amkwOU5ETnAvalFxDQovL2JGdU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U3MWl5CkFXWDRBVHIrYitvSGk2eUk1MXRHRk54RUxiNXZYMVpYM3VNaDlWM29iYUpuSFNjYllpKzBBNjlyRmNuNEZuLzUKWXJybWxLTzRlRHFVZkswbVFJVCtwUT09Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K"
filter="raw" />
</fieldset>
</fields>
@@ -22,7 +22,7 @@
* DEFGROUP: Joomla.Plugin
* INGROUP: MokoSuiteClient
* REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
* VERSION: 02.44.00
* VERSION: 02.46.80
* PATH: /src/script.php
* BRIEF: Installation script for MokoSuiteClient plugin
* NOTE: Handles installation, update, and uninstallation tasks including language override deployment
@@ -22,7 +22,7 @@
* DEFGROUP: Joomla.Plugin
* INGROUP: MokoSuiteClient
* REPO: https://github.com/mokoconsulting-tech/mokosuiteclient
* VERSION: 02.44.00
* VERSION: 02.46.80
* PATH: /src/services/provider.php
* BRIEF: Service provider for dependency injection in Joomla 5.x
* NOTE: Registers the plugin with Joomla's DI container
@@ -8,7 +8,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>PLG_SYSTEM_MOKOSUITECLIENT_BACKUP_DESC</description>
<namespace path="src">Moko\Plugin\System\MokoSuiteClientBackup</namespace>
@@ -118,13 +118,11 @@ class Backup extends CMSPlugin implements SubscriberInterface
}
// Prefer MokoSuiteBackup's own helper (clean public API)
$helperClass = 'Joomla\\Component\\MokoSuiteBackup\\Administrator\\Utility\\BackupStatusHelper';
$helperClass = 'Joomla\\Component\\MokoSuiteBackup\\Administrator\\Helper\\BackupStatusHelper';
if (class_exists($helperClass))
{
$staleDays = (int) $this->params->get('stale_days', 7);
return $helperClass::getStatus($staleDays);
return $helperClass::getStatusSummary();
}
// Fallback: direct table query for older MokoSuiteBackup versions
@@ -244,20 +242,52 @@ class Backup extends CMSPlugin implements SubscriberInterface
? round($latest->total_size / 1048576)
: null;
// Total counts (all time)
$db->setQuery(
$db->getQuery(true)
->select('COUNT(*)')
->from($db->quoteName('#__mokosuitebackup_records'))
);
$allTime = (int) $db->loadResult();
$db->setQuery(
$db->getQuery(true)
->select('COUNT(*)')
->from($db->quoteName('#__mokosuitebackup_records'))
->where($db->quoteName('status') . ' = ' . $db->quote('fail'))
);
$allFailed = (int) $db->loadResult();
// Recent failures
$cutoff7d = date('Y-m-d H:i:s', strtotime('-7 days'));
$db->setQuery(
$db->getQuery(true)
->select('COUNT(*)')
->from($db->quoteName('#__mokosuitebackup_records'))
->where($db->quoteName('status') . ' = ' . $db->quote('fail'))
->where($db->quoteName('backupstart') . ' >= ' . $db->quote($cutoff7d))
);
$recentFailed = (int) $db->loadResult();
return [
'installed' => true,
'status' => $status,
'last_backup' => $latest->backupstart,
'last_status' => $latest->status,
'last_size_mb' => $sizeMb,
'days_since' => $daysSince,
'backup_type' => $latest->backup_type,
'origin' => $latest->origin,
'total_backups' => $totalBackups,
'recent_7d' => $recentBackups,
'fail_count_7d' => $failCount7d,
'files_exist' => (bool) $latest->filesexist,
'description' => $latest->description,
'installed' => true,
'latest' => [
'status' => $latest->status,
'backup_type' => $latest->backup_type ?? 'full',
'description' => $latest->description ?? '',
'backup_start' => $latest->backupstart,
'backup_end' => $latest->backupend ?? null,
'total_size' => (int) ($latest->total_size ?? 0),
'origin' => $latest->origin ?? 'backend',
],
'totals' => [
'all_time' => $allTime,
'all_success' => $totalBackups,
'all_failed' => $allFailed,
'recent_total' => $recentBackups + $recentFailed,
'recent_success' => $recentBackups,
'recent_failed' => $recentFailed,
],
];
}
}
@@ -8,7 +8,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>PLG_SYSTEM_MOKOSUITECLIENT_DBIP_DESC</description>
<namespace path="src">Moko\Plugin\System\MokoSuiteClientDBIP</namespace>
@@ -15,3 +15,14 @@ PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DELETE_VERSIONS_LABEL="Delete All Versions"
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DELETE_VERSIONS_DESC="One-shot: delete all content version history on save. Automatically turns off after execution."
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_RESET_DLKEYS_LABEL="Reset Download Keys"
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_RESET_DLKEYS_DESC="One-shot: clear all download keys (dlid) from update sites on save. Automatically turns off after execution."
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_FIELDSET_DEVDOMAIN="Dev Domain"
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_FIELDSET_DEVDOMAIN_DESC="Configure a development domain alias that bypasses offline mode and has its own robots settings."
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_ENABLED_LABEL="Enable Dev Domain"
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_ENABLED_DESC="Allow a development domain to bypass offline mode for testing."
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_LABEL="Dev Domain"
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_DESC="The development domain alias. Leave empty to auto-detect as dev.{primary_domain}. Must point to the same hosting folder."
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_BYPASS_LABEL="Bypass Offline Mode"
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_BYPASS_DESC="When the main site is offline, the dev domain stays accessible for development and testing."
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_ROBOTS_LABEL="Robots Directive"
PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_ROBOTS_DESC="Meta robots tag for the dev domain. Use noindex,nofollow to prevent search engines from indexing the dev site."
@@ -8,7 +8,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DESC</description>
<namespace path="src">Moko\Plugin\System\MokoSuiteClientDevTools</namespace>
@@ -61,6 +61,43 @@
<option value="0">JNO</option>
</field>
</fieldset>
<fieldset name="dev_domain"
label="PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_FIELDSET_DEVDOMAIN"
description="PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_FIELDSET_DEVDOMAIN_DESC">
<field name="dev_domain_enabled" type="radio" default="1"
label="PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_ENABLED_LABEL"
description="PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_ENABLED_DESC"
class="btn-group btn-group-yesno">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="dev_domain" type="text" default=""
label="PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_LABEL"
description="PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_DESC"
hint="dev.clientsite.com (auto-detected from primary domain if empty)"
showon="dev_domain_enabled:1" />
<field name="dev_domain_offline_bypass" type="radio" default="1"
label="PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_BYPASS_LABEL"
description="PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_BYPASS_DESC"
class="btn-group btn-group-yesno"
showon="dev_domain_enabled:1">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="dev_domain_robots" type="list" default="noindex, nofollow"
label="PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_ROBOTS_LABEL"
description="PLG_SYSTEM_MOKOSUITECLIENT_DEVTOOLS_DEVDOMAIN_ROBOTS_DESC"
showon="dev_domain_enabled:1">
<option value="noindex, nofollow">noindex, nofollow</option>
<option value="noindex">noindex</option>
<option value="index, follow">index, follow</option>
</field>
</fieldset>
</fields>
</config>
</extension>
@@ -8,7 +8,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>PLG_SYSTEM_MOKOSUITECLIENT_FIREWALL_DESC</description>
<namespace path="src">Moko\Plugin\System\MokoSuiteClientFirewall</namespace>
@@ -33,12 +33,17 @@
</languages>
<config>
<fields name="params">
<fields name="params"
addfieldprefix="Moko\Plugin\System\MokoSuiteClientFirewall\Field">
<!-- Network & Session -->
<fieldset name="basic"
label="PLG_SYSTEM_MOKOSUITECLIENT_FIREWALL_FIELDSET_BASIC"
description="PLG_SYSTEM_MOKOSUITECLIENT_FIREWALL_FIELDSET_BASIC_DESC">
<field name="current_ip_display" type="CurrentIp"
label="Your Current IP Address"
description="This is the IP address you are connecting from. Copy it to add to the Trusted IPs list below." />
<field name="force_https" type="radio" default="1"
label="PLG_SYSTEM_MOKOSUITECLIENT_FIREWALL_FORCE_HTTPS_LABEL"
description="PLG_SYSTEM_MOKOSUITECLIENT_FIREWALL_FORCE_HTTPS_DESC"
@@ -0,0 +1,42 @@
<?php
/**
* @package MokoSuiteClient
* @subpackage plg_system_mokosuiteclient_firewall
*/
namespace Moko\Plugin\System\MokoSuiteClientFirewall\Field;
defined('_JEXEC') or die;
use Joomla\CMS\Form\FormField;
/**
* Read-only field that displays the current user's IP address.
* Useful for quickly copying the IP to add to trusted IPs list.
*/
class CurrentIpField extends FormField
{
protected $type = 'CurrentIp';
protected function getInput(): string
{
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? '';
if (!empty($ip))
{
$ip = trim(explode(',', $ip)[0]);
}
if (empty($ip))
{
$ip = $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0';
}
return '<div class="d-flex align-items-center gap-2">'
. '<code style="font-size:1.1rem;padding:0.4rem 0.8rem;background:#f8f9fa;border:1px solid #dee2e6;border-radius:4px;" id="mokosuiteclient-current-ip">'
. htmlspecialchars($ip)
. '</code>'
. '<button type="button" class="btn btn-sm btn-outline-secondary" onclick="navigator.clipboard.writeText(document.getElementById(\'mokosuiteclient-current-ip\').textContent.trim()).then(function(){this.textContent=\'Copied!\';var b=this;setTimeout(function(){b.textContent=\'Copy\'},1500)}.bind(this))" title="Copy IP to clipboard">Copy</button>'
. '</div>';
}
}
@@ -8,7 +8,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>PLG_SYSTEM_MOKOSUITECLIENT_LICENSE_DESC</description>
<namespace path="src">Moko\Plugin\System\MokoSuiteClientLicense</namespace>
<files><folder>src</folder><folder>services</folder><folder>language</folder></files>
@@ -1,13 +0,0 @@
; MokoSuiteClient Health Monitor Plugin
; Copyright (C) 2026 Moko Consulting. All rights reserved.
; License: GPL-3.0-or-later
PLG_SYSTEM_MOKOSUITECLIENT_MONITOR="System - MokoSuiteClient Monitor"
PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_DESC="Sends heartbeat data to a MokoSuiteClientHQ control panel for centralized site monitoring."
PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_FIELDSET_BASIC="Monitoring"
PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_FIELDSET_BASIC_DESC="Configure heartbeat reporting to MokoSuiteClientHQ."
PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_HEARTBEAT_LABEL="Send Heartbeat"
PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_HEARTBEAT_DESC="Send heartbeat data to MokoSuiteClientHQ when plugin settings are saved."
PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_BASE_URL_LABEL="MokoSuiteClientHQ URL"
PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_BASE_URL_DESC="URL of the MokoSuiteClientHQ control panel (e.g. https://mokoconsulting.tech). The heartbeat is sent to /api/index.php/v1/mokosuiteclienthq/heartbeat on this host."
@@ -1,3 +0,0 @@
; MokoSuiteClient Health Monitor Plugin - System strings
PLG_SYSTEM_MOKOSUITECLIENT_MONITOR="System - MokoSuiteClient Monitor"
PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_DESC="Site health monitoring, MokoSuiteClientHQ heartbeat integration, and diagnostics."
@@ -1,52 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" group="system" method="upgrade">
<name>System - MokoSuiteClient Monitor</name>
<element>mokosuiteclient_monitor</element>
<author>Moko Consulting</author>
<creationDate>2026-06-02</creationDate>
<copyright>Copyright (C) 2026 Moko Consulting. All rights reserved.</copyright>
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<description>PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_DESC</description>
<namespace path="src">Moko\Plugin\System\MokoSuiteClientMonitor</namespace>
<files>
<folder>src</folder>
<folder>services</folder>
<folder>language</folder>
</files>
<languages folder="language">
<language tag="en-GB">en-GB/plg_system_mokosuiteclient_monitor.ini</language>
<language tag="en-GB">en-GB/plg_system_mokosuiteclient_monitor.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic"
label="PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_FIELDSET_BASIC"
description="PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_FIELDSET_BASIC_DESC">
<field name="heartbeat_enabled" type="radio" default="1"
label="PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_HEARTBEAT_LABEL"
description="PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_HEARTBEAT_DESC"
class="btn-group btn-group-yesno">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="base_url" type="url"
default="https://waas.dev.mokoconsulting.tech"
label="PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_BASE_URL_LABEL"
description="PLG_SYSTEM_MOKOSUITECLIENT_MONITOR_BASE_URL_DESC"
filter="url" />
<field name="signing_key" type="hidden"
default="LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tDQpNSUlFdmdJQkFEQU5CZ2txaGtpRzl3MEJBUUVGQUFTQ0JLZ3dnZ1NrQWdFQUFvSUJBUUMvcnVrWE0zZHB0aDg2DQpGSkRXTjM0ZjQ2cUtJem1SMmFtTWUyZ2dWbWxsWnFyMHJkRFk4OTdtQ05FRkk4Q0NwNGR5amkwOU5ETnAvalFxDQovL2JGdUFNOUFTZU5oQTlmRlpwSG5UMGkzY3N4V3RSS2NnMnRkR0wzUXhNRFVBeFJYQ1RSQXVPSWZybGp6Ky85DQpWZ0ZtWHU3M1VSaU9XY1lLeFErejFoZkRGK2ZxRTRlYW9QcUlsY2J5dmtKd2lkSkRWUEEwc2RtbVlUTFg2Q29xDQpQalVDRENlbkZoUXNteVMzM29KSXArK0c3ZzU5NmRYelZIczRQSjIwNnc0Z3JlckRRZk5GVytzZndHSnl3NjBrDQpUQTVmUzF2Wit4NEt2UUh6V1ErYS9xRS9sSGxFVzdOTWVJWExNWGczSDd1eXBabXlVU2t3S0k0djFQQXRGWmtkDQpBaVpPZWZpVkFnTUJBQUVDZ2dFQVI4VGJyVDR0NWJ5MDhIQW0wcTR3WVF4REhEbVlJbzNXdDZ5MURmYU11OVMzDQpDYW5TMm9oazJzaE9TcGhhU2hFajI3WjBKY2hYdjhYWURvbU1BZmVsN3I5eDZjQ2FhTVdUNEdCMU5Zckp1NDhBDQprV2NteTkwWitPNTZQZkZJeTJXdXV6dFRxaFdZb0ZDSTBOZlU2bGw5SzhpSFl6VWx1MzZSSklweWx5OXFPKyt4DQpmTUZYcUovSkk0bVp6NW0raDBnbFMvN21VZ0EvUTRjbVJ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Gk3cVl2VGxDZEtnYzZKeDgwdWJDWkErRjZIU2FGOWdyS0k5aTBaDQpjT3ltRnR2elBCOFZRQk1qY1E4Rk0yeVc3aUlrbmRsVEppdFE1aFU1NlFLQmdEZ1JIOXBEcGZwWlZ2V2g2MldGDQp5OGZzWUo1ODhzQmRMUlpTYTRuNi9XbjdUcUp1bWg2aWpFcDVyZFdnQkVtaDlJSk9jRUlhZ05mK0s5MXdoaThvDQpTeW01ajJpL1pjVVFYNFJSTDNxQ1RZZWVQVnZ3RHc3aWNLWVowTGQ2S1pFMmdEaDRPbEg4ejU0Zkl3a2tMSzRFDQpCcmtJNWppa05QSkJFR25zTm9zU3pWN2QNCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0NCg=="
filter="raw" />
</fieldset>
</fields>
</config>
</extension>
@@ -1,34 +0,0 @@
<?php
/**
* @package MokoSuiteClient
* @subpackage plg_system_mokosuiteclient_monitor
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
*/
defined('_JEXEC') or die;
use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Moko\Plugin\System\MokoSuiteClientMonitor\Extension\Monitor;
return new class implements ServiceProviderInterface
{
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new Monitor($dispatcher, (array) PluginHelper::getPlugin('system', 'mokosuiteclient_monitor'));
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};
@@ -1,353 +0,0 @@
<?php
/**
* @package MokoSuiteClient
* @subpackage plg_system_mokosuiteclient_monitor
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
*/
namespace Moko\Plugin\System\MokoSuiteClientMonitor\Extension;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Log\Log;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Version;
use Joomla\Event\SubscriberInterface;
use Moko\Plugin\System\MokoSuiteClient\Helper\MokoSuiteClientHelper;
/**
* MokoSuiteClient Health Monitor Plugin
*
* Sends heartbeat data to a MokoSuiteClientHQ control panel instance.
* Each request is RSA-signed with a private key distributed via
* the package manifest, verified by Base using the matching public key.
*
* @since 02.32.00
*/
class Monitor extends CMSPlugin implements SubscriberInterface
{
protected $autoloadLanguage = true;
public static function getSubscribedEvents(): array
{
return [
'onExtensionAfterSave' => 'onExtensionAfterSave',
'onAfterInitialise' => 'onAfterInitialise',
'onExtensionAfterInstall' => 'onExtensionAfterInstall',
];
}
/**
* Send heartbeat on first admin page load after install/update.
*/
public function onAfterInitialise(): void
{
$app = $this->getApplication();
if (!$app->isClient('administrator')) return;
if (!$this->params->get('heartbeat_enabled', 1)) return;
$session = \Joomla\CMS\Factory::getSession();
if ($session->get('mokosuiteclient.heartbeat_sent', false)) return;
// Check if version changed since last heartbeat
$lastVersion = $this->params->get('_last_heartbeat_version', '');
$currentVersion = $this->getMokoSuiteClientVersion();
if ($lastVersion !== $currentVersion)
{
$session->set('mokosuiteclient.heartbeat_sent', true);
$this->sendHeartbeat();
// Store version so we don't re-send every session
try
{
$this->params->set('_last_heartbeat_version', $currentVersion);
$extension = new \Joomla\CMS\Table\Extension(Factory::getDbo());
$extension->load(['element' => 'mokosuiteclient_monitor', 'folder' => 'system', 'type' => 'plugin']);
$extension->params = $this->params->toString();
$extension->store();
}
catch (\Throwable $e) {}
}
}
/**
* Send heartbeat immediately after package install/update.
*/
public function onExtensionAfterInstall($installer, $eid): void
{
if (!$this->params->get('heartbeat_enabled', 1)) return;
try { $this->sendHeartbeat(); }
catch (\Throwable $e) {}
}
/**
* After saving this plugin or the core plugin, send heartbeat.
*/
public function onExtensionAfterSave($event): void
{
// Joomla 6: single event object; Joomla 5: individual args
if (is_object($event) && method_exists($event, 'getArgument'))
{
$context = $event->getArgument('context', $event->getArgument(0, ''));
$table = $event->getArgument('subject', $event->getArgument(1, null));
}
else
{
$context = $event;
$table = func_get_arg(1);
}
if ($context !== 'com_plugins.plugin' || !$table)
{
return;
}
$element = $table->element ?? '';
if (!\in_array($element, ['mokosuiteclient', 'mokosuiteclient_monitor'], true))
{
return;
}
if (!$this->params->get('heartbeat_enabled', 1))
{
return;
}
$this->sendHeartbeat();
}
/**
* Send heartbeat to the MokoSuiteClientHQ control panel.
*
* The request is RSA-signed: the client signs domain|timestamp|token
* with its private key. Base verifies with the matching public key.
*/
private function sendHeartbeat(): void
{
$baseUrl = rtrim($this->params->get('base_url', ''), '/');
if (empty($baseUrl))
{
return;
}
$coreParams = MokoSuiteClientHelper::getCoreParams();
$healthToken = $coreParams->get('health_api_token', '');
if (empty($healthToken))
{
return;
}
$siteUrl = rtrim(Uri::root(), '/');
$domain = parse_url($siteUrl, PHP_URL_HOST) ?: '';
if (empty($domain))
{
return;
}
$app = $this->getApplication();
$config = Factory::getConfig();
$timestamp = time();
$payload = [
'token' => $healthToken,
'domain' => $domain,
'site_name' => $config->get('sitename', 'Joomla'),
'site_url' => $siteUrl,
'joomla_version' => (new Version())->getShortVersion(),
'php_version' => PHP_VERSION,
'mokosuiteclient_version' => $this->getMokoSuiteClientVersion(),
'timestamp' => $timestamp,
'client_info' => [
'company' => $config->get('sitename', ''),
'email' => $config->get('mailfrom', ''),
],
];
// Include live health data
$healthData = $this->fetchLocalHealth($siteUrl, $healthToken);
if ($healthData !== null)
{
$payload['health'] = $healthData;
}
// RSA sign the request
$headers = ['Content-Type: application/json'];
$signature = $this->signRequest($domain, $timestamp, $healthToken);
if ($signature !== null)
{
$headers[] = 'X-MokoSuite-Signature: ' . $signature;
$headers[] = 'X-MokoSuite-Timestamp: ' . $timestamp;
}
$endpoint = $baseUrl . '/api/index.php/v1/mokosuitehq/heartbeat';
$json = json_encode($payload, JSON_UNESCAPED_SLASHES);
try
{
$http = \Joomla\CMS\Http\HttpFactory::getHttp(
new \Joomla\Registry\Registry(['follow_location' => true, 'transport.curl' => ['certpath' => false]]),
['curl', 'stream']
);
$headerMap = [];
foreach ($headers as $h)
{
[$key, $val] = explode(': ', $h, 2);
$headerMap[$key] = $val;
}
$response = $http->post($endpoint, $json, $headerMap, 15);
$code = $response->code;
$body = json_decode($response->body, true);
if ($code >= 200 && $code < 300)
{
$app->enqueueMessage(
'MokoSuiteClientHQ heartbeat: ' . ($body['status'] ?? 'ok'),
'message'
);
}
else
{
Log::add(
\sprintf('Monitor heartbeat HTTP %d: %s', $code, $body['error'] ?? 'Unknown'),
Log::WARNING,
'mokosuiteclient'
);
$app->enqueueMessage(
'MokoSuiteClientHQ heartbeat failed (HTTP ' . $code . ')',
'warning'
);
}
}
catch (\Throwable $e)
{
Log::add('Monitor heartbeat failed: ' . $e->getMessage(), Log::WARNING, 'mokosuiteclient');
}
}
/**
* RSA-sign the request message.
*
* @param string $domain Site domain.
* @param int $timestamp Unix timestamp.
* @param string $token Health API token.
*
* @return string|null Base64-encoded signature, or null if signing fails.
*/
private function signRequest(string $domain, int $timestamp, string $token): ?string
{
$signingKeyB64 = $this->params->get('signing_key', '');
// Fall back to manifest XML default if not yet saved in params
if (empty($signingKeyB64))
{
$manifestFile = JPATH_PLUGINS . '/system/mokosuiteclient_monitor/mokosuiteclient_monitor.xml';
if (is_file($manifestFile))
{
$xml = simplexml_load_file($manifestFile);
if ($xml)
{
foreach ($xml->xpath('//field[@name="signing_key"]') as $field)
{
$signingKeyB64 = (string) $field['default'];
break;
}
}
}
}
if (empty($signingKeyB64))
{
return null;
}
$privateKeyPem = base64_decode($signingKeyB64);
if (empty($privateKeyPem))
{
return null;
}
$message = $domain . '|' . $timestamp . '|' . $token;
$privateKey = openssl_pkey_get_private($privateKeyPem);
if ($privateKey === false)
{
return null;
}
$signature = '';
if (openssl_sign($message, $signature, $privateKey, OPENSSL_ALGO_SHA256))
{
return base64_encode($signature);
}
return null;
}
/**
* Fetch health data from the local site's health endpoint.
*/
private function fetchLocalHealth(string $siteUrl, string $healthToken): ?array
{
try
{
$http = \Joomla\CMS\Http\HttpFactory::getHttp(
new \Joomla\Registry\Registry(['follow_location' => true, 'transport.curl' => ['certpath' => false]]),
['curl', 'stream']
);
$response = $http->get(
$siteUrl . '/?mokosuiteclient=health',
['Authorization' => 'Bearer ' . $healthToken, 'Accept' => 'application/json'],
10
);
if ($response->code !== 200 || empty($response->body))
{
return null;
}
return json_decode($response->body, true) ?: null;
}
catch (\Throwable $e)
{
return null;
}
}
/**
* Get the installed MokoSuiteClient package version.
*/
private function getMokoSuiteClientVersion(): string
{
try
{
$extension = new \Joomla\CMS\Table\Extension(Factory::getDbo());
$extension->load(['element' => 'pkg_mokosuiteclient', 'type' => 'package']);
$manifest = json_decode($extension->manifest_cache ?? '{}');
return $manifest->version ?? '';
}
catch (\Throwable $e)
{
return '';
}
}
}
@@ -8,7 +8,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>PLG_SYSTEM_MOKOSUITECLIENT_OFFLINE_DESC</description>
<namespace path="src">Moko\Plugin\System\MokoSuiteClientOffline</namespace>
@@ -8,7 +8,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>PLG_SYSTEM_MOKOSUITECLIENT_TENANT_DESC</description>
<namespace path="src">Moko\Plugin\System\MokoSuiteClientTenant</namespace>
@@ -8,7 +8,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>Runs scheduled helpdesk automation rules — auto-close resolved tickets, SLA breach escalation, and time-based actions.</description>
<namespace path="src">Moko\Plugin\Task\MokoSuiteClientTickets</namespace>
@@ -38,6 +38,14 @@ class TicketAutomation extends CMSPlugin implements SubscriberInterface
'langConstPrefix' => 'PLG_TASK_MOKOSUITECLIENT_TICKETS_AUTOCLOSE',
'method' => 'runAutoClose',
],
'mokosuiteclient.license.validate' => [
'langConstPrefix' => 'PLG_TASK_MOKOSUITECLIENT_LICENSE_VALIDATE',
'method' => 'runLicenseValidation',
],
'mokosuiteclient.license.heartbeat' => [
'langConstPrefix' => 'PLG_TASK_MOKOSUITECLIENT_LICENSE_HEARTBEAT',
'method' => 'runLicenseHeartbeat',
],
];
protected $autoloadLanguage = true;
@@ -310,4 +318,50 @@ class TicketAutomation extends CMSPlugin implements SubscriberInterface
return trim($textBody);
}
/**
* Daily license revalidation — refresh cached license status from MokoGitea.
* Recommended schedule: daily at 3:00 AM.
*/
private function runLicenseValidation(ExecuteTaskEvent $event): int
{
try {
$result = \Moko\Plugin\System\MokoSuiteClient\Helper\LicenseValidator::validate(true);
$status = $result->valid ? 'valid' : ($result->status ?? 'invalid');
$tier = $result->tier ?? 'none';
$entitlements = count($result->entitlements ?? []);
$this->logTask(sprintf(
'License validation: status=%s tier=%s entitlements=%d',
$status, $tier, $entitlements
));
if (!$result->valid) {
Log::add('License validation failed: ' . ($result->message ?? 'unknown'), Log::WARNING, 'mokosuite.license');
}
return Status::OK;
} catch (\Throwable $e) {
$this->logTask('License validation error: ' . $e->getMessage());
return Status::KNOCKOUT;
}
}
/**
* Daily heartbeat — report active installation to MokoGitea.
* Recommended schedule: daily at 4:00 AM.
*/
private function runLicenseHeartbeat(ExecuteTaskEvent $event): int
{
try {
$result = \Moko\Plugin\System\MokoSuiteClient\Helper\LicenseValidator::heartbeat();
$this->logTask('License heartbeat: ' . ($result->success ?? false ? 'sent' : ($result->error ?? 'failed')));
return Status::OK;
} catch (\Throwable $e) {
$this->logTask('License heartbeat error: ' . $e->getMessage());
return Status::KNOCKOUT;
}
}
}
@@ -12,7 +12,7 @@
<license>GNU General Public License version 3 or later; see LICENSE</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>PLG_TASK_MOKOSUITECLIENTDEMO_DESC</description>
<namespace path="src">Moko\Plugin\Task\MokoSuiteClientDemo</namespace>
@@ -10,7 +10,7 @@
* INGROUP: MokoSuiteClient
* REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoSuiteClient
* PATH: /src/packages/plg_system_mokosuiteclient/Service/DemoResetService.php
* VERSION: 02.44.00
* VERSION: 02.46.80
* BRIEF: Content-only snapshot/restore for demo site reset
*/
@@ -12,7 +12,7 @@
<license>GNU General Public License version 3 or later; see LICENSE</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>PLG_TASK_MOKOSUITECLIENTSYNC_DESC</description>
<namespace path="src">Moko\Plugin\Task\MokoSuiteClientSync</namespace>
@@ -10,7 +10,7 @@
* INGROUP: MokoSuiteClient
* REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoSuiteClient
* PATH: /src/packages/plg_system_mokosuiteclient/Service/ContentSyncReceiver.php
* VERSION: 02.44.00
* VERSION: 02.46.80
* BRIEF: Receiver-side content sync — applies incoming payload to local DB
*/
@@ -10,7 +10,7 @@
* INGROUP: MokoSuiteClient
* REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoSuiteClient
* PATH: /src/packages/plg_system_mokosuiteclient/Service/ContentSyncService.php
* VERSION: 02.44.00
* VERSION: 02.46.80
* BRIEF: Sender-side content sync — builds payload and pushes to remote sites
*/
@@ -7,7 +7,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>02.44.00</version>
<version>02.46.80</version>
<description>Joomla Web Services API routes for MokoSuiteClient site management — health checks, cache, updates, backups, and site info.</description>
<namespace path="src">Moko\Plugin\WebServices\MokoSuiteClient</namespace>
<files>
+1 -2
View File
@@ -2,7 +2,7 @@
<extension type="package" method="upgrade">
<name>Package - MokoSuiteClient</name>
<packagename>mokosuiteclient</packagename>
<version>02.44.00</version>
<version>02.46.80</version>
<creationDate>2026-06-02</creationDate>
<author>Moko Consulting</author>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
@@ -25,7 +25,6 @@
<file type="module" id="mod_mokosuiteclient_menu" client="administrator">mod_mokosuiteclient_menu.zip</file>
<file type="module" id="mod_mokosuiteclient_cache" client="administrator">mod_mokosuiteclient_cache.zip</file>
<file type="module" id="mod_mokosuiteclient_categories" client="administrator">mod_mokosuiteclient_categories.zip</file>
<file type="plugin" id="plg_system_mokosuiteclient_backup" group="system">plg_system_mokosuiteclient_backup.zip</file>
<file type="plugin" id="plg_webservices_mokosuiteclient" group="webservices">plg_webservices_mokosuiteclient.zip</file>
<file type="plugin" id="plg_task_mokosuiteclientdemo" group="task">plg_task_mokosuiteclientdemo.zip</file>
<file type="plugin" id="plg_task_mokosuiteclientsync" group="task">plg_task_mokosuiteclientsync.zip</file>
+237 -15
View File
@@ -46,6 +46,9 @@ class Pkg_MokosuiteclientInstallerScript
{
$this->saveDownloadKey();
// Joomla's package installer INSERTs extension rows without element first.
// MySQL strict mode requires a default. Set DEFAULT '' so the INSERT succeeds,
// then postflight cleans up the empty-element rows and stale files.
try
{
$db = Factory::getDbo();
@@ -55,12 +58,16 @@ class Pkg_MokosuiteclientInstallerScript
}
catch (\Throwable $e)
{
// Non-fatal — column may already have a default
// Non-fatal
}
}
/** @var \Joomla\CMS\Installer\InstallerAdapter|null */
private $installerParent = null;
public function postflight($type, $parent)
{
$this->installerParent = $parent;
// Migrate MokoWaaS database tables to MokoSuiteClient naming
$this->migrateWaasTables();
@@ -82,7 +89,6 @@ class Pkg_MokosuiteclientInstallerScript
$this->enablePlugin('system', 'mokosuiteclient_devtools');
$this->enablePlugin('system', 'mokosuiteclient_offline');
$this->enablePlugin('system', 'mokosuiteclient_dbip');
$this->enablePlugin('system', 'mokosuiteclient_backup');
$this->enablePlugin('webservices', 'mokosuiteclient');
$this->enablePlugin('task', 'mokosuiteclientdemo');
$this->enablePlugin('task', 'mokosuiteclientsync');
@@ -109,21 +115,15 @@ class Pkg_MokosuiteclientInstallerScript
// Set up MokoSuiteClient guided tours and unpublish Joomla defaults
$this->setupGuidedTours();
// Clean up orphaned empty-element rows and stale files from old DEFAULT '' bug
$this->cleanupEmptyElements();
// Mark MokoSuiteClient extensions as protected (prevents disable/uninstall at framework level)
$this->protectExtensions();
// Migrate all Moko update server URLs to new format
$this->migrateUpdateServerUrls();
// Clean up stale/duplicate update sites
$this->cleanupStaleUpdateSites();
// Restore download key saved in preflight
$this->restoreDownloadKey();
// Fix orphaned update records (extension_id=0)
$this->fixUpdateRecords();
// Trigger heartbeat registration
$this->sendHeartbeat();
@@ -464,6 +464,16 @@ class Pkg_MokosuiteclientInstallerScript
{
try
{
// Only enable if the plugin files actually exist on disk
$pluginDir = JPATH_PLUGINS . '/' . $group . '/' . $element;
if (!is_dir($pluginDir))
{
Log::add('Skipping enable for ' . $group . '/' . $element . ' — files not installed', Log::DEBUG, 'mokosuiteclient');
return;
}
$db = Factory::getDbo();
$query = $db->getQuery(true)
->update($db->quoteName('#__extensions'))
@@ -497,6 +507,60 @@ class Pkg_MokosuiteclientInstallerScript
if ($db->getAffectedRows() > 0)
{
Log::add('Fixed empty element for plugin ' . $group . '/' . $element, Log::NOTICE, 'mokosuiteclient');
return;
}
// Verify no row exists before inserting (prevent duplicates)
$db->setQuery(
$db->getQuery(true)
->select('COUNT(*)')
->from($db->quoteName('#__extensions'))
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
->where($db->quoteName('folder') . ' = ' . $db->quote($group))
->where($db->quoteName('element') . ' = ' . $db->quote($element))
);
if ((int) $db->loadResult() > 0)
{
return;
}
// No row exists — create one from the manifest XML on disk
$manifestFile = $pluginDir . '/' . $element . '.xml';
if (is_file($manifestFile))
{
$xml = @simplexml_load_file($manifestFile);
$name = $xml ? (string) ($xml->name ?? $manifestName) : $manifestName;
$namespace = $xml ? (string) ($xml->namespace ?? '') : '';
$row = (object) [
'name' => $name,
'type' => 'plugin',
'element' => $element,
'folder' => $group,
'client_id' => 0,
'enabled' => 1,
'access' => 1,
'protected' => 0,
'locked' => 0,
'params' => '{}',
'manifest_cache' => '{}',
'custom_data' => '',
'state' => 0,
'ordering' => 0,
'checked_out' => null,
'checked_out_time' => null,
];
if (!empty($namespace))
{
$row->namespace = $namespace;
}
$db->insertObject('#__extensions', $row, 'extension_id');
Log::add('Created extension record for plugin ' . $group . '/' . $element, Log::INFO, 'mokosuiteclient');
}
}
catch (\Throwable $e)
@@ -515,6 +579,162 @@ class Pkg_MokosuiteclientInstallerScript
*
* @since 02.03.10
*/
private function cleanupEmptyElements(): void
{
try
{
$db = Factory::getDbo();
// 1. Delete orphaned MokoSuiteClient extension rows with empty element
$db->setQuery("DELETE FROM " . $db->quoteName('#__extensions')
. " WHERE " . $db->quoteName('element') . " = ''"
. " AND " . $db->quoteName('type') . " = " . $db->quote('plugin')
. " AND " . $db->quoteName('name') . " LIKE " . $db->quote('%MokoSuiteClient%'));
$db->execute();
$deleted = $db->getAffectedRows();
// Delete rows where element is the display name (spaces)
$db->setQuery(
$db->getQuery(true)
->delete($db->quoteName('#__extensions'))
->where($db->quoteName('element') . ' LIKE ' . $db->quote('% %'))
->where($db->quoteName('element') . ' LIKE ' . $db->quote('%mokosuiteclient%'))
);
$db->execute();
$deleted += $db->getAffectedRows();
if ($deleted > 0)
{
Log::add("Deleted {$deleted} orphaned plugin row(s)", Log::INFO, 'mokosuiteclient');
}
// Deduplicate: keep only the lowest extension_id per element+folder
$db->setQuery(
"DELETE e1 FROM " . $db->quoteName('#__extensions') . " e1"
. " INNER JOIN " . $db->quoteName('#__extensions') . " e2"
. " ON e1.element = e2.element AND e1.folder = e2.folder AND e1.type = e2.type"
. " AND e1.extension_id > e2.extension_id"
. " WHERE e1.element LIKE 'mokosuiteclient%' AND e1.type = 'plugin'"
);
$db->execute();
$deduped = $db->getAffectedRows();
if ($deduped > 0)
{
Log::add("Removed {$deduped} duplicate extension row(s)", Log::INFO, 'mokosuiteclient');
}
// 2. Clean up stale plugin files that leaked to group roots
$groupDirs = [JPATH_PLUGINS . '/system', JPATH_PLUGINS . '/task', JPATH_PLUGINS . '/webservices'];
foreach ($groupDirs as $groupDir)
{
foreach (['services', 'src', 'language'] as $dir)
{
$path = $groupDir . '/' . $dir;
if (is_dir($path))
{
$this->rmdirRecursive($path);
}
}
// Remove stale manifest XMLs at group root
foreach (glob($groupDir . '/mokosuiteclient*.xml') ?: [] as $staleXml)
{
@unlink($staleXml);
}
// Remove dirs with spaces (Joomla uses display name as dir)
foreach (glob($groupDir . '/*mokosuiteclient*', GLOB_ONLYDIR) ?: [] as $badDir)
{
if (strpos(basename($badDir), ' ') !== false)
{
$this->rmdirRecursive($badDir);
}
}
}
// 3. Reinstall plugins that are missing their directory
$this->reinstallBrokenPlugins();
}
catch (\Throwable $e)
{
Log::add('Empty element cleanup error: ' . $e->getMessage(), Log::WARNING, 'mokosuiteclient');
}
}
/**
* Reinstall plugins whose files are missing from disk.
*
* Uses the sub-extension zip files from the package source directory
* (still available during postflight) to reinstall any plugin that
* doesn't have its directory on disk.
*/
private function reinstallBrokenPlugins(): void
{
if (!$this->installerParent)
{
return;
}
try
{
$installer = $this->installerParent->getParent();
$sourceDir = $installer->getPath('source');
if (empty($sourceDir) || !is_dir($sourceDir . '/packages'))
{
return;
}
// Plugins that should exist on disk
$expected = [
'system' => ['mokosuiteclient_offline', 'mokosuiteclient_firewall', 'mokosuiteclient_tenant', 'mokosuiteclient_devtools', 'mokosuiteclient_dbip'],
'task' => ['mokosuiteclient_tickets'],
];
foreach ($expected as $group => $elements)
{
foreach ($elements as $element)
{
$pluginDir = JPATH_PLUGINS . '/' . $group . '/' . $element;
if (is_dir($pluginDir))
{
continue; // Already installed correctly
}
$zipName = 'plg_' . $group . '_' . $element . '.zip';
$zipPath = $sourceDir . '/packages/' . $zipName;
if (!is_file($zipPath))
{
continue;
}
// Extract the zip to the correct plugin directory
$zip = new \ZipArchive();
if ($zip->open($zipPath) !== true)
{
continue;
}
@mkdir($pluginDir, 0755, true);
$zip->extractTo($pluginDir);
$zip->close();
Log::add("Reinstalled {$group}/{$element} from package zip", Log::INFO, 'mokosuiteclient');
}
}
}
catch (\Throwable $e)
{
Log::add('Plugin reinstall error: ' . $e->getMessage(), Log::WARNING, 'mokosuiteclient');
}
}
private function protectExtensions(): void
{
try
@@ -535,7 +755,6 @@ class Pkg_MokosuiteclientInstallerScript
$db->quote('mokosuiteclientdemo'),
$db->quote('mokosuiteclientsync'),
$db->quote('mokosuiteclient_tickets'),
$db->quote('mokosuiteclient_backup'),
$db->quote('mokoonyx'),
];
@@ -547,8 +766,6 @@ class Pkg_MokosuiteclientInstallerScript
$db->setQuery($query);
$db->execute();
// Ensure update server stays enabled
$this->enableUpdateServer();
}
catch (\Throwable $e)
{
@@ -970,19 +1187,24 @@ class Pkg_MokosuiteclientInstallerScript
if ($error)
{
Log::add('Heartbeat connection failed: ' . $error, Log::WARNING, 'mokosuiteclient');
Factory::getApplication()->enqueueMessage('MokoSuiteHQ heartbeat failed: ' . $error, 'warning');
}
elseif ($code >= 200 && $code < 300)
{
Factory::getApplication()->enqueueMessage('MokoSuiteClientHQ heartbeat: site registered', 'message');
Factory::getApplication()->enqueueMessage('MokoSuiteHQ heartbeat: site registered successfully.', 'message');
}
else
{
$body = json_decode($response, true);
$msg = $body['error'] ?? $body['message'] ?? ('HTTP ' . $code);
Log::add(sprintf('Heartbeat HTTP %d: %s', $code, $response), Log::WARNING, 'mokosuiteclient');
Factory::getApplication()->enqueueMessage('MokoSuiteHQ heartbeat failed: ' . $msg, 'warning');
}
}
catch (\Throwable $e)
{
Log::add('Heartbeat failed: ' . $e->getMessage(), Log::WARNING, 'mokosuiteclient');
Factory::getApplication()->enqueueMessage('MokoSuiteHQ heartbeat failed: ' . $e->getMessage(), 'warning');
}
}