feat: always install MokoOnyx and unlock MokoCassiopeia on update
- Rewrite ensureMokoCassiopeia() to always install+lock MokoOnyx and always unlock MokoCassiopeia (allow uninstall) - Bundle MokoOnyx 01.00.17 stable payload (replaces MokoCassiopeia) - Update payload workflow to fetch MokoOnyx from Gitea releases - Bump version to 02.01.18 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Update MokoCassiopeia Payload
|
||||
name: Update MokoOnyx Payload
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -14,25 +14,25 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get latest MokoCassiopeia release URL
|
||||
- name: Get latest MokoOnyx stable release URL
|
||||
id: moko
|
||||
run: |
|
||||
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/mokoconsulting-tech/MokoCassiopeia/releases \
|
||||
| jq -r '[.[] | select(.prerelease == false and .draft == false and (.assets | length > 0)][0].assets[0].browser_download_url')
|
||||
DOWNLOAD_URL=$(curl -s https://git.mokoconsulting.tech/api/v1/repos/MokoConsulting/MokoOnyx/releases \
|
||||
| jq -r '[.[] | select(.prerelease == false and .draft == false and (.assets | length > 0))][0].assets[0].browser_download_url')
|
||||
echo "url=$DOWNLOAD_URL" >> $GITHUB_OUTPUT
|
||||
echo "Found: $DOWNLOAD_URL"
|
||||
|
||||
- name: Download MokoCassiopeia zip
|
||||
- name: Download MokoOnyx zip
|
||||
if: steps.moko.outputs.url != 'null'
|
||||
run: |
|
||||
mkdir -p src/payload
|
||||
curl -sL "${{ steps.moko.outputs.url }}" -o src/payload/mokocassiopeia.zip
|
||||
curl -sL "${{ steps.moko.outputs.url }}" -o src/payload/mokoonyx.zip
|
||||
ls -la src/payload/
|
||||
|
||||
- name: Check if payload changed
|
||||
id: diff
|
||||
run: |
|
||||
git add src/payload/mokocassiopeia.zip
|
||||
git add src/payload/mokoonyx.zip
|
||||
if git diff --cached --quiet; then
|
||||
echo "changed=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
@@ -44,5 +44,5 @@ jobs:
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git commit -m "chore: update mokocassiopeia payload"
|
||||
git commit -m "chore: update mokoonyx payload"
|
||||
git push
|
||||
|
||||
@@ -100,6 +100,7 @@ replit.md
|
||||
*.tar.gz
|
||||
*.tgz
|
||||
*.zip
|
||||
!src/payload/*.zip
|
||||
artifacts/
|
||||
release/
|
||||
releases/
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
DEFGROUP: Joomla.Plugin
|
||||
INGROUP: MokoWaaS
|
||||
REPO: https://github.com/mokoconsulting-tech/mokowaas
|
||||
VERSION: 02.01.17
|
||||
VERSION: 02.01.18
|
||||
PATH: /README.md
|
||||
BRIEF: Rebranding plugin for MokoWaaS platform
|
||||
NOTE: Internal WaaS identity abstraction layer
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
# MokoWaaS Plugin
|
||||
|
||||
[](https://github.com/mokoconsulting-tech/MokoWaaS/releases/tag/v02)
|
||||
[](https://github.com/mokoconsulting-tech/MokoWaaS/releases/tag/v02)
|
||||
[](LICENSE)
|
||||
[](https://www.joomla.org)
|
||||
[](https://www.php.net)
|
||||
@@ -322,22 +322,18 @@ See [LICENSE.md](LICENSE.md) for the full license text.
|
||||
|
||||
This extension follows the [MokoStandards](https://github.com/mokoconsulting-tech/MokoStandards) version governance model using semantic versioning: `MAJOR.MINOR.PATCH`
|
||||
|
||||
Current version: **01.04.00**
|
||||
Current version: **02.01.18**
|
||||
|
||||
## Changelog
|
||||
|
||||
See [CHANGELOG.md](CHANGELOG.md) for a complete version history.
|
||||
|
||||
### Recent Changes (v01.04.00 - 2026-02-22)
|
||||
### Recent Changes (v02.01.18 - 2026-04-23)
|
||||
|
||||
- Added complete Joomla 5.x system plugin implementation
|
||||
- Created main plugin class with event handlers
|
||||
- Implemented plugin manifest with Joomla 5.x namespace support
|
||||
- Added dependency injection service provider
|
||||
- Created plugin language files
|
||||
- Integrated with language override system
|
||||
- Enhanced language overrides (57+ strings)
|
||||
- Fixed typo in error messages (OCCURRED)
|
||||
- Always install and lock MokoOnyx template on install/update
|
||||
- Always unlock MokoCassiopeia on install/update (allow uninstall)
|
||||
- Bundle MokoOnyx payload (replaces MokoCassiopeia payload)
|
||||
- Update payload workflow to fetch MokoOnyx from Gitea releases
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
Binary file not shown.
+38
-61
@@ -210,11 +210,11 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the active Moko template is installed and locked.
|
||||
* Ensure MokoOnyx is installed, locked, and set as default.
|
||||
*
|
||||
* Prefers MokoOnyx (successor). Falls back to MokoCassiopeia.
|
||||
* If MokoOnyx is found, lock it and unlock MokoCassiopeia.
|
||||
* If only MokoCassiopeia is found, lock it as before.
|
||||
* Always installs MokoOnyx from bundled payload if not present,
|
||||
* locks it, sets it as default site template, and unlocks
|
||||
* MokoCassiopeia so it can be uninstalled.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
@@ -224,14 +224,23 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface
|
||||
{
|
||||
$db = Factory::getDbo();
|
||||
|
||||
// Check for MokoOnyx first (successor template)
|
||||
// Check whether MokoOnyx is already installed
|
||||
$query = $db->getQuery(true)
|
||||
->select([$db->quoteName('extension_id'), $db->quoteName('enabled')])
|
||||
->select($db->quoteName('extension_id'))
|
||||
->from($db->quoteName('#__extensions'))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote('mokoonyx'))
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('template'));
|
||||
$onyx = $db->setQuery($query)->loadObject();
|
||||
|
||||
// Install from payload if missing
|
||||
if (!$onyx)
|
||||
{
|
||||
$this->installMokoOnyxFromPayload();
|
||||
|
||||
// Re-check after install
|
||||
$onyx = $db->setQuery($query)->loadObject();
|
||||
}
|
||||
|
||||
if ($onyx)
|
||||
{
|
||||
// Lock and protect MokoOnyx
|
||||
@@ -245,56 +254,31 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface
|
||||
)->execute();
|
||||
|
||||
$this->setDefaultTemplate('mokoonyx', 0);
|
||||
|
||||
// Unlock MokoCassiopeia if present (allow uninstall)
|
||||
$db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->update($db->quoteName('#__extensions'))
|
||||
->set($db->quoteName('locked') . ' = 0')
|
||||
->set($db->quoteName('protected') . ' = 0')
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote('mokocassiopeia'))
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('template'))
|
||||
)->execute();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Fallback: MokoCassiopeia
|
||||
$query = $db->getQuery(true)
|
||||
->select([$db->quoteName('extension_id'), $db->quoteName('enabled')])
|
||||
->from($db->quoteName('#__extensions'))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote('mokocassiopeia'))
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('template'));
|
||||
$template = $db->setQuery($query)->loadObject();
|
||||
// Always unlock MokoCassiopeia (allow uninstall)
|
||||
$db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->update($db->quoteName('#__extensions'))
|
||||
->set($db->quoteName('locked') . ' = 0')
|
||||
->set($db->quoteName('protected') . ' = 0')
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote('mokocassiopeia'))
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('template'))
|
||||
)->execute();
|
||||
}
|
||||
|
||||
if ($template)
|
||||
{
|
||||
// Lock, protect, and set as default
|
||||
$db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->update($db->quoteName('#__extensions'))
|
||||
->set($db->quoteName('enabled') . ' = 1')
|
||||
->set($db->quoteName('locked') . ' = 1')
|
||||
->set($db->quoteName('protected') . ' = 1')
|
||||
->where($db->quoteName('extension_id') . ' = '
|
||||
. (int) $template->extension_id)
|
||||
);
|
||||
$db->execute();
|
||||
|
||||
$this->setDefaultTemplate('mokocassiopeia', 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Template not installed — install from bundled payload
|
||||
/**
|
||||
* Install MokoOnyx from the bundled payload zip.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 02.01.17
|
||||
*/
|
||||
private function installMokoOnyxFromPayload()
|
||||
{
|
||||
$pluginPath = JPATH_PLUGINS . '/system/mokowaas';
|
||||
$payloadZip = $pluginPath . '/payload/mokoonyx.zip';
|
||||
|
||||
// Fallback to legacy name
|
||||
if (!file_exists($payloadZip)) {
|
||||
$payloadZip = $pluginPath . '/payload/mokocassiopeia.zip';
|
||||
}
|
||||
|
||||
if (!file_exists($payloadZip))
|
||||
{
|
||||
Factory::getApplication()->enqueueMessage(
|
||||
@@ -310,13 +294,9 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// Extract the bundled zip
|
||||
$archive = new \Joomla\Archive\Archive();
|
||||
$archive->extract($payloadZip, $tmpDir);
|
||||
|
||||
// Release zips should have templateDetails.xml at root
|
||||
// or one level deep
|
||||
$installDir = $tmpDir;
|
||||
|
||||
if (!file_exists($tmpDir . '/templateDetails.xml'))
|
||||
@@ -330,8 +310,7 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface
|
||||
else
|
||||
{
|
||||
Factory::getApplication()->enqueueMessage(
|
||||
'MokoCassiopeia: templateDetails.xml not '
|
||||
. 'found in archive.',
|
||||
'MokoOnyx: templateDetails.xml not found in archive.',
|
||||
'warning'
|
||||
);
|
||||
|
||||
@@ -343,17 +322,15 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface
|
||||
|
||||
if ($installer->install($installDir))
|
||||
{
|
||||
$this->ensureMokoCassiopeia();
|
||||
|
||||
Factory::getApplication()->enqueueMessage(
|
||||
'MokoCassiopeia installed and locked.',
|
||||
'MokoOnyx installed successfully.',
|
||||
'message'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Factory::getApplication()->enqueueMessage(
|
||||
'MokoCassiopeia installation failed.',
|
||||
'MokoOnyx installation from payload failed.',
|
||||
'warning'
|
||||
);
|
||||
}
|
||||
@@ -361,7 +338,7 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface
|
||||
catch (\Exception $e)
|
||||
{
|
||||
Factory::getApplication()->enqueueMessage(
|
||||
'MokoCassiopeia error: ' . $e->getMessage(),
|
||||
'MokoOnyx error: ' . $e->getMessage(),
|
||||
'warning'
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user