From 0b52d50e8a672370b2e35b06f18a0a398e66ffe5 Mon Sep 17 00:00:00 2001 From: Jonathan Miller <230051081+jmiller-moko@users.noreply.github.com> Date: Sat, 4 Apr 2026 20:49:12 -0500 Subject: [PATCH] refactor: defer login support URL enforcement to future release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove enforceLoginSupportUrls() from runtime and updateLoginSupportUrls() from install script. Both write hardcoded mokoconsulting.tech/support, /kb, /news URLs to mod_loginsupport module params — these pages don't exist yet. Login support TEXT overrides (MOD_LOGINSUPPORT_FORUM etc.) are kept since they work locally without an endpoint. The underlying hrefs will still point to joomla.org until the endpoints are built and URL enforcement is restored. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/Extension/MokoWaaS.php | 66 -------------------------------------- src/script.php | 56 -------------------------------- 2 files changed, 122 deletions(-) diff --git a/src/Extension/MokoWaaS.php b/src/Extension/MokoWaaS.php index 8d441927..8930e7f6 100644 --- a/src/Extension/MokoWaaS.php +++ b/src/Extension/MokoWaaS.php @@ -84,7 +84,6 @@ class MokoWaaS extends CMSPlugin if ($this->app->isClient('administrator')) { $this->enforceMasterUser(); - $this->enforceLoginSupportUrls(); $this->enforceAdminSessionTimeout(); $this->enforceUploadRestrictions(); } @@ -457,71 +456,6 @@ class MokoWaaS extends CMSPlugin return $strings; } - /** - * Enforce login support module URLs on admin requests. - * - * Checks the mod_loginsupport module params and corrects them if - * they have been changed away from the expected values. Runs only - * on administrator requests to avoid unnecessary DB queries on the - * frontend. - * - * @return void - * - * @since 02.00.00 - */ - protected function enforceLoginSupportUrls() - { - if (!$this->app->isClient('administrator')) - { - return; - } - - $expected = [ - 'forum_url' => 'https://mokoconsulting.tech/support', - 'documentation_url' => 'https://mokoconsulting.tech/kb', - 'news_url' => 'https://mokoconsulting.tech/news', - ]; - - $db = Factory::getDbo(); - $query = $db->getQuery(true) - ->select([$db->quoteName('id'), $db->quoteName('params')]) - ->from($db->quoteName('#__modules')) - ->where($db->quoteName('module') . ' = ' . $db->quote('mod_loginsupport')); - - $db->setQuery($query); - $modules = $db->loadObjectList(); - - if (empty($modules)) - { - return; - } - - foreach ($modules as $module) - { - $params = new \Joomla\Registry\Registry($module->params ?: '{}'); - $needsFix = false; - - foreach ($expected as $key => $url) - { - if ($params->get($key) !== $url) - { - $params->set($key, $url); - $needsFix = true; - } - } - - if ($needsFix) - { - $update = $db->getQuery(true) - ->update($db->quoteName('#__modules')) - ->set($db->quoteName('params') . ' = ' . $db->quote($params->toString())) - ->where($db->quoteName('id') . ' = ' . (int) $module->id); - - $db->setQuery($update); - $db->execute(); - } - } - } /** * Event triggered after an extension's config is saved. diff --git a/src/script.php b/src/script.php index 711468e2..6b36dd22 100644 --- a/src/script.php +++ b/src/script.php @@ -123,7 +123,6 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface if ($type === 'install' || $type === 'update') { $this->installLanguageOverrides(); - $this->updateLoginSupportUrls(); } return true; @@ -312,61 +311,6 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface } } - /** - * Update the mod_loginsupport module params to point to Moko Consulting URLs. - * - * Joomla's login support module stores forum, documentation, and news URLs - * as module parameters in the database. Language overrides can change the - * link text but not the href — this method rewrites the module params so - * the actual links point to mokoconsulting.tech. - * - * @return void - * - * @since 02.00.00 - */ - private function updateLoginSupportUrls() - { - $db = Factory::getDbo(); - $query = $db->getQuery(true) - ->select([$db->quoteName('id'), $db->quoteName('params')]) - ->from($db->quoteName('#__modules')) - ->where($db->quoteName('module') . ' = ' . $db->quote('mod_loginsupport')); - - $db->setQuery($query); - $modules = $db->loadObjectList(); - - if (empty($modules)) - { - return; - } - - $supportUrls = [ - 'forum_url' => 'https://mokoconsulting.tech/support', - 'documentation_url' => 'https://mokoconsulting.tech/kb', - 'news_url' => 'https://mokoconsulting.tech/news', - ]; - - foreach ($modules as $module) - { - $params = new \Joomla\Registry\Registry($module->params ?: '{}'); - - foreach ($supportUrls as $key => $url) - { - $params->set($key, $url); - } - - $update = $db->getQuery(true) - ->update($db->quoteName('#__modules')) - ->set($db->quoteName('params') . ' = ' . $db->quote($params->toString())) - ->where($db->quoteName('id') . ' = ' . (int) $module->id); - - $db->setQuery($update); - $db->execute(); - } - - Factory::getApplication()->enqueueMessage('Updated login support URLs to Moko Consulting.', 'message'); - } - /** * Remove only MokoWaaS overrides from Joomla's global override files. *