Simplify package loading
parent
779b56ab2b
commit
0955d38374
|
@ -255,10 +255,11 @@ class PoolBuilder
|
||||||
$this->loadedNames[$name] = $constraint;
|
$this->loadedNames[$name] = $constraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
$preLoad = $this->packagesToLoad;
|
$packageBatch = $this->packagesToLoad;
|
||||||
|
$this->packagesToLoad = array();
|
||||||
|
|
||||||
foreach ($repositories as $repository) {
|
foreach ($repositories as $repository) {
|
||||||
if (empty($this->packagesToLoad)) {
|
if (empty($packageBatch)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,23 +268,16 @@ class PoolBuilder
|
||||||
if ($repository instanceof PlatformRepository || $repository === $request->getLockedRepository()) {
|
if ($repository instanceof PlatformRepository || $repository === $request->getLockedRepository()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$result = $repository->loadPackages($this->packagesToLoad, $this->acceptableStabilities, $this->stabilityFlags);
|
$result = $repository->loadPackages($packageBatch, $this->acceptableStabilities, $this->stabilityFlags);
|
||||||
|
|
||||||
foreach ($result['namesFound'] as $name) {
|
foreach ($result['namesFound'] as $name) {
|
||||||
// avoid loading the same package again from other repositories once it has been found
|
// avoid loading the same package again from other repositories once it has been found
|
||||||
unset($this->packagesToLoad[$name]);
|
unset($packageBatch[$name]);
|
||||||
}
|
}
|
||||||
foreach ($result['packages'] as $package) {
|
foreach ($result['packages'] as $package) {
|
||||||
$this->loadPackage($request, $package);
|
$this->loadPackage($request, $package);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we empty the packagesToLoad here as it would result
|
|
||||||
// in an endless loop if the array remains unchanged.
|
|
||||||
// This could happen with non-existent packages for example.
|
|
||||||
if ($preLoad == $this->packagesToLoad) {
|
|
||||||
$this->packagesToLoad = array();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadPackage(Request $request, PackageInterface $package, $propagateUpdate = true)
|
private function loadPackage(Request $request, PackageInterface $package, $propagateUpdate = true)
|
||||||
|
|
Loading…
Reference in New Issue