diff --git a/administrator/components/com_joomlaupdate/config.xml b/administrator/components/com_joomlaupdate/config.xml
index 9259b7156e533..feb77e4a5abd4 100644
--- a/administrator/components/com_joomlaupdate/config.xml
+++ b/administrator/components/com_joomlaupdate/config.xml
@@ -19,7 +19,6 @@
-
@@ -29,7 +28,6 @@
label="COM_JOOMLAUPDATE_MINIMUM_STABILITY_LABEL"
description="COM_JOOMLAUPDATE_MINIMUM_STABILITY_DESC"
default="4"
- showon="updatesource:testing[OR]updatesource:custom"
validate="options"
>
@@ -41,11 +39,12 @@
get('updatesource', 'default')) {
- case 'testing':
- // "Testing"
- $updateURL = 'https://update.joomla.org/core/test/list_test.xml';
- break;
-
case 'custom':
// "Custom"
// @todo: check if the customurl is valid and not just "not empty".
@@ -115,6 +110,7 @@ public function applyUpdateSite()
* case 'lts':
* case 'sts': (It's shown as "Default" because that option does not exist any more)
* case 'nochange':
+ * case 'testing':
*/
$updateURL = 'https://update.joomla.org/cms/';
}
@@ -173,13 +169,9 @@ public function refreshUpdates($force = false)
}
$updater = Updater::getInstance();
- $minimumStability = Updater::STABILITY_STABLE;
$comJoomlaupdateParams = ComponentHelper::getParams('com_joomlaupdate');
- if (\in_array($comJoomlaupdateParams->get('updatesource', 'default'), ['testing', 'custom'])) {
- $minimumStability = $comJoomlaupdateParams->get('minimum_stability', Updater::STABILITY_STABLE);
- }
-
+ $minimumStability = $comJoomlaupdateParams->get('minimum_stability', Updater::STABILITY_STABLE);
$reflection = new \ReflectionObject($updater);
$reflectionMethod = $reflection->getMethod('findUpdates');
$methodParameters = $reflectionMethod->getParameters();
@@ -296,13 +288,9 @@ public function getUpdateInformation()
return $this->updateInformation;
}
- $minimumStability = Updater::STABILITY_STABLE;
$comJoomlaupdateParams = ComponentHelper::getParams('com_joomlaupdate');
$channel = $comJoomlaupdateParams->get('updatesource', 'default');
-
- if (\in_array($channel, ['testing', 'custom'])) {
- $minimumStability = $comJoomlaupdateParams->get('minimum_stability', Updater::STABILITY_STABLE);
- }
+ $minimumStability = $comJoomlaupdateParams->get('minimum_stability', Updater::STABILITY_STABLE);
$update = new Update();
diff --git a/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php b/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php
index 5147b60e20b6d..2426157f11968 100644
--- a/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php
+++ b/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php
@@ -239,12 +239,6 @@ public function display($tpl = null)
$this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT');
break;
- case 'testing':
- // "Testing"
- $this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_TESTING';
- $this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_TESTING');
- break;
-
case 'custom':
// "Custom"
$this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_CUSTOM';
@@ -259,6 +253,7 @@ public function display($tpl = null)
* case 'sts':
* case 'lts':
* case 'nochange':
+ * case 'testing':
*/
$this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_DEFAULT';
$this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT');
diff --git a/administrator/language/en-GB/com_joomlaupdate.ini b/administrator/language/en-GB/com_joomlaupdate.ini
index df136e0de89f4..5902c52891851 100644
--- a/administrator/language/en-GB/com_joomlaupdate.ini
+++ b/administrator/language/en-GB/com_joomlaupdate.ini
@@ -15,6 +15,7 @@ COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM_ERROR="The custom URL field is empty
COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT="Default"
COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_LABEL="Update Channel"
COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT="Joomla Next"
+; Deprecated, will be removed with 6.0
COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_TESTING="Testing"
COM_JOOMLAUPDATE_CONFIG_VERSIONCHECK_DESC="Shows the checkbox in the pre–update check if any of the extensions installed on your site is potentially incompatible with the version of Joomla you are upgrading to. Note: the checkbox is displayed when upgrading to a new Joomla version family (minor or major version)."
COM_JOOMLAUPDATE_CONFIG_VERSIONCHECK_LABEL="Potentially incompatible extensions checkbox"
diff --git a/libraries/src/Updater/Adapter/TufAdapter.php b/libraries/src/Updater/Adapter/TufAdapter.php
index 625ae512b55d0..d57ec0949cc1c 100644
--- a/libraries/src/Updater/Adapter/TufAdapter.php
+++ b/libraries/src/Updater/Adapter/TufAdapter.php
@@ -21,6 +21,7 @@
use Joomla\CMS\TUF\TufFetcher;
use Joomla\CMS\Updater\ConstraintChecker;
use Joomla\CMS\Updater\UpdateAdapter;
+use Joomla\CMS\Updater\Updater;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Tuf\Exception\MetadataException;
@@ -81,11 +82,11 @@ public function getUpdateTargets($options)
$metaData = json_decode((string) $metaData, true);
- if (!isset($metaData["signed"]["targets"])) {
+ if (!isset($metaData['signed']['targets'])) {
return false;
}
- foreach ($metaData["signed"]["targets"] as $filename => $target) {
+ foreach ($metaData['signed']['targets'] as $filename => $target) {
$version = $this->processTufTarget($filename, $target);
if (!$version) {
@@ -108,7 +109,7 @@ public function getUpdateTargets($options)
// Return the version as a match if either all constraints are matched
// or "only" env related constraints fail - the later one is the existing behavior of the XML updater
if (
- $constraintChecker->check($version) === true
+ $constraintChecker->check($version, $options['minimum_stability'] ?? Updater::STABILITY_STABLE) === true
|| !empty((array) $constraintChecker->getFailedEnvironmentConstraints())
) {
return [$version];
diff --git a/libraries/src/Updater/ConstraintChecker.php b/libraries/src/Updater/ConstraintChecker.php
index e7ae984ac8182..75f6f11ee952f 100644
--- a/libraries/src/Updater/ConstraintChecker.php
+++ b/libraries/src/Updater/ConstraintChecker.php
@@ -13,7 +13,6 @@
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
-use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Filter\InputFilter;
use Joomla\CMS\Version;
@@ -50,13 +49,14 @@ public function __construct()
/**
* Checks whether the passed constraints are matched
*
- * @param array $candidate The provided constraints to be checked
+ * @param array $candidate The provided constraints to be checked
+ * @param int $minimumStability The minimum stability required for updating
*
* @return boolean
*
* @since 5.1.0
*/
- public function check(array $candidate)
+ public function check(array $candidate, $minimumStability = Updater::STABILITY_STABLE)
{
if (!isset($candidate['targetplatform'])) {
// targetplatform is required
@@ -89,7 +89,7 @@ public function check(array $candidate)
// Check stability, assume true when not set
if (
isset($candidate['stability'])
- && !$this->checkStability($candidate['stability'])
+ && !$this->checkStability($candidate['stability'], $minimumStability)
) {
$result = false;
}
@@ -208,23 +208,18 @@ protected function checkSupportedDatabases(array $supportedDatabases)
/**
* Check the stability
*
- * @param string $stability Stability to check
+ * @param string $stability Stability to check
+ * @param int $minimumStability The minimum stability required for updating
*
* @return boolean
*
* @since 5.1.0
*/
- protected function checkStability(string $stability)
+ protected function checkStability(string $stability, $minimumStability = Updater::STABILITY_STABLE)
{
- $minimumStability = ComponentHelper::getParams('com_installer')->get('minimum_stability', Updater::STABILITY_STABLE);
-
$stabilityInt = $this->stabilityToInteger($stability);
- if (($stabilityInt < $minimumStability)) {
- $this->failedEnvironmentConstraints->stability = new \stdClass();
- $this->failedEnvironmentConstraints->stability->required = $stability;
- $this->failedEnvironmentConstraints->stability->used = $minimumStability;
-
+ if ($stabilityInt < $minimumStability) {
return false;
}
diff --git a/libraries/src/Updater/Update.php b/libraries/src/Updater/Update.php
index 76baad13cc1c9..ed4e42bddbeff 100644
--- a/libraries/src/Updater/Update.php
+++ b/libraries/src/Updater/Update.php
@@ -557,7 +557,7 @@ public function loadFromTuf(TufMetadata $metadataTable, string $url, $minimumSta
continue;
}
- if (!$constraintChecker->check($target['custom'])) {
+ if (!$constraintChecker->check($target['custom'], $minimumStability)) {
$this->otherUpdateInfo = $constraintChecker->getFailedEnvironmentConstraints();
continue;