From a869619fcd6c9f4a4d5e0bbc5a470bcba703e80d Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Mon, 25 May 2026 19:58:52 -0500 Subject: [PATCH] feat: alias offline=No bypasses Joomla global offline setting When an alias domain has offline=No, the plugin overrides Joomla's configuration.php offline=1 setting. This allows the dev/staging alias to remain accessible while the main site shows the offline page. Use case: put clarksvillefurs.com offline for maintenance while clarksvillefurs.dev.mokoconsulting.tech stays accessible for testing. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 4 +++ .../Extension/MokoWaaS.php | 36 +++++++++++-------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b353789b..47792ec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Alias offline bypass: aliases with offline=No override Joomla's global offline setting, allowing access via alias domain while main site is down +- CI: auto-release uses stream tag `stable` instead of version tag `vXX` + ### Planned - License/subscription check - System email template branding (DB approach) diff --git a/src/packages/plg_system_mokowaas/Extension/MokoWaaS.php b/src/packages/plg_system_mokowaas/Extension/MokoWaaS.php index 62e935b1..302b026a 100644 --- a/src/packages/plg_system_mokowaas/Extension/MokoWaaS.php +++ b/src/packages/plg_system_mokowaas/Extension/MokoWaaS.php @@ -2944,25 +2944,33 @@ class MokoWaaS extends CMSPlugin } // Offline: use Joomla's native offline mode for frontend requests - if (!empty($alias->offline) && (string) $alias->offline === '1' - && $this->app->isClient('site')) + if ($this->app->isClient('site')) { - // Allow health API to still respond - if ($this->app->input->get('mokowaas', '') !== '') + if (!empty($alias->offline) && (string) $alias->offline === '1') { - return; + // Allow health API to still respond + if ($this->app->input->get('mokowaas', '') !== '') + { + return; + } + + // Set custom offline message if provided + $message = $alias->offline_message ?? ''; + + if (!empty($message)) + { + $this->app->getConfig()->set('offline_message', $message); + } + + // Enable Joomla's native offline mode + $this->app->getConfig()->set('offline', 1); } - - // Set custom offline message if provided - $message = $alias->offline_message ?? ''; - - if (!empty($message)) + else { - $this->app->getConfig()->set('offline_message', $message); + // Alias is NOT offline — override Joomla's global offline setting + // This allows access via the alias domain even when the main site is offline + $this->app->getConfig()->set('offline', 0); } - - // Enable Joomla's native offline mode — renders through the template's offline.php - $this->app->getConfig()->set('offline', 1); } }