summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-11 12:40:59 +0100
committerVincent Petry <pvince81@owncloud.com>2014-03-11 12:40:59 +0100
commitc1cb9ee9b0b19e17ddde046642fa01d52cda63bf (patch)
tree47d902d6242697deb3145e1cbec689964e3cc6ee /lib/private
parenta53df71b4adf9133b0d32547360dceb083ef0a6c (diff)
parent010eef95c0c5cebd03b03645d29847638e064bd5 (diff)
downloadnextcloud-server-c1cb9ee9b0b19e17ddde046642fa01d52cda63bf.tar.gz
nextcloud-server-c1cb9ee9b0b19e17ddde046642fa01d52cda63bf.zip
Merge pull request #7650 from owncloud/quota-totalspace
Fixed total space display when data size exceeds quota
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/files/storage/wrapper/quota.php7
-rw-r--r--lib/private/helper.php11
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php
index ea612735477..32ceba8b196 100644
--- a/lib/private/files/storage/wrapper/quota.php
+++ b/lib/private/files/storage/wrapper/quota.php
@@ -30,6 +30,13 @@ class Quota extends Wrapper {
}
/**
+ * @return quota value
+ */
+ public function getQuota() {
+ return $this->quota;
+ }
+
+ /**
* @param string $path
*/
protected function getSize($path) {
diff --git a/lib/private/helper.php b/lib/private/helper.php
index b9956d5ec1c..0b1a26bbecd 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -914,13 +914,22 @@ class OC_Helper {
if ($used < 0) {
$used = 0;
}
- $free = \OC\Files\Filesystem::free_space($path);
+ $quota = 0;
+ // TODO: need a better way to get total space from storage
+ $storage = $rootInfo->getStorage();
+ if ($storage instanceof \OC\Files\Storage\Wrapper\Quota) {
+ $quota = $storage->getQuota();
+ }
+ $free = $storage->free_space('');
if ($free >= 0) {
$total = $free + $used;
} else {
$total = $free; //either unknown or unlimited
}
if ($total > 0) {
+ if ($quota > 0 && $total > $quota) {
+ $total = $quota;
+ }
// prevent division by zero or error codes (negative values)
$relative = round(($used / $total) * 10000) / 100;
} else {