Support advisories from multiple repositories for the same package (#11436)
parent
3bb191a464
commit
57a48df34e
|
@ -257,20 +257,18 @@ class RepositorySet
|
||||||
*/
|
*/
|
||||||
private function getSecurityAdvisoriesForConstraints(array $packageConstraintMap, bool $allowPartialAdvisories): array
|
private function getSecurityAdvisoriesForConstraints(array $packageConstraintMap, bool $allowPartialAdvisories): array
|
||||||
{
|
{
|
||||||
$advisories = [];
|
$repoAdvisories = [];
|
||||||
foreach ($this->repositories as $repository) {
|
foreach ($this->repositories as $repository) {
|
||||||
if (!$repository instanceof AdvisoryProviderInterface || !$repository->hasSecurityAdvisories()) {
|
if (!$repository instanceof AdvisoryProviderInterface || !$repository->hasSecurityAdvisories()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $repository->getSecurityAdvisories($packageConstraintMap, $allowPartialAdvisories);
|
$repoAdvisories[] = $repository->getSecurityAdvisories($packageConstraintMap, $allowPartialAdvisories)['advisories'];
|
||||||
foreach ($result['namesFound'] as $nameFound) {
|
|
||||||
unset($packageConstraintMap[$nameFound]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$advisories = array_merge($advisories, $result['advisories']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$advisories = array_merge_recursive([], ...$repoAdvisories);
|
||||||
|
ksort($advisories);
|
||||||
|
|
||||||
return $advisories;
|
return $advisories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue