Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw exception in com_installer UpdateModel when update site is tuf #10

Merged
merged 3 commits into from
Sep 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion administrator/components/com_installer/src/Model/UpdateModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Updater\Update;
use Joomla\CMS\Updater\Updater;
use Joomla\Database\DatabaseDriver;
use Joomla\Database\DatabaseQuery;
use Joomla\Database\Exception\ExecutionFailureException;
use Joomla\Database\ParameterType;
Expand Down Expand Up @@ -361,7 +362,26 @@ public function update($uids, $minimumStability = Updater::STABILITY_STABLE)
continue;
}

$update->loadFromXml($instance->detailsurl, $minimumStability);
$app = Factory::getApplication();
$db = Factory::getContainer()->get(DatabaseDriver::class);
$query = $db->getQuery(true)
->select('type')
->from('#__update_sites')
->where($db->quoteName('id') . ' = :id')
->bind(':id', $instance->update_site_id, ParameterType::INTEGER);
$db->setQuery($query);
$updateSiteType = (string) $db->loadObject();

if ($updateSiteType == 'tuf')
{
$app->enqueueMessage(Text::_('JLIB_INSTALLER_TUF_NOT_AVAILABLE'), 'error');

return;
}
else
{
$update->loadFromXml($instance->detailsurl, $minimumStability);
}

// Find and use extra_query from update_site if available
$updateSiteInstance = new \Joomla\CMS\Table\UpdateSite($this->getDatabase());
Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ JLIB_INSTALLER_UNINSTALL="Uninstall"
JLIB_INSTALLER_UPDATE="Update"
JLIB_INSTALLER_UPDATE_LOG_QUERY="Ran query from file %1$s. Query text: %2$s."
JLIB_INSTALLER_WARNING_UNABLE_TO_INSTALL_CONTENT_LANGUAGE="Unable to create a content language for %s language: %s"
JLIB_INSTALLER_TUF_NOT_AVAILABLE="TUF is not available for extensions yet."

JLIB_JS_AJAX_ERROR_CONNECTION_ABORT="A connection abort has occurred while fetching the JSON data."
JLIB_JS_AJAX_ERROR_NO_CONTENT="No content was returned."
Expand Down