Skip to content

Commit

Permalink
wip php minimum & stability
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-24 committed Jun 11, 2022
1 parent f6ac9c5 commit 5585d32
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions libraries/src/Updater/ConstrainChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function check($constraints)
}

// Check stability
if (isset($constraints['stability']) && !$this->checkStability($constraints['stability']))
if (isset($constraints['stability']) && !$this->checkStability($constraints['stability']['tags']))
{
return false;
}
Expand Down Expand Up @@ -103,10 +103,7 @@ protected function checkTargetplatform($targetPlatform)
protected function checkPhpMinimum($phpMinimum)
{
// Check if PHP version supported via <php_minimum> tag, assume true if tag isn't present
if (version_compare(PHP_VERSION, $phpMinimum, '>='))
{
return true;
}
return version_compare(PHP_VERSION, $phpMinimum, '>=');
}

/**
Expand Down Expand Up @@ -150,24 +147,27 @@ protected function checkSupportedDatabases($supportedDatabases)
/**
* Check the stability
*
* @param string $stability Stability tag to check
* @param array $stabilityTags Stability tags to check
*
* @return bool
*
* @since __DEPLOY_VERSION__
*/
protected function checkStability($stability)
protected function checkStability($stabilityTags)
{
$minimumStability = ComponentHelper::getParams('com_installer')->get('minimum_stability', Updater::STABILITY_STABLE);

$stability = $this->stabilityTagToInteger($stability);

if (($stability < $minimumStability))
foreach ($stabilityTags as $tag)
{
return false;
}
$stability = $this->stabilityTagToInteger($stability);

return true;
if (($stability < $minimumStability))
{
return false;
}

return true;
}
}

/**
Expand Down

0 comments on commit 5585d32

Please sign in to comment.