summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-01-26 04:15:40 -0800
committerThomas Müller <thomas.mueller@tmit.eu>2013-01-26 04:15:40 -0800
commit276d98b9ddd18c216956b2c9916583e8098186d0 (patch)
treeeafc40da091c41e8e40d5ce9948c85b0dbe976dc /lib
parent3b547895ec0c8b076bf31abdb53079ba8fa983db (diff)
parent5d6c1d52bdb5aa3addc26d1e105749a8eda35301 (diff)
downloadnextcloud-server-276d98b9ddd18c216956b2c9916583e8098186d0.tar.gz
nextcloud-server-276d98b9ddd18c216956b2c9916583e8098186d0.zip
Merge pull request #1059 from owncloud/fixing-998-master
Fixing 998 master
Diffstat (limited to 'lib')
-rw-r--r--lib/helper.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/helper.php b/lib/helper.php
index a7b2a429952..d2c6b1695bd 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);
+ }
}