Skip to content

Commit

Permalink
firmware: after requested new sorting, plugins went in twice
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Dec 31, 2017
1 parent 99ac5f6 commit 080219e
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,7 @@ public function infoAction()
if ($plugin[0] == 'os') {
if ($type == 'local' || ($type == 'remote' &&
($devel || end($plugin) != 'devel'))) {
/* flip install status and prepend to search key to list them first */
$sortkey = ($translated['installed'] ? '0' : '1') . $translated['name'];
$plugins[$sortkey] = $translated;
$plugins[$translated['name']] = $translated;
}
}
}
Expand All @@ -702,8 +700,11 @@ public function infoAction()
$response['package'][] = $package;
}

uksort($plugins, function ($a, $b) {
return strnatcasecmp($a, $b);
uasort($plugins, function ($a, $b) {
return strnatcasecmp(
($a['installed'] ? '0' : '1') . $a['name'],
($b['installed'] ? '0' : '1') . $b['name']
);
});

$response['plugin'] = array();
Expand Down

0 comments on commit 080219e

Please sign in to comment.