From 518a9b2484ec7b51aa7008360ad05257039f7082 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Tue, 8 Jul 2025 17:41:57 +0200 Subject: [PATCH] Add disk_usage --- www/index.php | 17 +++++++++++------ www/res/style.css | 4 ++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/www/index.php b/www/index.php index bddbf60..12195fc 100644 --- a/www/index.php +++ b/www/index.php @@ -91,15 +91,18 @@ if ($path == '') { if ($format === 'text') { header('Content-Type: text/plain; charset=UTF-8'); - foreach ($clients as $c) - echo "$c\n"; + foreach ($clients as $c) { + $size = intval(exec("du -s .data/$c")); + echo "$c ($size kB)\n"; + } } else if ($format === 'json') { header('Content-Type: application/json; charset=UTF-8'); echo "{\"data\": ["; $first = true; foreach ($clients as $c) { if (!$first) echo ","; - echo "\n {\"name\": \"$c\"}"; + $size = intval(exec("du -s .data/$c")) * 1024; + echo "\n {\"name\": \"$c\", \"disk_usage\": $size}"; $first = false; } echo "\n]}\n"; @@ -122,10 +125,11 @@ if ($path == '') {

Mandanten

Homepage

- + \n"; + $size = intval(exec("du -s .data/$c")); + echo " \n"; } ?>
Name
NameUsage
$c
$c$size kB
@@ -159,7 +163,8 @@ foreach ($clients as $c) { } header('Content-Type: application/json; charset=UTF-8'); - echo "{\"data\": [\n"; + $size = intval(exec("du -s .data/$c")) * 1024; + echo "{\"disk_usage\": $size, \"data\": [\n"; $first = true; foreach (scandir(".data/$c/") as $file) { if (str_starts_with($file, ".") || str_ends_with($file, ".php") || str_ends_with($file, ".inc")) continue; diff --git a/www/res/style.css b/www/res/style.css index a07ea01..d14884d 100644 --- a/www/res/style.css +++ b/www/res/style.css @@ -154,6 +154,10 @@ main section h3 { text-align: center; } +.right { + text-align: right; +} + main section p, main section table { max-width: 1000px;