feat: unlock MokoCassiopeia + lock MokoOnyx during migration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-04-21 17:06:10 -05:00
parent 51718b2bb8
commit edc66d3404

View File

@@ -251,6 +251,36 @@ use Joomla\CMS\Log\Log;
$log('Update server redirect failed: ' . $e->getMessage(), Log::WARNING);
}
// Unlock MokoCassiopeia (allow uninstall) + lock MokoOnyx (prevent accidental uninstall)
try {
$query = $db->getQuery(true)
->update('#__extensions')
->set($db->quoteName('locked') . ' = 0')
->set($db->quoteName('protected') . ' = 0')
->where($db->quoteName('element') . ' = ' . $db->quote($oldName))
->where($db->quoteName('type') . ' = ' . $db->quote('template'));
$db->setQuery($query)->execute();
if ($db->getAffectedRows() > 0) {
$log('Unlocked MokoCassiopeia (can be uninstalled).');
}
} catch (\Throwable $e) {
$log('Failed to unlock MokoCassiopeia: ' . $e->getMessage(), Log::WARNING);
}
try {
$query = $db->getQuery(true)
->update('#__extensions')
->set($db->quoteName('locked') . ' = 1')
->where($db->quoteName('element') . ' = ' . $db->quote($newName))
->where($db->quoteName('type') . ' = ' . $db->quote('template'));
$db->setQuery($query)->execute();
if ($db->getAffectedRows() > 0) {
$log('Locked MokoOnyx (protected from uninstall).');
}
} catch (\Throwable $e) {
$log('Failed to lock MokoOnyx: ' . $e->getMessage(), Log::WARNING);
}
// Write marker file
@file_put_contents($markerFile, date('Y-m-d H:i:s') . " migrated {$oldName}{$newName}");