X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/41cde93bc152ccd48b5fc25d652d288a6a0af016..880e59e188149478221d2af9f76599ac07ff843b:/lib/functions.php?ds=sidebyside 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; +}