sort modules by name and version

2.28
Jean-Christian Paul Denis 2021-10-23 15:59:28 +02:00
parent 154506c0bf
commit d55df97608
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
1 changed files with 5 additions and 4 deletions

View File

@ -222,11 +222,12 @@ class libPackman
protected static function sort($modules) protected static function sort($modules)
{ {
$sorter = []; $key = $ver = [];
foreach($modules as $id => $module) { foreach($modules as $i => $module) {
$sorter[$id] = $id; $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; return $modules;
} }