X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/41cde93bc152ccd48b5fc25d652d288a6a0af016..429e5a72512e62f2fff0c3992d20a73ddb9dd300:/lib/functions.php?ds=sidebyside

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 <axolotl@magieeternelle.org>
- *  Copyright (C) 2015  Jerome Jutteau <j.jutteau@gmail.com>
+ *  Copyright (C) 2015  Jerome Jutteau <jerome@jutteau.fr>
  *  Copyright (C) 2015  Nicola Spanti (RyDroid) <dev@nicola-spanti.info>
  *
  *  This program is free software: you can redistribute it and/or modify
@@ -1344,3 +1344,12 @@ function jirafeau_admin_csrf_field()
 {
     return "<input type='hidden' name='admin_csrf' value='". $_SESSION['admin_csrf'] . "'/>";
 }
+
+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;
+}