1
0
Fork 0

Update batching to install plugin deps before the plugin (alone an own batch)

pull/8952/head
Jordi Boggiano 2020-06-16 14:07:30 +02:00
parent ee58f25c00
commit aea074308c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 22 additions and 11 deletions

View File

@ -95,7 +95,7 @@ abstract class ArchiveDownloader extends FileDownloader
$filesystem->unlink($fileName); $filesystem->unlink($fileName);
/** /**
* Returns the folder content, excluding dotfiles * Returns the folder content, excluding .DS_Store
* *
* @param string $dir Directory * @param string $dir Directory
* @return \SplFileInfo[] * @return \SplFileInfo[]

View File

@ -283,20 +283,31 @@ class InstallationManager
// execute operations in batches to make sure every plugin is installed in the // 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 // right order and activated before the packages depending on it are installed
while ($operations) { $batches = array();
$batch = array(); $batch = array();
foreach ($operations as $index => $operation) { foreach ($operations as $index => $operation) {
unset($operations[$index]);
$batch[$index] = $operation;
if (in_array($operation->getOperationType(), array('update', 'install'), true)) { if (in_array($operation->getOperationType(), array('update', 'install'), true)) {
$package = $operation->getOperationType() === 'update' ? $operation->getTargetPackage() : $operation->getPackage(); $package = $operation->getOperationType() === 'update' ? $operation->getTargetPackage() : $operation->getPackage();
if ($package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer') { if ($package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer') {
break; if ($batch) {
$batches[] = $batch;
}
unset($operations[$index]);
$batches[] = array($index => $operation);
$batch = array();
continue;
} }
} }
unset($operations[$index]);
$batch[$index] = $operation;
} }
if ($batch) {
$batches[] = $batch;
}
foreach ($batches as $batch) {
$this->executeBatch($repo, $batch, $cleanupPromises, $devMode, $runScripts); $this->executeBatch($repo, $batch, $cleanupPromises, $devMode, $runScripts);
} }
} catch (\Exception $e) { } catch (\Exception $e) {