summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-01-27 15:41:56 +0100
committerRobin Appelman <icewind@owncloud.com>2014-01-27 15:41:56 +0100
commita521949bafdaba0cb94061967b6b8307bbbebc05 (patch)
tree62ddb3df37ca695ed4ff40b79594cbf26f4f561e /lib
parentd182b4f59fd7b172764a4d802dbd3ee6a953ea39 (diff)
downloadnextcloud-server-a521949bafdaba0cb94061967b6b8307bbbebc05.tar.gz
nextcloud-server-a521949bafdaba0cb94061967b6b8307bbbebc05.zip
Allow passing a root folder to get the used space from in the quota wrapper
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/storage/wrapper/quota.php8
-rwxr-xr-xlib/private/util.php2
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php
index a430e3e4617..83a5de5ca30 100644
--- a/lib/private/files/storage/wrapper/quota.php
+++ b/lib/private/files/storage/wrapper/quota.php
@@ -16,11 +16,17 @@ class Quota extends Wrapper {
protected $quota;
/**
+ * @var string $freeSpaceRoot
+ */
+ protected $sizeRoot;
+
+ /**
* @param array $parameters
*/
public function __construct($parameters) {
$this->storage = $parameters['storage'];
$this->quota = $parameters['quota'];
+ $this->freeSpaceRoot = isset($parameters['root']) ? $parameters['root'] : '';
}
protected function getSize($path) {
@@ -43,7 +49,7 @@ class Quota extends Wrapper {
if ($this->quota < 0) {
return $this->storage->free_space($path);
} else {
- $used = $this->getSize('');
+ $used = $this->getSize($this->freeSpaceRoot);
if ($used < 0) {
return \OC\Files\SPACE_NOT_COMPUTED;
} else {
diff --git a/lib/private/util.php b/lib/private/util.php
index 8aa7a074d0d..66a770a33dc 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -65,7 +65,7 @@ class OC_Util {
$user = $storage->getUser()->getUID();
$quota = OC_Util::getUserQuota($user);
if ($quota !== \OC\Files\SPACE_UNLIMITED) {
- return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota));
+ return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota, 'root' => 'files'));
}
}