1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-01-28 14:39:28 +01:00
Thomas Zilio 259a9b45eb Fix #590
Correzione commit d1df844cbb9f24ca27a1ddb7578915b6b61d6440
2019-06-04 20:45:40 +02:00

49 lines
1.1 KiB
PHP

<?php
use Util\FileSystem;
switch ($resource) {
case 'folder_size':
$dirs = $_GET['dirs'];
if (empty($dirs)) {
$backup_dir = App::getConfig()['backup_dir'];
$dirs = [
$backup_dir => tr('Backup'),
'files' => tr('Allegati'),
'logs' => tr('Logs'),
];
} else {
$array = explode(',', $dirs);
foreach ($array as $key => $value) {
$dirs = [
$value => $key,
];
}
}
$tot_byte_size = 0;
foreach ($dirs as $dir => $description) {
$size = FileSystem::folderSize($dir);
$results[] = [
'description' => $description,
'size' => $size,
'formattedSize' => FileSystem::formatBytes($size),
];
$tot_byte_size += $size;
}
$results[count($dirs)]['totalbyte'] = $tot_byte_size;
$response = $results;
break;
}
return [
'folder_size',
];