diff --git a/lib/Froxlor/Traffic/Traffic.php b/lib/Froxlor/Traffic/Traffic.php index d9fa4e99..39a35d42 100644 --- a/lib/Froxlor/Traffic/Traffic.php +++ b/lib/Froxlor/Traffic/Traffic.php @@ -102,6 +102,14 @@ class Traffic $years_avail = $sel_stmt->fetchAll(\PDO::FETCH_ASSOC); } + // sort users by total traffic + usort($users, function ($user_a, $user_b) { + if ($user_a['total'] == $user_b['total']) { + return 0; + } + return ($user_a['total'] < $user_b['total']) ? 1 : -1; + }); + return [ 'metrics' => $metrics, 'users' => $users, diff --git a/templates/Froxlor/misc/version_popover.html.twig b/templates/Froxlor/misc/version_popover.html.twig index 02916f45..554bc0eb 100644 --- a/templates/Froxlor/misc/version_popover.html.twig +++ b/templates/Froxlor/misc/version_popover.html.twig @@ -21,6 +21,9 @@
{{ message }}
{% if get_config('enable_webupdate') %} Open updater + {% else %} +Run the following command in your shell to update:
+{{ call_static('\\Froxlor\\Froxlor', 'getInstallDir') }}bin/froxlor-cli froxlor:update
{% endif %}
{% endif %}
{% endmacro %}
diff --git a/templates/Froxlor/user/traffic.html.twig b/templates/Froxlor/user/traffic.html.twig
index 2cff65bd..bd96a8b7 100644
--- a/templates/Froxlor/user/traffic.html.twig
+++ b/templates/Froxlor/user/traffic.html.twig
@@ -152,7 +152,7 @@
{% if userinfo.adminsession == 1 %}
const labelsC = [];
const dataValues = [];
- {% for user in users|sort((a, b) => a.total <=> b.total)|slice(0, 5) %}
+ {% for user in users|slice(0, 5) %}
labelsC.push('{{ user.loginname }}');
dataValues.push({value: '{{ user.total|default(0) }}', formatted: '{{ user.total|formatBytes }}'});
{% endfor %}