summaryrefslogtreecommitdiffstats
path: root/lib/helper.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-01-26 18:49:45 +0100
committerRobin Appelman <icewind@owncloud.com>2013-01-26 18:49:45 +0100
commit930b9b9cd0e60170549485164f33b5fc004d7ca2 (patch)
treefa966587794f11861e4e46f52957840de6cb4a4a /lib/helper.php
parentf85838177596b3214430e750b5425bfe3c0cde86 (diff)
parentc9e25d3fab17b178759dd6d2f9488aa4cf37fbbb (diff)
downloadnextcloud-server-930b9b9cd0e60170549485164f33b5fc004d7ca2.tar.gz
nextcloud-server-930b9b9cd0e60170549485164f33b5fc004d7ca2.zip
merge master into filesystem
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/helper.php b/lib/helper.php
index d7b57d381dc..1dd11cce041 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -785,4 +785,23 @@ class OC_Helper {
}
return true;
}
+
+ /**
+ * Calculate the disc space
+ */
+ public static function getStorageInfo() {
+ $rootInfo = OC_FileCache::get('');
+ $used = $rootInfo['size'];
+ if ($used < 0) {
+ $used = 0;
+ }
+ $free = OC_Filesystem::free_space();
+ $total = $free + $used;
+ if ($total == 0) {
+ $total = 1; // prevent division by zero
+ }
+ $relative = round(($used / $total) * 10000) / 100;
+
+ return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative);
+ }
}