From c81e409a57e8f15a59c5bc5e50a04079acc4e67e Mon Sep 17 00:00:00 2001 From: Jonathan Miller <230051081+jmiller-moko@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:22:01 -0500 Subject: [PATCH] feat: auto-install mokocassiopeia, set as default, lock template Minor version bump to 02.01.01: - Auto-install mokocassiopeia from GitHub if not present - Lock and protect the template (cannot be disabled/uninstalled) - Set mokocassiopeia as default site template Co-Authored-By: Claude Opus 4.6 (1M context) --- composer.json | 2 +- src/mokowaas.xml | 4 ++-- src/script.php | 41 ++++++++++++++++++++++++++++++++++++++++- updates.xml | 6 +++--- 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index ad818e37..2f420afc 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "mokoconsulting-tech/mokowaas", "description": "MokoWaaS Joomla component by Moko Consulting", "type": "joomla-component", - "version": "02.00.03", + "version": "02.01.01", "license": "GPL-3.0-or-later", "authors": [ { diff --git a/src/mokowaas.xml b/src/mokowaas.xml index 427c37e4..2f4799de 100644 --- a/src/mokowaas.xml +++ b/src/mokowaas.xml @@ -16,7 +16,7 @@ DEFGROUP: Joomla.Plugin INGROUP: MokoWaaS REPO: https://github.com/mokoconsulting-tech/mokowaas - VERSION: 02.00.03 + VERSION: 02.01.01 PATH: /src/mokowaas.xml BRIEF: Plugin manifest for MokoWaaS system plugin NOTE: Defines installation metadata, files, and configuration for Joomla @@ -29,7 +29,7 @@ GNU General Public License version 3 or later; see LICENSE.md hello@mokoconsulting.tech https://mokoconsulting.tech - 02.00.03 + 02.01.01 This plugin rebrands the Joomla system interface with MokoWaaS identity. It applies language overrides and ensures consistent branding across the platform. Moko\Plugin\System\MokoWaaS script.php diff --git a/src/script.php b/src/script.php index a6dc98a6..75f5c203 100644 --- a/src/script.php +++ b/src/script.php @@ -233,7 +233,7 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface if ($template) { - // Lock and protect + // Lock, protect, and set as default $db->setQuery( $db->getQuery(true) ->update($db->quoteName('#__extensions')) @@ -245,6 +245,9 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface ); $db->execute(); + // Set as default site template + $this->setDefaultTemplate('mokocassiopeia', 0); + return; } @@ -302,6 +305,42 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface } } + /** + * Set a template as the default for a given client. + * + * @param string $template Template element name + * @param int $clientId 0 = site, 1 = admin + * + * @return void + * + * @since 02.01.01 + */ + private function setDefaultTemplate($template, $clientId) + { + $db = Factory::getDbo(); + + // Unset all other defaults for this client + $db->setQuery( + $db->getQuery(true) + ->update($db->quoteName('#__template_styles')) + ->set($db->quoteName('home') . ' = 0') + ->where($db->quoteName('client_id') . ' = ' . $clientId) + ->where($db->quoteName('home') . ' = 1') + ); + $db->execute(); + + // Set our template as default + $db->setQuery( + $db->getQuery(true) + ->update($db->quoteName('#__template_styles')) + ->set($db->quoteName('home') . ' = 1') + ->where($db->quoteName('template') . ' = ' + . $db->quote($template)) + ->where($db->quoteName('client_id') . ' = ' . $clientId) + ); + $db->execute(); + } + private const BLOCK_START = '; ===== BEGIN MokoWaaS Overrides (do not edit this block) ====='; /** Sentinel comment that marks the end of MokoWaaS overrides inside a Joomla override file. */ diff --git a/updates.xml b/updates.xml index f1fd4836..963d77d1 100644 --- a/updates.xml +++ b/updates.xml @@ -16,7 +16,7 @@ DEFGROUP: Joomla.UpdateServer INGROUP: MokoWaaS REPO: https://github.com/mokoconsulting-tech/mokowaas - VERSION: 02.00.03 + VERSION: 02.01.01 PATH: /updates.xml BRIEF: Joomla update server XML feed for automatic plugin updates NOTE: This file is automatically updated by GitHub Actions on each release @@ -29,10 +29,10 @@ plugin system site - 02.00.03 + 02.01.01 https://github.com/mokoconsulting-tech/mokowaas - https://github.com/mokoconsulting-tech/MokoWaaS/releases/download/02.00.03/MokoWaaS-02.00.03.zip + https://github.com/mokoconsulting-tech/MokoWaaS/releases/download/02.01.01/MokoWaaS-02.01.01.zip Moko Consulting https://mokoconsulting.tech