X-Git-Url: https://git.p6c8.net/jirafeau.git/blobdiff_plain/41cde93bc152ccd48b5fc25d652d288a6a0af016..2b4714c704f8ca5567c85a26e9202d5c9b3550e4:/lib/functions.php diff --git a/lib/functions.php b/lib/functions.php index 058d53e..84f2a44 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1344,3 +1344,12 @@ function jirafeau_admin_csrf_field() { return ""; } + +function jirafeau_dir_size($dir) +{ + $size = 0; + foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $entry) { + $size += is_file($entry) ? filesize($entry) : jirafeau_dir_size($entry); + } + return $size; +}