diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-05-07 10:11:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-07 10:11:04 +0200 |
commit | 0da6f6b35699f85f20a8414da60290ef15b2788c (patch) | |
tree | 2d4db6e16e1d4be0538bb7373efbc1be374fe66a /lib | |
parent | 94e3bdf703a5d0b61869701d69d926ccf11b7719 (diff) | |
parent | f2d05120b4af7424b6aadcab5817e4b8a059370f (diff) | |
download | nextcloud-server-0da6f6b35699f85f20a8414da60290ef15b2788c.tar.gz nextcloud-server-0da6f6b35699f85f20a8414da60290ef15b2788c.zip |
Merge pull request #9371 from nextcloud/bugfix/7444
Cache is not part of the quota
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Quota.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index 22338f9c3cc..28ae03d604b 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -46,7 +46,7 @@ class Quota extends Wrapper { * @param array $parameters */ public function __construct($parameters) { - $this->storage = $parameters['storage']; + parent::__construct($parameters); $this->quota = $parameters['quota']; $this->sizeRoot = isset($parameters['root']) ? $parameters['root'] : ''; } @@ -83,7 +83,7 @@ class Quota extends Wrapper { * @return int */ public function free_space($path) { - if ($this->quota < 0) { + if ($this->quota < 0 || strpos($path, 'cache') === 0) { return $this->storage->free_space($path); } else { $used = $this->getSize($this->sizeRoot); @@ -111,7 +111,7 @@ class Quota extends Wrapper { * @return bool */ public function file_put_contents($path, $data) { - $free = $this->free_space(''); + $free = $this->free_space($path); if ($free < 0 or strlen($data) < $free) { return $this->storage->file_put_contents($path, $data); } else { @@ -127,7 +127,7 @@ class Quota extends Wrapper { * @return bool */ public function copy($source, $target) { - $free = $this->free_space(''); + $free = $this->free_space($target); if ($free < 0 or $this->getSize($source) < $free) { return $this->storage->copy($source, $target); } else { @@ -147,7 +147,7 @@ class Quota extends Wrapper { // don't apply quota for part files if (!$this->isPartFile($path)) { - $free = $this->free_space(''); + $free = $this->free_space($path); if ($source && $free >= 0 && $mode !== 'r' && $mode !== 'rb') { // only apply quota for files, not metadata, trash or others if (strpos(ltrim($path, '/'), 'files/') === 0) { @@ -178,7 +178,7 @@ class Quota extends Wrapper { * @return bool */ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { - $free = $this->free_space(''); + $free = $this->free_space($targetInternalPath); if ($free < 0 or $this->getSize($sourceInternalPath, $sourceStorage) < $free) { return $this->storage->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } else { @@ -193,7 +193,7 @@ class Quota extends Wrapper { * @return bool */ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { - $free = $this->free_space(''); + $free = $this->free_space($targetInternalPath); if ($free < 0 or $this->getSize($sourceInternalPath, $sourceStorage) < $free) { return $this->storage->moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } else { |