From 6f3d49e058b306328bc819a8d9f6cc4f8644d527 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Mon, 6 Jul 2026 11:19:36 -0500 Subject: [PATCH 1/2] fix: honest installer success (gate license/next-steps on child install) The package postflight showed the "License Key Required" / next-steps message even when a bundled child extension failed to sub-install (Joomla only logs those failures). Add a fail-open manifest verifier (missingChildExtensions) that confirms every declared child landed in #__extensions and enqueues an error + returns before the license path when any are missing. Fails open so a transient glitch never fakes a failure. Claude-Session: https://claude.ai/code/session_01B9aZHSWbiiZykJD88pYx8R --- CHANGELOG.md | 3 ++ source/script.php | 95 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88cd533..300d902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ ## [Unreleased] +### Fixed +- **Honest install success** — the package installer no longer shows the license / next-steps message when a bundled child extension failed to install. A fail-open manifest verifier confirms every child extension landed in `#__extensions` and reports any that are missing. + ### Added - **Package Manifest** — `pkg_mokosuitesight.xml` with dlid and updateservers - **Plugin Manifest** — `mokosuitesight.xml` with config fieldsets (auto-refresh, max dashboards) diff --git a/source/script.php b/source/script.php index 506ec44..58ada2a 100644 --- a/source/script.php +++ b/source/script.php @@ -19,9 +19,104 @@ class Pkg_MokoSuiteInsightInstallerScript { public function postflight(string $type, InstallerAdapter $adapter): void { + // Be honest about success. Joomla's package installer only LOGS a failed child + // sub-install but still runs this postflight, so don't show the license / + // next-steps message if a bundled extension is actually missing. Fails open + // (see missingChildExtensions) so a query/IO glitch never fakes a failure. + $missing = $this->missingChildExtensions($adapter); + + if (!empty($missing)) + { + Factory::getApplication()->enqueueMessage( + '

MokoSuiteInsight did not install correctly.

' + . '

The following bundled extensions are missing: ' + . htmlspecialchars(implode(', ', $missing), ENT_QUOTES) . '

' + . '

Please uninstall MokoSuiteInsight and reinstall the full package.

', + 'error' + ); + + return; + } + $this->warnMissingLicenseKey(); } + /** + * Verify every child extension declared in the package manifest actually landed in + * #__extensions. Returns readable labels of any that are missing. + * + * Matching per Joomla's #__extensions uniqueness: type = "type"; element = + * "id" (for plugins, strip a leading plg__); plugins also match + * folder = "group". + * + * FAILS OPEN: any error returns [] so a transient glitch never fakes a failure. + */ + private function missingChildExtensions($adapter): array + { + try + { + $manifest = $adapter->getParent()->getManifest(); + + if (!$manifest || !isset($manifest->files) || !isset($manifest->files->file)) + { + return []; + } + + $db = Factory::getDbo(); + $missing = []; + + foreach ($manifest->files->file as $file) + { + $attrs = $file->attributes(); + $id = isset($attrs['id']) ? (string) $attrs['id'] : ''; + $exType = isset($attrs['type']) ? (string) $attrs['type'] : ''; + + if ($id === '' || $exType === '') + { + continue; + } + + $group = isset($attrs['group']) ? (string) $attrs['group'] : ''; + $element = $id; + + // Plugin element in #__extensions is the id minus any leading plg__. + if ($exType === 'plugin' && $group !== '') + { + $prefix = 'plg_' . $group . '_'; + + if (strpos($element, $prefix) === 0) + { + $element = substr($element, \strlen($prefix)); + } + } + + $query = $db->getQuery(true) + ->select('COUNT(*)') + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('element') . ' = ' . $db->quote($element)) + ->where($db->quoteName('type') . ' = ' . $db->quote($exType)); + + if ($exType === 'plugin' && $group !== '') + { + $query->where($db->quoteName('folder') . ' = ' . $db->quote($group)); + } + + if ((int) $db->setQuery($query)->loadResult() === 0) + { + $label = trim((string) $file); + $missing[] = $label !== '' ? preg_replace('/\.zip$/i', '', $label) : $id; + } + } + + return $missing; + } + catch (\Throwable $e) + { + // Fail open — never fake a failure on a glitch. + return []; + } + } + private function warnMissingLicenseKey(): void { try From 2593aa737c653141210d0d75aa769e6fb5630e7e Mon Sep 17 00:00:00 2001 From: "gitea-actions[bot]" Date: Mon, 6 Jul 2026 16:20:36 +0000 Subject: [PATCH 2/2] chore(version): pre-release bump to 01.00.34-dev [skip ci] --- .mokogitea/workflows/issue-branch.yml | 2 +- CODE_OF_CONDUCT.md | 2 +- GOVERNANCE.md | 2 +- SECURITY.md | 2 +- source/packages/com_mokosuitesight/mokosuitesight.xml | 2 +- source/packages/plg_system_mokosuitesight/mokosuitesight.xml | 2 +- .../packages/plg_webservices_mokosuitesight/mokosuitesight.xml | 2 +- source/pkg_mokosuitesight.xml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.mokogitea/workflows/issue-branch.yml b/.mokogitea/workflows/issue-branch.yml index 8c665ee..c1ca9f4 100644 --- a/.mokogitea/workflows/issue-branch.yml +++ b/.mokogitea/workflows/issue-branch.yml @@ -5,7 +5,7 @@ # FILE INFORMATION # DEFGROUP: Gitea.Workflow # INGROUP: mokocli.Automation -# VERSION: 01.00.33 +# VERSION: 01.00.34 # BRIEF: Auto-create feature branch when an issue is opened name: "Universal: Issue Branch" diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index e6459fd..6fb756a 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -14,7 +14,7 @@ DEFGROUP: Template-Joomla INGROUP: Template-Joomla.Documentation REPO: https://github.com/mokoconsulting-tech/Template-Joomla/ - VERSION: 01.00.33 + VERSION: 01.00.34 PATH: ./CODE_OF_CONDUCT.md BRIEF: Community expectations and enforcement guidelines NOTE: Adapted with attribution from the Contributor Covenant v2.1 diff --git a/GOVERNANCE.md b/GOVERNANCE.md index a9eddc3..22d8bfc 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -19,7 +19,7 @@ DEFGROUP: mokoconsulting-tech.Template-Joomla INGROUP: MokoStandards.Governance REPO: https://github.com/mokoconsulting-tech/Template-Joomla - VERSION: 01.00.33 + VERSION: 01.00.34 PATH: /GOVERNANCE.md BRIEF: Project governance rules, roles, and decision process for Template-Joomla --> diff --git a/SECURITY.md b/SECURITY.md index 11cf069..a4e6127 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -23,7 +23,7 @@ DEFGROUP: Template-Joomla INGROUP: Template-Joomla.Documentation REPO: https://git.mokoconsulting.tech/MokoConsulting/Template-Joomla PATH: /SECURITY.md -VERSION: 01.00.33 +VERSION: 01.00.34 BRIEF: Security vulnerability reporting and handling policy --> diff --git a/source/packages/com_mokosuitesight/mokosuitesight.xml b/source/packages/com_mokosuitesight/mokosuitesight.xml index 12b032b..4f7aa66 100644 --- a/source/packages/com_mokosuitesight/mokosuitesight.xml +++ b/source/packages/com_mokosuitesight/mokosuitesight.xml @@ -5,7 +5,7 @@ 2026-06-23 Copyright (C) 2026 Moko Consulting. GPL-3.0-or-later - 01.00.33 + 01.00.34 Moko\Component\MokoSuiteSight servicessrctmpl diff --git a/source/packages/plg_system_mokosuitesight/mokosuitesight.xml b/source/packages/plg_system_mokosuitesight/mokosuitesight.xml index f0bfba3..50d33d2 100644 --- a/source/packages/plg_system_mokosuitesight/mokosuitesight.xml +++ b/source/packages/plg_system_mokosuitesight/mokosuitesight.xml @@ -8,7 +8,7 @@ GPL-3.0-or-later hello@mokoconsulting.tech https://mokoconsulting.tech - 01.00.33 + 01.00.34 8.3 PLG_SYSTEM_MOKOSUITESIGHT_DESC Moko\Plugin\System\MokoSuiteSight diff --git a/source/packages/plg_webservices_mokosuitesight/mokosuitesight.xml b/source/packages/plg_webservices_mokosuitesight/mokosuitesight.xml index 1ac816f..203da0b 100644 --- a/source/packages/plg_webservices_mokosuitesight/mokosuitesight.xml +++ b/source/packages/plg_webservices_mokosuitesight/mokosuitesight.xml @@ -3,7 +3,7 @@ Web Services - MokoSuite Insight mokosuitesight Moko Consulting - 01.00.33 + 01.00.34 GPL-3.0-or-later Moko\Plugin\WebServices\MokoSuiteInsight srcservices diff --git a/source/pkg_mokosuitesight.xml b/source/pkg_mokosuitesight.xml index b67082a..15b5c1d 100644 --- a/source/pkg_mokosuitesight.xml +++ b/source/pkg_mokosuitesight.xml @@ -2,7 +2,7 @@ Package - MokoSuite Insight mokosuitesight - 01.00.33 + 01.00.34 2026-06-21 Moko Consulting hello@mokoconsulting.tech