From d55df97608c1ade8999213784a57653a7c445893 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 23 Oct 2021 15:59:28 +0200 Subject: [PATCH] sort modules by name and version --- inc/lib.packman.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/inc/lib.packman.php b/inc/lib.packman.php index cd82be7..95419f8 100644 --- a/inc/lib.packman.php +++ b/inc/lib.packman.php @@ -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; }