Skip to content

Commit

Permalink
BUGFIX: Prevent lower version from appearing as package search result
Browse files Browse the repository at this point in the history
By defining the highest package version as „lastVersion“ we prevent f.e.
that a later release version 5.0.2 is shown as result instead of a 8.0.2 which was released 2 minutes earlier.

Resolves: neos#409
  • Loading branch information
Sebobo committed Jul 18, 2022
1 parent 48dbcd5 commit 7046c01
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,10 @@ public function extractVersions(NodeInterface $node): array
public function extractLastVersion(NodeInterface $node): ?NodeInterface
{
$versions = $this->extractVersions($node);
usort($versions, static function(NodeInterface $a, NodeInterface $b) {
/** @var \DateTime $aTime */
$aTime = $a->getProperty('time');
/** @var \DateTime $bTime */
$bTime = $b->getProperty('time');
if ($aTime === false || $bTime === false) {
return -1;
}
return $bTime->getTimestamp() - $aTime->getTimestamp();
usort($versions, static function (NodeInterface $a, NodeInterface $b) {
return $a->getProperty('versionNormalized') <=> $b->getProperty('versionNormalized');
});
$stableVersions = array_filter($versions, static function(NodeInterface $version) {
$stableVersions = array_filter($versions, static function (NodeInterface $version) {
return $version->getProperty('stability') === true;
});
if (count($stableVersions) > 0) {
Expand Down

0 comments on commit 7046c01

Please sign in to comment.