Skip to content

Commit

Permalink
Fixed #1157: Media size is not reported correctly in the 'middle' pan…
Browse files Browse the repository at this point in the history
…el of the workspace
  • Loading branch information
torinfo committed Aug 29, 2022
1 parent de15785 commit 82bcd41
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions website_code/php/properties/properties_library.php
Expand Up @@ -706,6 +706,27 @@ function statistics_prepare($template_id, $force=false)
return $info;
}

function folder_size($dir_path)
{
$quota = 0;
$d = opendir($dir_path);

while ($f = readdir($d)) {
$full = $dir_path . "/" . $f;
if (!is_dir($full)) {
$quota += filesize($full);
}
else
{
if ($f != "." && $f != "..") {
$quota += folder_size($full);
}
}
}
closedir($d);
return $quota;
}

function media_quota_info($template_id)
{
global $xerte_toolkits_site;
Expand Down Expand Up @@ -744,14 +765,7 @@ function media_quota_info($template_id)

if (file_exists($dir_path))
{
$d = opendir($dir_path);

while ($f = readdir($d)) {
$full = $dir_path . "/" . $f;
if (!is_dir($full)) {
$quota += filesize($full);
}
}
$quota += folder_size($dir_path);
$info = PROJECT_INFO_MEDIA . ": ";
$info .= (round($quota/10000, 0)/100) . " MB<br/>";
return $info;
Expand Down

0 comments on commit 82bcd41

Please sign in to comment.