diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-03-24 21:36:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-24 21:36:01 +0100 |
commit | b300dc5a503d0739e4b8201f5549788366bb5ca1 (patch) | |
tree | c24b7a85ebc619b51665342dbdb1bf925c93fc23 /lib/private/Files | |
parent | f85d7fee1759ff57988f081813e65835a35f70f1 (diff) | |
parent | c32750ddd99a6ce20359a68397b21cbe12241004 (diff) | |
download | nextcloud-server-b300dc5a503d0739e4b8201f5549788366bb5ca1.tar.gz nextcloud-server-b300dc5a503d0739e4b8201f5549788366bb5ca1.zip |
Merge pull request #19782 from nextcloud/quota-wrapper-include-external
Use global used space in quota wrappen when external storage is included
Diffstat (limited to 'lib/private/Files')
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Quota.php | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index b5a1be95aaf..d4e4be41f71 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -29,6 +29,7 @@ namespace OC\Files\Storage\Wrapper; +use OC\Files\Filesystem; use OCP\Files\Cache\ICacheEntry; use OCP\Files\Storage\IStorage; @@ -44,6 +45,8 @@ class Quota extends Wrapper { */ protected $sizeRoot; + private $config; + /** * @param array $parameters */ @@ -51,6 +54,7 @@ class Quota extends Wrapper { parent::__construct($parameters); $this->quota = $parameters['quota']; $this->sizeRoot = isset($parameters['root']) ? $parameters['root'] : ''; + $this->config = \OC::$server->getSystemConfig(); } /** @@ -65,16 +69,21 @@ class Quota extends Wrapper { * @param \OC\Files\Storage\Storage $storage */ protected function getSize($path, $storage = null) { - if (is_null($storage)) { - $cache = $this->getCache(); - } else { - $cache = $storage->getCache(); - } - $data = $cache->get($path); - if ($data instanceof ICacheEntry and isset($data['size'])) { - return $data['size']; + if ($this->config->getValue('quota_include_external_storage', false)) { + $rootInfo = Filesystem::getFileInfo('', 'ext'); + return $rootInfo->getSize(true); } else { - return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED; + if (is_null($storage)) { + $cache = $this->getCache(); + } else { + $cache = $storage->getCache(); + } + $data = $cache->get($path); + if ($data instanceof ICacheEntry and isset($data['size'])) { + return $data['size']; + } else { + return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED; + } } } |