feat: auto-create Support menu item on package install
Generic: Repo Health / Access control (push) Has been cancelled
Generic: Repo Health / Site Health (push) Has been cancelled
Platform: moko-platform CI / Gate 1: Code Quality (push) Has been cancelled
Universal: Auto Version Bump / Version Bump (push) Has been cancelled
Update Server / Update Server (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (push) Has been cancelled
Platform: moko-platform CI / Gate 3: Self-Health Check (push) Has been cancelled
Platform: moko-platform CI / Gate 4: Governance (push) Has been cancelled
Platform: moko-platform CI / Gate 5: Template Integrity (push) Has been cancelled
Platform: moko-platform CI / CI Summary (push) Has been cancelled
Generic: Repo Health / Release configuration (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
Generic: Repo Health / Site Health (push) Has been cancelled
Platform: moko-platform CI / Gate 1: Code Quality (push) Has been cancelled
Universal: Auto Version Bump / Version Bump (push) Has been cancelled
Update Server / Update Server (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (push) Has been cancelled
Platform: moko-platform CI / Gate 3: Self-Health Check (push) Has been cancelled
Platform: moko-platform CI / Gate 4: Governance (push) Has been cancelled
Platform: moko-platform CI / Gate 5: Template Integrity (push) Has been cancelled
Platform: moko-platform CI / CI Summary (push) Has been cancelled
Generic: Repo Health / Release configuration (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Creates a frontend menu item at /support pointing to the customer portal (com_mokowaas&view=tickets). Access level: Registered. Idempotent — skips if already exists. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,9 @@ class Pkg_MokowaasInstallerScript
|
||||
// Set up cpanel module on the admin dashboard
|
||||
$this->setupCpanelModule();
|
||||
|
||||
// Create Support portal menu item on frontend
|
||||
$this->setupSupportMenuItem();
|
||||
|
||||
// Mark MokoWaaS extensions as protected (prevents disable/uninstall at framework level)
|
||||
$this->protectExtensions();
|
||||
|
||||
@@ -699,6 +702,82 @@ class Pkg_MokowaasInstallerScript
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a "Support" menu item on the frontend main menu.
|
||||
*/
|
||||
private function setupSupportMenuItem(): void
|
||||
{
|
||||
try
|
||||
{
|
||||
$db = Factory::getDbo();
|
||||
|
||||
$db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->select('COUNT(*)')
|
||||
->from($db->quoteName('#__menu'))
|
||||
->where($db->quoteName('link') . ' LIKE ' . $db->quote('%com_mokowaas&view=tickets%'))
|
||||
->where($db->quoteName('client_id') . ' = 0')
|
||||
);
|
||||
|
||||
if ((int) $db->loadResult() > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->select($db->quoteName('extension_id'))
|
||||
->from($db->quoteName('#__extensions'))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote('com_mokowaas'))
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('component'))
|
||||
);
|
||||
$componentId = (int) $db->loadResult();
|
||||
|
||||
if (!$componentId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$db->setQuery("SELECT id FROM #__menu WHERE menutype = '' AND level = 0 AND client_id = 0 LIMIT 1");
|
||||
$rootId = (int) $db->loadResult() ?: 1;
|
||||
|
||||
$db->setQuery('SELECT MAX(rgt) FROM #__menu WHERE client_id = 0');
|
||||
$maxRgt = (int) $db->loadResult();
|
||||
|
||||
$item = (object) [
|
||||
'menutype' => 'mainmenu',
|
||||
'title' => 'Support',
|
||||
'alias' => 'support',
|
||||
'note' => '',
|
||||
'path' => 'support',
|
||||
'link' => 'index.php?option=com_mokowaas&view=tickets',
|
||||
'type' => 'component',
|
||||
'published' => 1,
|
||||
'parent_id' => $rootId,
|
||||
'level' => 1,
|
||||
'component_id' => $componentId,
|
||||
'checked_out' => null,
|
||||
'checked_out_time' => null,
|
||||
'browserNav' => 0,
|
||||
'access' => 2,
|
||||
'img' => '',
|
||||
'template_style_id' => 0,
|
||||
'params' => '{}',
|
||||
'lft' => $maxRgt + 1,
|
||||
'rgt' => $maxRgt + 2,
|
||||
'home' => 0,
|
||||
'language' => '*',
|
||||
'client_id' => 0,
|
||||
];
|
||||
|
||||
$db->insertObject('#__menu', $item, 'id');
|
||||
}
|
||||
catch (\Throwable $e)
|
||||
{
|
||||
Log::add('Support menu setup error: ' . $e->getMessage(), Log::WARNING, 'mokowaas');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* One-time migration of params from the monolithic core plugin to
|
||||
* the new feature plugins. Copies security, tenant, and dev params.
|
||||
|
||||
Reference in New Issue
Block a user