mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-27 04:18:55 +00:00
Compare commits
3 commits
ec34f72a3b
...
0a20edf6b4
Author | SHA1 | Date | |
---|---|---|---|
|
0a20edf6b4 | ||
|
5229813c47 | ||
|
d8aa3f05e5 |
1 changed files with 16 additions and 10 deletions
|
@ -22,6 +22,7 @@ use Composer\IO\NullIO;
|
|||
use Composer\Json\JsonFile;
|
||||
use Composer\Json\JsonValidationException;
|
||||
use Composer\Package\BasePackage;
|
||||
use Composer\Package\CompleteAliasPackage;
|
||||
use Composer\Package\CompletePackage;
|
||||
use Composer\PartialComposer;
|
||||
use Composer\Repository\ComposerRepository;
|
||||
|
@ -390,20 +391,25 @@ class installer
|
|||
foreach ($compatible_packages as $name => $versions)
|
||||
{
|
||||
// Determine the highest version of the package
|
||||
/** @var CompletePackage $highest_version */
|
||||
/** @var CompletePackage|CompleteAliasPackage $highest_version */
|
||||
$highest_version = null;
|
||||
|
||||
/** @var CompletePackage $version */
|
||||
foreach ($versions as $version)
|
||||
// Sort the versions array in descending order
|
||||
usort($versions, function ($a, $b)
|
||||
{
|
||||
if (strpos($version->getVersion(), '9999999') === 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
return version_compare($b->getVersion(), $a->getVersion());
|
||||
});
|
||||
|
||||
if (!$highest_version || version_compare($version->getVersion(), $highest_version->getVersion(), '>'))
|
||||
// The first element in the sorted array is the highest version
|
||||
if (!empty($versions))
|
||||
{
|
||||
$highest_version = $version;
|
||||
$highest_version = $versions[0];
|
||||
|
||||
// If highest version is a non-numeric dev branch, it's an instance of CompleteAliasPackage,
|
||||
// so we need to get the package being aliased in order to show the true non-numeric version.
|
||||
if ($highest_version instanceof CompleteAliasPackage)
|
||||
{
|
||||
$highest_version = $highest_version->getAliasOf();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -414,7 +420,7 @@ class installer
|
|||
$available[$name]['composer_name'] = $highest_version->getName();
|
||||
$available[$name]['version'] = $highest_version->getPrettyVersion();
|
||||
|
||||
if ($version instanceof CompletePackage)
|
||||
if ($highest_version instanceof CompletePackage)
|
||||
{
|
||||
$available[$name]['description'] = $highest_version->getDescription();
|
||||
$available[$name]['url'] = $highest_version->getHomepage();
|
||||
|
|
Loading…
Add table
Reference in a new issue