Add abandoned flag to show/outdated commands package lists (#10485)
To synchronize `abandoned` information with JSON APIs and the `composer.json` information of a package, we should return the following types: `bool|non-empty-string`. This will either state if a package is abandoned and, if there is a replacement declared, what replacement package should be used instead. Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>pull/10488/head
parent
3ae111140f
commit
1704466b74
|
@ -461,8 +461,10 @@ EOT
|
||||||
$packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
|
$packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$packageIsAbandoned = false;
|
||||||
if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
|
if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
|
||||||
$replacement = is_string($latestPackage->getReplacementPackage())
|
$replacementPackageName = $latestPackage->getReplacementPackage();
|
||||||
|
$replacement = $replacementPackageName !== null
|
||||||
? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
|
? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
|
||||||
: 'No replacement was suggested';
|
: 'No replacement was suggested';
|
||||||
$packageWarning = sprintf(
|
$packageWarning = sprintf(
|
||||||
|
@ -471,7 +473,10 @@ EOT
|
||||||
$replacement
|
$replacement
|
||||||
);
|
);
|
||||||
$packageViewData['warning'] = $packageWarning;
|
$packageViewData['warning'] = $packageWarning;
|
||||||
|
$packageIsAbandoned = $replacementPackageName ?? true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$packageViewData['abandoned'] = $packageIsAbandoned;
|
||||||
} else {
|
} else {
|
||||||
$packageViewData['name'] = $package;
|
$packageViewData['name'] = $package;
|
||||||
$nameLength = max($nameLength, strlen($package));
|
$nameLength = max($nameLength, strlen($package));
|
||||||
|
|
Loading…
Reference in New Issue