mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/17336] Correctly handle aliased packages
PHPBB-17336 Signed-off-by: Matt Friedman <maf675@gmail.com>
This commit is contained in:
parent
ec34f72a3b
commit
d8aa3f05e5
1 changed files with 11 additions and 7 deletions
|
@ -22,7 +22,9 @@ 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\Package\Version\VersionParser;
|
||||
use Composer\PartialComposer;
|
||||
use Composer\Repository\ComposerRepository;
|
||||
use Composer\Semver\Constraint\ConstraintInterface;
|
||||
|
@ -390,23 +392,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 */
|
||||
/** @var CompletePackage|CompleteAliasPackage $version */
|
||||
foreach ($versions as $version)
|
||||
{
|
||||
if (strpos($version->getVersion(), '9999999') === 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$highest_version || version_compare($version->getVersion(), $highest_version->getVersion(), '>'))
|
||||
{
|
||||
$highest_version = $version;
|
||||
}
|
||||
}
|
||||
|
||||
// If highest version is DEFAULT_BRANCH_ALIAS (9999999-dev), then it's a non-numeric dev branch handled by
|
||||
// an Alias, so we need to get the actual package being aliased in order to show the true non-numeric version.
|
||||
if ($highest_version->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS)
|
||||
{
|
||||
$highest_version = $highest_version->getAliasOf();
|
||||
}
|
||||
|
||||
// Generates the entry
|
||||
$available[$name] = [];
|
||||
$available[$name]['name'] = $highest_version->getPrettyName();
|
||||
|
|
Loading…
Add table
Reference in a new issue