Add used_space
This commit is contained in:
@@ -91,15 +91,18 @@ if ($path == '') {
|
|||||||
|
|
||||||
if ($format === 'text') {
|
if ($format === 'text') {
|
||||||
header('Content-Type: text/plain; charset=UTF-8');
|
header('Content-Type: text/plain; charset=UTF-8');
|
||||||
foreach ($clients as $c)
|
foreach ($clients as $c) {
|
||||||
echo "$c\n";
|
$size = intval(exec("du -s .data/$c"));
|
||||||
|
echo "$c ($size kB)\n";
|
||||||
|
}
|
||||||
} else if ($format === 'json') {
|
} else if ($format === 'json') {
|
||||||
header('Content-Type: application/json; charset=UTF-8');
|
header('Content-Type: application/json; charset=UTF-8');
|
||||||
echo "{\"data\": [";
|
echo "{\"data\": [";
|
||||||
$first = true;
|
$first = true;
|
||||||
foreach ($clients as $c) {
|
foreach ($clients as $c) {
|
||||||
if (!$first) echo ",";
|
if (!$first) echo ",";
|
||||||
echo "\n {\"name\": \"$c\"}";
|
$size = intval(exec("du -s .data/$c")) * 1024;
|
||||||
|
echo "\n {\"name\": \"$c\", \"space_used\": $size}";
|
||||||
$first = false;
|
$first = false;
|
||||||
}
|
}
|
||||||
echo "\n]}\n";
|
echo "\n]}\n";
|
||||||
@@ -122,10 +125,11 @@ if ($path == '') {
|
|||||||
<h3>Mandanten</h3>
|
<h3>Mandanten</h3>
|
||||||
<p class="center"><a href="https://elwig.at/">Homepage</a></p>
|
<p class="center"><a href="https://elwig.at/">Homepage</a></p>
|
||||||
<table>
|
<table>
|
||||||
<thead><tr><th>Name</th></tr></thead>
|
<thead><tr><th>Name</th><th>Used</th></tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($clients as $c) {
|
<?php foreach ($clients as $c) {
|
||||||
echo " <tr><td><a href='$c'>$c</a></td></tr>\n";
|
$size = intval(exec("du -s .data/$c"));
|
||||||
|
echo " <tr><td><a href='$c'>$c</a></td><td class='right'>$size kB</td></tr>\n";
|
||||||
} ?>
|
} ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -159,7 +163,8 @@ foreach ($clients as $c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
header('Content-Type: application/json; charset=UTF-8');
|
header('Content-Type: application/json; charset=UTF-8');
|
||||||
echo "{\"data\": [\n";
|
$size = intval(exec("du -s .data/$c")) * 1024;
|
||||||
|
echo "{\"used_space\": $size, \"data\": [\n";
|
||||||
$first = true;
|
$first = true;
|
||||||
foreach (scandir(".data/$c/") as $file) {
|
foreach (scandir(".data/$c/") as $file) {
|
||||||
if (str_starts_with($file, ".") || str_ends_with($file, ".php") || str_ends_with($file, ".inc")) continue;
|
if (str_starts_with($file, ".") || str_ends_with($file, ".php") || str_ends_with($file, ".inc")) continue;
|
||||||
|
@@ -154,6 +154,10 @@ main section h3 {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
main section p,
|
main section p,
|
||||||
main section table {
|
main section table {
|
||||||
max-width: 1000px;
|
max-width: 1000px;
|
||||||
|
Reference in New Issue
Block a user