diff --git a/source/script.php b/source/script.php index 9f949dc..91a4051 100644 --- a/source/script.php +++ b/source/script.php @@ -145,6 +145,10 @@ class Pkg_MokoSuiteBackupInstallerScript // (Joomla may not add new submenu entries or update params on upgrades) $this->ensureSubmenuItems(); + // Fix package client_id — packages must be client_id=0 (site) for + // Joomla's updater to match the site in updates.xml + $this->fixPackageClientId(); + // Sync submenu icons in #__menu (Joomla doesn't update icons on upgrades) $this->syncMenuIcons(); @@ -478,6 +482,22 @@ class Pkg_MokoSuiteBackupInstallerScript } } + private function fixPackageClientId(): void + { + try { + $db = Factory::getDbo(); + $query = $db->getQuery(true) + ->update($db->quoteName('#__extensions')) + ->set($db->quoteName('client_id') . ' = 0') + ->where($db->quoteName('element') . ' = ' . $db->quote('pkg_mokosuitebackup')) + ->where($db->quoteName('type') . ' = ' . $db->quote('package')); + $db->setQuery($query); + $db->execute(); + } catch (\Exception $e) { + error_log('MokoSuiteBackup: fixPackageClientId() failed: ' . $e->getMessage()); + } + } + private function syncMenuIcons(): void { $iconMap = [