From 5b67751858a4bcaec1112c1f828eaa0f9802e21d Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sun, 21 Jun 2026 08:47:44 -0500 Subject: [PATCH] fix(install): restore DEFAULT '' in preflight for MySQL strict mode Joomla INSERTs extension rows without element before setting it. MySQL strict mode requires a default value. Preflight sets DEFAULT '' so the INSERT succeeds, then postflight cleans up the empty rows and stale files. --- source/script.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/script.php b/source/script.php index 956920bf..bfe0834b 100644 --- a/source/script.php +++ b/source/script.php @@ -46,6 +46,20 @@ class Pkg_MokosuiteclientInstallerScript { $this->saveDownloadKey(); + // Joomla's package installer INSERTs extension rows without element first. + // MySQL strict mode requires a default. Set DEFAULT '' so the INSERT succeeds, + // then postflight cleans up the empty-element rows and stale files. + try + { + $db = Factory::getDbo(); + $db->setQuery("ALTER TABLE " . $db->quoteName('#__extensions') + . " MODIFY " . $db->quoteName('element') . " VARCHAR(100) NOT NULL DEFAULT ''"); + $db->execute(); + } + catch (\Throwable $e) + { + // Non-fatal + } } public function postflight($type, $parent)