X-Git-Url: https://git.p6c8.net/jirafeau_project.git/blobdiff_plain/41cde93bc152ccd48b5fc25d652d288a6a0af016..14d3c112ee8c8bd2ad02ed2da23e48ad68b22130:/lib/functions.php diff --git a/lib/functions.php b/lib/functions.php index 058d53e..5c5fea7 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -2,7 +2,7 @@ /* * Jirafeau, your web file repository * Copyright (C) 2008 Julien "axolotl" BERNARD - * Copyright (C) 2015 Jerome Jutteau + * Copyright (C) 2015 Jerome Jutteau * Copyright (C) 2015 Nicola Spanti (RyDroid) * * This program is free software: you can redistribute it and/or modify @@ -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; +}