feat: restore login support URL enforcement
The mokoconsulting.tech/support, /kb, and /news pages exist. Restore runtime enforcement in MokoWaaS.php and install-time write in script.php. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -123,6 +123,7 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface
|
||||
if ($type === 'install' || $type === 'update')
|
||||
{
|
||||
$this->installLanguageOverrides();
|
||||
$this->updateLoginSupportUrls();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -311,6 +312,64 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the mod_loginsupport module params to point to
|
||||
* Moko Consulting URLs at install time.
|
||||
*
|
||||
* @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.', 'message'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove only MokoWaaS overrides from Joomla's global override files.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user