diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-03-10 15:19:18 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-03-10 17:59:14 +0100 |
commit | 010eef95c0c5cebd03b03645d29847638e064bd5 (patch) | |
tree | b44bd736a2b3fee1d2abde614653f7d9317d448d /lib/private/helper.php | |
parent | 3eb58d9973706b1cc3f51f024e362779d278ee49 (diff) | |
download | nextcloud-server-010eef95c0c5cebd03b03645d29847638e064bd5.tar.gz nextcloud-server-010eef95c0c5cebd03b03645d29847638e064bd5.zip |
Fixed total space display when data size exceeds quota
The total space display in the personal page now shows the quota value
instead of used space when used space exceeds the quota (soft quota).
Diffstat (limited to 'lib/private/helper.php')
-rw-r--r-- | lib/private/helper.php | 11 |
1 files changed, 10 insertions, 1 deletions
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 { |