From 2b5648101a742694bfcc2df376c815d867de6236 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sat, 6 Jun 2026 16:38:25 -0500 Subject: [PATCH] fix: suppress license warning when download key is already configured checkUpdateSite() now checks extra_query for dlid= before showing the notice. If a download key is present, no message is displayed. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/View/Backups/HtmlView.php | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/source/packages/com_mokojoombackup/src/View/Backups/HtmlView.php b/source/packages/com_mokojoombackup/src/View/Backups/HtmlView.php index 41b5257..fa2b00b 100644 --- a/source/packages/com_mokojoombackup/src/View/Backups/HtmlView.php +++ b/source/packages/com_mokojoombackup/src/View/Backups/HtmlView.php @@ -60,9 +60,12 @@ class HtmlView extends BaseHtmlView try { $db = Factory::getDbo(); - // Find the update site ID linked to pkg_mokojoombackup + // Find the update site linked to pkg_mokojoombackup $query = $db->getQuery(true) - ->select($db->quoteName('us.update_site_id')) + ->select([ + $db->quoteName('us.update_site_id'), + $db->quoteName('us.extra_query'), + ]) ->from($db->quoteName('#__update_sites', 'us')) ->join( 'INNER', @@ -79,23 +82,25 @@ class HtmlView extends BaseHtmlView ->setLimit(1); $db->setQuery($query); - $updateSiteId = (int) $db->loadResult(); + $site = $db->loadObject(); - if ($updateSiteId > 0) { + if (!$site) { + Factory::getApplication()->enqueueMessage( + Text::_('COM_MOKOJOOMBACKUP_UPDATE_SITE_MISSING'), + 'warning' + ); + } elseif (empty($site->extra_query) || strpos($site->extra_query, 'dlid=') === false) { + // Update site exists but no download key configured $editUrl = Route::_( - 'index.php?option=com_installer&view=updatesites&task=updatesite.edit&id=' . $updateSiteId + 'index.php?option=com_installer&view=updatesites&filter[search]=mokojoombackup' ); Factory::getApplication()->enqueueMessage( Text::sprintf('COM_MOKOJOOMBACKUP_UPDATE_SITE_NOTICE', $editUrl), 'info' ); - } else { - Factory::getApplication()->enqueueMessage( - Text::_('COM_MOKOJOOMBACKUP_UPDATE_SITE_MISSING'), - 'warning' - ); } + // If key is present, show nothing — all good } catch (\Throwable $e) { // Non-critical — silently ignore }