Clarify code a bit
parent
2f4656e87a
commit
7f7d13450e
|
@ -560,18 +560,21 @@ class Installer
|
||||||
$constraint->setPrettyString($rootPackage->getPrettyVersion());
|
$constraint->setPrettyString($rootPackage->getPrettyVersion());
|
||||||
$request->install($rootPackage->getName(), $constraint);
|
$request->install($rootPackage->getName(), $constraint);
|
||||||
|
|
||||||
$installedPackages = $platformRepo->getPackages();
|
$fixedPackages = $platformRepo->getPackages();
|
||||||
if ($this->additionalInstalledRepository) {
|
if ($this->additionalInstalledRepository) {
|
||||||
$additionalInstalledPackages = $this->additionalInstalledRepository->getPackages();
|
$additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
|
||||||
$installedPackages = array_merge($installedPackages, $additionalInstalledPackages);
|
$fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix the version of all platform packages to prevent the solver trying to remove those
|
// fix the version of all platform packages + additionally installed packages
|
||||||
foreach ($installedPackages as $package) {
|
// to prevent the solver trying to remove or update those
|
||||||
|
$provided = $rootPackage->getProvides();
|
||||||
|
foreach ($fixedPackages as $package) {
|
||||||
$constraint = new VersionConstraint('=', $package->getVersion());
|
$constraint = new VersionConstraint('=', $package->getVersion());
|
||||||
$constraint->setPrettyString($package->getPrettyVersion());
|
$constraint->setPrettyString($package->getPrettyVersion());
|
||||||
|
|
||||||
if (!($provided = $rootPackage->getProvides())
|
// skip platform packages that are provided by the root package
|
||||||
|
if ($package->getRepository() !== $platformRepo
|
||||||
|| !isset($provided[$package->getName()])
|
|| !isset($provided[$package->getName()])
|
||||||
|| !$provided[$package->getName()]->getConstraint()->matches($constraint)
|
|| !$provided[$package->getName()]->getConstraint()->matches($constraint)
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in New Issue