Compare commits

..

8 Commits

Author SHA1 Message Date
gitea-actions[bot] dd7b089d30 chore(version): pre-release bump to 06.00.24-dev [skip ci] 2026-07-06 22:42:25 +00:00
gitea-actions[bot] 2585d54018 chore(version): pre-release bump to 06.00.23-dev [skip ci] 2026-07-06 22:41:25 +00:00
gitea-actions[bot] 9309500fe5 chore(version): pre-release bump to 06.00.22-dev [skip ci] 2026-07-06 22:40:56 +00:00
jmiller 552d31aaec feat(menu): use COM_MOKOSUITEFIELD_SHORT for admin menu label (#44)
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
Universal: PR Check / Secret Scan (pull_request) Successful in 5s
Universal: PR Check / Validate PR (pull_request) Failing after 4s
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Successful in 11s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 12s
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Claude-Session: https://claude.ai/code/session_01B9aZHSWbiiZykJD88pYx8R
2026-07-06 22:37:54 +00:00
jmiller 8167223c92 feat(menu): add COM_MOKOSUITEFIELD_SHORT short-name constant (#44)
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 11s
Claude-Session: https://claude.ai/code/session_01B9aZHSWbiiZykJD88pYx8R
2026-07-06 22:37:41 +00:00
jmiller b3bb63c8dc Merge pull request 'fix: honest installer success' (#46) from fix/honest-install-success into dev
Universal: Auto Version Bump / Version Bump (push) Has been skipped
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 20s
2026-07-06 16:23:12 +00:00
gitea-actions[bot] 4212ce1ded chore(version): pre-release bump to 06.00.21-dev [skip ci]
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Branch Cleanup / Delete merged branch (pull_request) Successful in 2s
2026-07-06 16:20:48 +00:00
jmiller 0e3c922b7a fix: honest installer success (gate license/next-steps on child install)
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
Universal: PR Check / Validate PR (pull_request) Failing after 5s
Universal: PR Check / Secret Scan (pull_request) Successful in 5s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 12s
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Successful in 31s
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
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
2026-07-06 11:19:37 -05:00
8 changed files with 67 additions and 134 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
# FILE INFORMATION
# DEFGROUP: Gitea.Workflow
# INGROUP: mokocli.Automation
# VERSION: 06.00.19
# VERSION: 06.00.24
# BRIEF: Auto-create feature branch when an issue is opened
name: "Universal: Issue Branch"
+3
View File
@@ -11,6 +11,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
- **Repository** -- initial repo creation with scaffolding
- **System Plugin** -- Extension class, service provider
@@ -3,6 +3,7 @@
; Authored-by: Moko Consulting
COM_MOKOSUITEFIELD="MokoSuite Field"
COM_MOKOSUITEFIELD_SHORT="Field"
COM_MOKOSUITEFIELD_DESCRIPTION="Field service management for contractors."
COM_MOKOSUITEFIELD_MENU_DASHBOARD="Dashboard"
COM_MOKOSUITEFIELD_MENU_WORKORDERS="Work Orders"
@@ -5,10 +5,10 @@
<creationDate>2026-06-27</creationDate>
<copyright>Copyright (C) 2026 Moko Consulting.</copyright>
<license>GPL-3.0-or-later</license>
<version>06.00.19</version>
<version>06.00.24</version>
<namespace path="src">Moko\Component\MokoSuiteField</namespace>
<administration>
<files folder="admin"><folder>services</folder><folder>src</folder><folder>tmpl</folder></files>
<menu>COM_MOKOSUITEFIELD</menu>
<menu>COM_MOKOSUITEFIELD_SHORT</menu>
</administration>
</extension>
@@ -8,7 +8,7 @@
<license>GPL-3.0-or-later</license>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
<authorUrl>https://mokoconsulting.tech</authorUrl>
<version>06.00.19</version>
<version>06.00.24</version>
<php_minimum>8.3</php_minimum>
<description>PLG_SYSTEM_MOKOSUITEFIELD_DESC</description>
<namespace path="src">Moko\Plugin\System\MokoSuiteField</namespace>
@@ -3,7 +3,7 @@
<name>Web Services - MokoSuite Field</name>
<element>mokosuitefield</element>
<author>Moko Consulting</author>
<version>06.00.19</version>
<version>06.00.24</version>
<license>GPL-3.0-or-later</license>
<namespace path="src">Moko\Plugin\WebServices\MokoSuiteField</namespace>
<files><folder>src</folder><folder>services</folder></files>
+1 -1
View File
@@ -2,7 +2,7 @@
<extension type="package" method="upgrade">
<name>Package - MokoSuite Field</name>
<packagename>mokosuitefield</packagename>
<version>06.00.19</version>
<version>06.00.24</version>
<creationDate>2026-06-27</creationDate>
<author>Moko Consulting</author>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
+57 -128
View File
@@ -1,10 +1,9 @@
<?php
/**
* MokoSuite Field Package Install Script
*
* @package MokoSuite Field
* @package MokoSuiteField
* @subpackage pkg_mokosuitefield
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GPL-3.0-or-later
* @license GNU General Public License version 3 or later; see LICENSE
*/
defined('_JEXEC') or die;
@@ -12,99 +11,97 @@ defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Log\Log;
use Joomla\Database\DatabaseInterface;
class Pkg_MokoSuiteFieldInstallerScript
{
private string $savedDlid = '';
public function preflight(string $type, InstallerAdapter $adapter): bool
{
if ($type === 'update')
{
$this->savedDlid = $this->getExistingDlid();
}
return true;
}
public function postflight(string $type, InstallerAdapter $adapter): void
{
if ($this->savedDlid)
// 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))
{
$this->restoreDlid($this->savedDlid);
}
Factory::getApplication()->enqueueMessage(
'<h4>MokoSuiteField did not install correctly.</h4>'
. '<p>The following bundled extensions are missing: '
. htmlspecialchars(implode(', ', $missing), ENT_QUOTES) . '</p>'
. '<p>Please uninstall MokoSuiteField and reinstall the full package.</p>',
'error'
);
if ($type === 'install')
{
$missing = $this->verifyChildren($adapter);
if (!empty($missing))
{
Factory::getApplication()->enqueueMessage(
'<strong>MokoSuite Field — Incomplete Installation</strong><br>'
. 'The following extensions failed to install: '
. implode(', ', $missing)
. '.<br>Please check file permissions and server logs, then reinstall the package.',
'error'
);
return;
}
$this->enablePlugin('system', 'mokosuitefield');
$this->enablePlugin('webservices', 'mokosuitefield');
return;
}
$this->warnMissingLicenseKey();
}
private function verifyChildren(InstallerAdapter $adapter): array
/**
* 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 = <file> "type"; element =
* <file> "id" (for plugins, strip a leading plg_<group>_); plugins also match
* folder = <file> "group".
*
* FAILS OPEN: any error returns [] so a transient glitch never fakes a failure.
*/
private function missingChildExtensions($adapter): array
{
try
{
$manifest = $adapter->getParent()->getManifest();
$files = $manifest->files->file ?? [];
if (!$files)
if (!$manifest || !isset($manifest->files) || !isset($manifest->files->file))
{
return [];
}
$db = Factory::getContainer()->get(DatabaseInterface::class);
$db = Factory::getDbo();
$missing = [];
foreach ($files as $file)
foreach ($manifest->files->file as $file)
{
$type = (string) ($file['type'] ?? '');
$id = (string) ($file['id'] ?? '');
$group = (string) ($file['group'] ?? '');
$attrs = $file->attributes();
$id = isset($attrs['id']) ? (string) $attrs['id'] : '';
$exType = isset($attrs['type']) ? (string) $attrs['type'] : '';
if ($type === '' || $id === '')
if ($id === '' || $exType === '')
{
continue;
}
$element = ($type === 'plugin' && $group !== '')
? preg_replace('/^plg_' . preg_quote($group, '/') . '_/', '', $id)
: $id;
$group = isset($attrs['group']) ? (string) $attrs['group'] : '';
$element = $id;
// Plugin element in #__extensions is the id minus any leading plg_<group>_.
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($type));
->where($db->quoteName('type') . ' = ' . $db->quote($exType));
if ($type === 'plugin' && $group !== '')
if ($exType === 'plugin' && $group !== '')
{
$query->where($db->quoteName('folder') . ' = ' . $db->quote($group));
}
$db->setQuery($query);
if ((int) $db->loadResult() === 0)
if ((int) $db->setQuery($query)->loadResult() === 0)
{
$missing[] = htmlspecialchars($type . ': ' . $id, ENT_QUOTES, 'UTF-8');
$label = trim((string) $file);
$missing[] = $label !== '' ? preg_replace('/\.zip$/i', '', $label) : $id;
}
}
@@ -112,85 +109,16 @@ class Pkg_MokoSuiteFieldInstallerScript
}
catch (\Throwable $e)
{
// Fail open — never fake a failure on a glitch.
return [];
}
}
private function getExistingDlid(): string
{
try
{
$db = Factory::getContainer()->get(DatabaseInterface::class);
$db->setQuery(
$db->getQuery(true)
->select($db->quoteName('extra_query'))
->from($db->quoteName('#__update_sites'))
->where('(' . $db->quoteName('name') . ' LIKE ' . $db->quote('%MokoSuiteField%')
. ' OR ' . $db->quoteName('location') . ' LIKE ' . $db->quote('%MokoSuiteField%') . ')')
->setLimit(1)
);
$extraQuery = $db->loadResult() ?? '';
if (preg_match('/dlid=([a-zA-Z0-9]+)/', $extraQuery, $matches))
{
return $matches[1];
}
}
catch (\Throwable $e)
{
Log::add('Field install: failed to read DLID — ' . $e->getMessage(), Log::WARNING, 'mokosuite.field');
}
return '';
}
private function restoreDlid(string $dlid): void
{
try
{
$db = Factory::getContainer()->get(DatabaseInterface::class);
$db->setQuery(
$db->getQuery(true)
->update($db->quoteName('#__update_sites'))
->set($db->quoteName('extra_query') . ' = ' . $db->quote('dlid=' . $dlid))
->where('(' . $db->quoteName('name') . ' LIKE ' . $db->quote('%MokoSuiteField%')
. ' OR ' . $db->quoteName('location') . ' LIKE ' . $db->quote('%MokoSuiteField%') . ')')
);
$db->execute();
}
catch (\Throwable $e)
{
Log::add('Field install: failed to restore DLID — ' . $e->getMessage(), Log::WARNING, 'mokosuite.field');
}
}
private function enablePlugin(string $group, string $element): void
{
try
{
$db = Factory::getContainer()->get(DatabaseInterface::class);
$db->setQuery(
$db->getQuery(true)
->update($db->quoteName('#__extensions'))
->set($db->quoteName('enabled') . ' = 1')
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
->where($db->quoteName('folder') . ' = ' . $db->quote($group))
->where($db->quoteName('element') . ' = ' . $db->quote($element))
);
$db->execute();
}
catch (\Throwable $e)
{
Log::add('Field install: failed to enable ' . $group . '/' . $element . ' — ' . $e->getMessage(), Log::WARNING, 'mokosuite.field');
}
}
private function warnMissingLicenseKey(): void
{
try
{
$db = Factory::getContainer()->get(DatabaseInterface::class);
$db = Factory::getDbo();
$app = Factory::getApplication();
$query = $db->getQuery(true)
@@ -232,6 +160,7 @@ class Pkg_MokoSuiteFieldInstallerScript
}
catch (\Throwable $e)
{
// Silent — avoid breaking install if update_sites query fails
}
}
}