Present lock changes alphabetically, with uninstalls first, then all install/updates mixed
parent
24a5a0dacb
commit
c033644f8b
|
@ -435,39 +435,60 @@ class Installer
|
||||||
$platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
|
$platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
|
||||||
$platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
|
$platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
|
||||||
|
|
||||||
|
$installsUpdates = $uninstalls = array();
|
||||||
if ($lockTransaction->getOperations()) {
|
if ($lockTransaction->getOperations()) {
|
||||||
$installs = $updates = $uninstalls = array();
|
$installNames = $updateNames = $uninstallNames = array();
|
||||||
foreach ($lockTransaction->getOperations() as $operation) {
|
foreach ($lockTransaction->getOperations() as $operation) {
|
||||||
if ($operation instanceof InstallOperation) {
|
if ($operation instanceof InstallOperation) {
|
||||||
$installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
|
$installsUpdates[] = $operation;
|
||||||
|
$installNames[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
|
||||||
} elseif ($operation instanceof UpdateOperation) {
|
} elseif ($operation instanceof UpdateOperation) {
|
||||||
$updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
|
$installsUpdates[] = $operation;
|
||||||
|
$updateNames[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
|
||||||
} elseif ($operation instanceof UninstallOperation) {
|
} elseif ($operation instanceof UninstallOperation) {
|
||||||
$uninstalls[] = $operation->getPackage()->getPrettyName();
|
$uninstalls[] = $operation;
|
||||||
|
$uninstallNames[] = $operation->getPackage()->getPrettyName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->io->writeError(sprintf(
|
$this->io->writeError(sprintf(
|
||||||
"<info>Lock file operations: %d install%s, %d update%s, %d removal%s</info>",
|
"<info>Lock file operations: %d install%s, %d update%s, %d removal%s</info>",
|
||||||
count($installs),
|
count($installNames),
|
||||||
1 === count($installs) ? '' : 's',
|
1 === count($installNames) ? '' : 's',
|
||||||
count($updates),
|
count($updateNames),
|
||||||
1 === count($updates) ? '' : 's',
|
1 === count($updateNames) ? '' : 's',
|
||||||
count($uninstalls),
|
count($uninstalls),
|
||||||
1 === count($uninstalls) ? '' : 's'
|
1 === count($uninstalls) ? '' : 's'
|
||||||
));
|
));
|
||||||
if ($installs) {
|
if ($installNames) {
|
||||||
$this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
|
$this->io->writeError("Installs: ".implode(', ', $installNames), true, IOInterface::VERBOSE);
|
||||||
}
|
}
|
||||||
if ($updates) {
|
if ($updateNames) {
|
||||||
$this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
|
$this->io->writeError("Updates: ".implode(', ', $updateNames), true, IOInterface::VERBOSE);
|
||||||
}
|
}
|
||||||
if ($uninstalls) {
|
if ($uninstalls) {
|
||||||
$this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
|
$this->io->writeError("Removals: ".implode(', ', $uninstallNames), true, IOInterface::VERBOSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($lockTransaction->getOperations() as $operation) {
|
$sortByName = function ($a, $b) {
|
||||||
|
if ($a instanceof UpdateOperation) {
|
||||||
|
$a = $a->getTargetPackage()->getName();
|
||||||
|
} else {
|
||||||
|
$a = $a->getPackage()->getName();
|
||||||
|
}
|
||||||
|
if ($b instanceof UpdateOperation) {
|
||||||
|
$b = $b->getTargetPackage()->getName();
|
||||||
|
} else {
|
||||||
|
$b = $b->getPackage()->getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return strcmp($a, $b);
|
||||||
|
};
|
||||||
|
usort($uninstalls, $sortByName);
|
||||||
|
usort($installsUpdates, $sortByName);
|
||||||
|
|
||||||
|
foreach (array_merge($uninstalls, $installsUpdates) as $operation) {
|
||||||
// collect suggestions
|
// collect suggestions
|
||||||
if ($operation instanceof InstallOperation) {
|
if ($operation instanceof InstallOperation) {
|
||||||
$this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
|
$this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
|
||||||
|
|
|
@ -45,9 +45,9 @@ install
|
||||||
Loading composer repositories with package information
|
Loading composer repositories with package information
|
||||||
Updating dependencies
|
Updating dependencies
|
||||||
Lock file operations: 3 installs, 0 updates, 0 removals
|
Lock file operations: 3 installs, 0 updates, 0 removals
|
||||||
|
- Locking a/a (1.0.0)
|
||||||
- Locking b/b (1.0.0)
|
- Locking b/b (1.0.0)
|
||||||
- Locking d/d (1.0.0)
|
- Locking d/d (1.0.0)
|
||||||
- Locking a/a (1.0.0)
|
|
||||||
Writing lock file
|
Writing lock file
|
||||||
Installing dependencies from lock file (including require-dev)
|
Installing dependencies from lock file (including require-dev)
|
||||||
Package operations: 3 installs, 0 updates, 0 removals
|
Package operations: 3 installs, 0 updates, 0 removals
|
||||||
|
|
|
@ -22,8 +22,8 @@ update
|
||||||
Loading composer repositories with package information
|
Loading composer repositories with package information
|
||||||
Updating dependencies
|
Updating dependencies
|
||||||
Lock file operations: 2 installs, 0 updates, 0 removals
|
Lock file operations: 2 installs, 0 updates, 0 removals
|
||||||
- Locking c/c (1.0.0)
|
|
||||||
- Locking a/a (1.0.0)
|
- Locking a/a (1.0.0)
|
||||||
|
- Locking c/c (1.0.0)
|
||||||
Writing lock file
|
Writing lock file
|
||||||
Installing dependencies from lock file (including require-dev)
|
Installing dependencies from lock file (including require-dev)
|
||||||
Package operations: 2 installs, 0 updates, 0 removals
|
Package operations: 2 installs, 0 updates, 0 removals
|
||||||
|
|
Loading…
Reference in New Issue