Use global used space in quota wrappen when external storage is included
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
64a29d01a4
commit
c32750ddd9
1 changed files with 18 additions and 9 deletions
|
@ -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();
|
||||
if ($this->config->getValue('quota_include_external_storage', false)) {
|
||||
$rootInfo = Filesystem::getFileInfo('', 'ext');
|
||||
return $rootInfo->getSize(true);
|
||||
} 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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue