feat: add Font Awesome 7 to admin backend and MokoWaaS table migration
Load FA7 in admin pages — checks MokoOnyx template params for Kit code, falls back to bundled FA7 Free files, then FA6 CDN. Install script now migrates mokowaas_* tables to mokosuite_* (create, copy data, drop old).
This commit is contained in:
@@ -61,6 +61,9 @@ class Pkg_MokosuiteInstallerScript
|
||||
|
||||
public function postflight($type, $parent)
|
||||
{
|
||||
// Migrate MokoWaaS database tables to MokoSuite naming
|
||||
$this->migrateWaasTables();
|
||||
|
||||
// Remove legacy extensions and migrate settings before retiring
|
||||
$this->cleanupLegacyExtensions();
|
||||
$this->migrateStandalonePlugins();
|
||||
@@ -1639,4 +1642,90 @@ class Pkg_MokosuiteInstallerScript
|
||||
// Silent
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate MokoWaaS database tables to MokoSuite naming.
|
||||
*
|
||||
* For each table: create new mokosuite_* table → copy data from mokowaas_* → drop old table.
|
||||
* Safe to run multiple times — skips tables that don't exist or are already migrated.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 02.35.00
|
||||
*/
|
||||
private function migrateWaasTables(): void
|
||||
{
|
||||
$tableMap = [
|
||||
'mokowaas_ticket_categories' => 'mokosuite_ticket_categories',
|
||||
'mokowaas_tickets' => 'mokosuite_tickets',
|
||||
'mokowaas_ticket_replies' => 'mokosuite_ticket_replies',
|
||||
'mokowaas_ticket_canned' => 'mokosuite_ticket_canned',
|
||||
'mokowaas_ticket_automation' => 'mokosuite_ticket_automation',
|
||||
'mokowaas_consent_log' => 'mokosuite_consent_log',
|
||||
'mokowaas_data_requests' => 'mokosuite_data_requests',
|
||||
'mokowaas_retention_policies' => 'mokosuite_retention_policies',
|
||||
'mokowaas_waf_log' => 'mokosuite_waf_log',
|
||||
];
|
||||
|
||||
try
|
||||
{
|
||||
$db = Factory::getDbo();
|
||||
$prefix = $db->getPrefix();
|
||||
$migrated = 0;
|
||||
|
||||
foreach ($tableMap as $oldSuffix => $newSuffix)
|
||||
{
|
||||
$oldTable = $prefix . $oldSuffix;
|
||||
$newTable = $prefix . $newSuffix;
|
||||
|
||||
// Check if old table exists
|
||||
$db->setQuery("SHOW TABLES LIKE " . $db->quote($oldTable));
|
||||
|
||||
if (!$db->loadResult())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create new table with same structure if it doesn't exist
|
||||
$db->setQuery("SHOW TABLES LIKE " . $db->quote($newTable));
|
||||
|
||||
if (!$db->loadResult())
|
||||
{
|
||||
$db->setQuery("CREATE TABLE " . $db->quoteName('#__' . $newSuffix)
|
||||
. " LIKE " . $db->quoteName('#__' . $oldSuffix));
|
||||
$db->execute();
|
||||
}
|
||||
|
||||
// Copy data from old to new (skip duplicates on primary key)
|
||||
$db->setQuery("INSERT IGNORE INTO " . $db->quoteName('#__' . $newSuffix)
|
||||
. " SELECT * FROM " . $db->quoteName('#__' . $oldSuffix));
|
||||
$db->execute();
|
||||
$copied = $db->getAffectedRows();
|
||||
|
||||
// Drop old table
|
||||
$db->setQuery("DROP TABLE IF EXISTS " . $db->quoteName('#__' . $oldSuffix));
|
||||
$db->execute();
|
||||
|
||||
$migrated++;
|
||||
|
||||
Log::add(
|
||||
sprintf('Migrated table %s → %s (%d rows)', $oldSuffix, $newSuffix, $copied),
|
||||
Log::INFO,
|
||||
'mokosuite'
|
||||
);
|
||||
}
|
||||
|
||||
if ($migrated > 0)
|
||||
{
|
||||
Factory::getApplication()->enqueueMessage(
|
||||
sprintf('Migrated %d MokoWaaS database table(s) to MokoSuite naming.', $migrated),
|
||||
'message'
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (\Throwable $e)
|
||||
{
|
||||
Log::add('Table migration error: ' . $e->getMessage(), Log::WARNING, 'mokosuite');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user