diff options
author | Robin Appelman <robin@icewind.nl> | 2023-08-15 18:33:57 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2023-09-07 16:25:23 +0200 |
commit | ee8c1a5c609743ba1d73d5f317bd6db050827329 (patch) | |
tree | 297b0025b35a4e4f2159e41c878d212ec80b5332 /lib | |
parent | 9242e8939fefc97aece696ea5c190029b5ed43c7 (diff) | |
download | nextcloud-server-ee8c1a5c609743ba1d73d5f317bd6db050827329.tar.gz nextcloud-server-ee8c1a5c609743ba1d73d5f317bd6db050827329.zip |
only determine quota_include_external_storage once for quota wrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/SetupManager.php | 5 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Quota.php | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index dfc496524a8..916fcfb0a7e 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -156,7 +156,8 @@ class SetupManager { return $storage; }); - Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) { + $quotaIncludeExternal = $this->config->getSystemValue('quota_include_external_storage', false); + Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) use ($quotaIncludeExternal) { // set up quota for home storages, even for other users // which can happen when using sharing @@ -168,7 +169,7 @@ class SetupManager { $user = $storage->getUser(); return new Quota(['storage' => $storage, 'quotaCallback' => function () use ($user) { return OC_Util::getUserQuota($user); - }, 'root' => 'files']); + }, 'root' => 'files', 'include_external_storage' => $quotaIncludeExternal]); } } diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index cfb2c455a2c..b13aa6f9f04 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -45,6 +45,7 @@ class Quota extends Wrapper { protected int|float|null $quota; protected string $sizeRoot; private SystemConfig $config; + private bool $quotaIncludeExternalStorage; /** * @param array $parameters @@ -54,7 +55,7 @@ class Quota extends Wrapper { $this->quota = $parameters['quota'] ?? null; $this->quotaCallback = $parameters['quotaCallback'] ?? null; $this->sizeRoot = $parameters['root'] ?? ''; - $this->config = \OC::$server->get(SystemConfig::class); + $this->quotaIncludeExternalStorage = $parameters['include_external_storage'] ?? false; } /** @@ -82,7 +83,7 @@ class Quota extends Wrapper { * @return int|float */ protected function getSize($path, $storage = null) { - if ($this->config->getValue('quota_include_external_storage', false)) { + if ($this->quotaIncludeExternalStorage) { $rootInfo = Filesystem::getFileInfo('', 'ext'); if ($rootInfo) { return $rootInfo->getSize(true); |