Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-08-27 02:57:28 +0400
committerMorris Jobke <morris.jobke@gmail.com>2013-08-27 12:53:47 +0400
commit17dfdcc6456fa2facd1f99af0d7228d88d03396a (patch)
treee30d4f68be12c0421011ccdc1a44fcdfad19d251 /lib/helper.php
parente6f01380f7dc92ff9e1e63e008d04c44b4d3603e (diff)
webdav quota now displays the same values as the web interface does
Conflicts: lib/helper.php
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/helper.php b/lib/helper.php
index c67f1e86e14..d987d972431 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -807,18 +807,26 @@ class OC_Helper {
/**
* Calculate the disc space
*/
- public static function getStorageInfo() {
- $rootInfo = \OC\Files\Filesystem::getFileInfo('/');
+ public static function getStorageInfo($path = '/') {
+ $rootInfo = \OC\Files\Filesystem::getFileInfo($path);
$used = $rootInfo['size'];
if ($used < 0) {
$used = 0;
}
- $free = \OC\Files\Filesystem::free_space();
- $total = $free + $used;
+ $free = \OC\Files\Filesystem::free_space($path);
+ if ($free >= 0) {
+ $total = $free + $used;
+ } else {
+ $total = $free; //either unknown or unlimited
+ }
if ($total == 0) {
$total = 1; // prevent division by zero
}
- $relative = round(($used / $total) * 10000) / 100;
+ if ($total >= 0) {
+ $relative = round(($used / $total) * 10000) / 100;
+ } else {
+ $relative = 0;
+ }
return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative);
}