prettify device edit form, move foldersize() to functions.inc.php

git-svn-id: http://www.observium.org/svn/observer/trunk@2551 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-09-23 10:16:31 +00:00
parent b4e93857c5
commit 40a9e83ee6
2 changed files with 73 additions and 59 deletions

View File

@@ -511,4 +511,29 @@ function getlocations()
return $locations;
}
function foldersize($path)
{
$total_size = 0;
$files = scandir($path);
$total_files = 0;
foreach($files as $t)
{
if (is_dir(rtrim($path, '/') . '/' . $t))
{
if ($t<>"." && $t<>"..")
{
$size = foldersize(rtrim($path, '/') . '/' . $t);
$total_size += $size;
}
} else {
$size = filesize(rtrim($path, '/') . '/' . $t);
$total_size += $size;
$total_files++;
}
}
return array($total_size, $total_files);
}
?>