From 79e577edf02ffdc50aed0f18fa4f0be9eb29e976 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Mon, 15 Jun 2026 00:34:54 -0500 Subject: [PATCH] fix: set package client_id to 0 (site) for update matching Joomla packages must have client_id=0 in #__extensions for the updater to match against site in updates.xml. The package was incorrectly registered with client_id=1 (admin), causing updates to be invisible in the Joomla update manager. Adds fixPackageClientId() to postflight so it self-corrects on every install/update. --- source/script.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 = [