refactor: defer login support URL enforcement to future release
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user