mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user