From a521949bafdaba0cb94061967b6b8307bbbebc05 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 27 Jan 2014 15:41:56 +0100 Subject: Allow passing a root folder to get the used space from in the quota wrapper --- lib/private/files/storage/wrapper/quota.php | 8 +++++++- lib/private/util.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/private') 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 @@ -15,12 +15,18 @@ 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')); } } -- cgit v1.2.3 From c8207312c73f61b2be4aa8ca1d9ae6a8c33453cf Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 27 Jan 2014 16:00:10 +0100 Subject: Fix phpdoc --- lib/private/files/storage/wrapper/quota.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/private') diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php index 83a5de5ca30..2fc3119fc7d 100644 --- a/lib/private/files/storage/wrapper/quota.php +++ b/lib/private/files/storage/wrapper/quota.php @@ -16,7 +16,7 @@ class Quota extends Wrapper { protected $quota; /** - * @var string $freeSpaceRoot + * @var string $sizeRoot */ protected $sizeRoot; -- cgit v1.2.3 From 20c2aaab00e92d74547ccd6c964102e10ea34cbf Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 27 Jan 2014 16:26:54 +0100 Subject: Actually rename the variable --- lib/private/files/storage/wrapper/quota.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/private') diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php index 2fc3119fc7d..16127403181 100644 --- a/lib/private/files/storage/wrapper/quota.php +++ b/lib/private/files/storage/wrapper/quota.php @@ -26,7 +26,7 @@ class Quota extends Wrapper { public function __construct($parameters) { $this->storage = $parameters['storage']; $this->quota = $parameters['quota']; - $this->freeSpaceRoot = isset($parameters['root']) ? $parameters['root'] : ''; + $this->sizeRoot = isset($parameters['root']) ? $parameters['root'] : ''; } protected function getSize($path) { @@ -49,7 +49,7 @@ class Quota extends Wrapper { if ($this->quota < 0) { return $this->storage->free_space($path); } else { - $used = $this->getSize($this->freeSpaceRoot); + $used = $this->getSize($this->sizeRoot); if ($used < 0) { return \OC\Files\SPACE_NOT_COMPUTED; } else { -- cgit v1.2.3 From f830ad0e47df14e821161c49ab1b52694f74912a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 4 Feb 2014 16:28:41 +0100 Subject: Don't create new thumbnails on the write hook --- lib/private/image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/private') diff --git a/lib/private/image.php b/lib/private/image.php index 7761a3c7737..a6a2413f59f 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -230,7 +230,7 @@ class OC_Image { } /** - * @returns Returns the image resource in any. + * @returns resource Returns the image resource in any. */ public function resource() { return $this->resource; -- cgit v1.2.3