|
|
|
@ -272,6 +272,52 @@ class InstallationManager
|
|
|
|
|
$this->loop->wait($promises);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// execute operations in batches to make sure every plugin is installed in the
|
|
|
|
|
// right order and activated before the packages depending on it are installed
|
|
|
|
|
while ($operations) {
|
|
|
|
|
$batch = array();
|
|
|
|
|
|
|
|
|
|
foreach ($operations as $index => $operation) {
|
|
|
|
|
unset($operations[$index]);
|
|
|
|
|
$batch[$index] = $operation;
|
|
|
|
|
if (in_array($operation->getOperationType(), array('update', 'install'), true)) {
|
|
|
|
|
$package = $operation->getOperationType() === 'update' ? $operation->getTargetPackage() : $operation->getPackage();
|
|
|
|
|
if ($package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer') {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->executeBatch($repo, $batch, $cleanupPromises, $devMode, $runScripts);
|
|
|
|
|
}
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
$runCleanup();
|
|
|
|
|
|
|
|
|
|
if ($handleInterruptsUnix) {
|
|
|
|
|
pcntl_signal(SIGINT, $prevHandler);
|
|
|
|
|
}
|
|
|
|
|
if ($handleInterruptsWindows) {
|
|
|
|
|
sapi_windows_set_ctrl_handler($prevHandler, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($handleInterruptsUnix) {
|
|
|
|
|
pcntl_signal(SIGINT, $prevHandler);
|
|
|
|
|
}
|
|
|
|
|
if ($handleInterruptsWindows) {
|
|
|
|
|
sapi_windows_set_ctrl_handler($prevHandler, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// do a last write so that we write the repository even if nothing changed
|
|
|
|
|
// as that can trigger an update of some files like InstalledVersions.php if
|
|
|
|
|
// running a new composer version
|
|
|
|
|
$repo->write($devMode, $this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function executeBatch(RepositoryInterface $repo, array $operations, array $cleanupPromises, $devMode, $runScripts)
|
|
|
|
|
{
|
|
|
|
|
foreach ($operations as $index => $operation) {
|
|
|
|
|
$opType = $operation->getOperationType();
|
|
|
|
|
|
|
|
|
@ -302,7 +348,6 @@ class InstallationManager
|
|
|
|
|
|
|
|
|
|
$dispatcher = $this->eventDispatcher;
|
|
|
|
|
$installManager = $this;
|
|
|
|
|
$loop = $this->loop;
|
|
|
|
|
$io = $this->io;
|
|
|
|
|
|
|
|
|
|
$promise = $installer->prepare($opType, $package, $initialPackage);
|
|
|
|
@ -332,7 +377,7 @@ class InstallationManager
|
|
|
|
|
// execute all prepare => installs/updates/removes => cleanup steps
|
|
|
|
|
if (!empty($promises)) {
|
|
|
|
|
$progress = null;
|
|
|
|
|
if ($io instanceof ConsoleIO && !$io->isDebug()) {
|
|
|
|
|
if ($io instanceof ConsoleIO && !$io->isDebug() && count($promises) > 1) {
|
|
|
|
|
$progress = $io->getProgressBar();
|
|
|
|
|
}
|
|
|
|
|
$this->loop->wait($promises, $progress);
|
|
|
|
@ -340,30 +385,6 @@ class InstallationManager
|
|
|
|
|
$progress->clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
$runCleanup();
|
|
|
|
|
|
|
|
|
|
if ($handleInterruptsUnix) {
|
|
|
|
|
pcntl_signal(SIGINT, $prevHandler);
|
|
|
|
|
}
|
|
|
|
|
if ($handleInterruptsWindows) {
|
|
|
|
|
sapi_windows_set_ctrl_handler($prevHandler, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($handleInterruptsUnix) {
|
|
|
|
|
pcntl_signal(SIGINT, $prevHandler);
|
|
|
|
|
}
|
|
|
|
|
if ($handleInterruptsWindows) {
|
|
|
|
|
sapi_windows_set_ctrl_handler($prevHandler, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// do a last write so that we write the repository even if nothing changed
|
|
|
|
|
// as that can trigger an update of some files like InstalledVersions.php if
|
|
|
|
|
// running a new composer version
|
|
|
|
|
$repo->write($devMode, $this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|