sort modules by name and version

This commit is contained in:
Jean-Christian Denis 2021-10-23 15:59:28 +02:00
parent 154506c0bf
commit d55df97608
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -222,11 +222,12 @@ class libPackman
protected static function sort($modules)
{
$sorter = [];
foreach($modules as $id => $module) {
$sorter[$id] = $id;
$key = $ver = [];
foreach($modules as $i => $module) {
$key[$i] = $module['id'] ?? $i;
$ver[$i] = $module['version'];
}
array_multisort($sorter, SORT_ASC, $modules);
array_multisort($key, SORT_ASC, $ver, SORT_ASC, $modules);
return $modules;
}