From 71accc61eb6474935434e2973e360a63dec8112e Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 05 Sep 2013 09:51:06 -0400
Subject: [PATCH] - Added DB size report in monitor. Thanks to Florian for the patch!

---
 interface/lib/classes/functions.inc.php |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php
index 74f8400..661e557 100644
--- a/interface/lib/classes/functions.inc.php
+++ b/interface/lib/classes/functions.inc.php
@@ -322,7 +322,13 @@
             return intval($string);
         }
     }
-    
+
+    public function formatBytes($size, $precision = 2) {
+        $base=log($size)/log(1024);
+        $suffixes=array('','k','M','G','T');
+        return round(pow(1024,$base-floor($base)),$precision).$suffixes[floor($base)];
+    }
+
     /** IDN converter wrapper.
      * all converter classes should be placed in ISPC_CLASS_PATH.'/idn/'
      */
@@ -395,4 +401,4 @@
 		
 }
 
-?>
\ No newline at end of file
+?>

--
Gitblit v1.9.1