feat: lock plugin on install — cannot be disabled or uninstalled

Sets both locked=1 and protected=1 in #__extensions on install.
Prevents tenants from disabling or uninstalling the plugin through
the Extension Manager.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 15:55:38 -05:00
parent 687e0ed3c9
commit 1b38ce9a07
+3 -1
View File
@@ -142,12 +142,14 @@ class plgSystemMokoWaaSInstallerScript implements InstallerScriptInterface
*/
public function install(InstallerAdapter $adapter): bool
{
// Auto-enable the plugin on first install
// Auto-enable and lock the plugin on first install
$db = Factory::getDbo();
$db->setQuery(
$db->getQuery(true)
->update($db->quoteName('#__extensions'))
->set($db->quoteName('enabled') . ' = 1')
->set($db->quoteName('locked') . ' = 1')
->set($db->quoteName('protected') . ' = 1')
->where($db->quoteName('element') . ' = '
. $db->quote('mokowaas'))
->where($db->quoteName('folder') . ' = '