Skip to content

Commit 080219e

Browse files
committed
firmware: after requested new sorting, plugins went in twice
PR: https://forum.opnsense.org/index.php?topic=6722.0
1 parent 99ac5f6 commit 080219e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,7 @@ public function infoAction()
684684
if ($plugin[0] == 'os') {
685685
if ($type == 'local' || ($type == 'remote' &&
686686
($devel || end($plugin) != 'devel'))) {
687-
/* flip install status and prepend to search key to list them first */
688-
$sortkey = ($translated['installed'] ? '0' : '1') . $translated['name'];
689-
$plugins[$sortkey] = $translated;
687+
$plugins[$translated['name']] = $translated;
690688
}
691689
}
692690
}
@@ -702,8 +700,11 @@ public function infoAction()
702700
$response['package'][] = $package;
703701
}
704702

705-
uksort($plugins, function ($a, $b) {
706-
return strnatcasecmp($a, $b);
703+
uasort($plugins, function ($a, $b) {
704+
return strnatcasecmp(
705+
($a['installed'] ? '0' : '1') . $a['name'],
706+
($b['installed'] ? '0' : '1') . $b['name']
707+
);
707708
});
708709

709710
$response['plugin'] = array();

0 commit comments

Comments
 (0)