diff --git a/website_code/php/properties/properties_library.php b/website_code/php/properties/properties_library.php index bf96f0e7b..7cb1cd923 100644 --- a/website_code/php/properties/properties_library.php +++ b/website_code/php/properties/properties_library.php @@ -705,6 +705,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; @@ -743,14 +764,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
"; return $info;