]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't use quota cache through user management 35308/head
authorVincent Petry <vincent@nextcloud.com>
Mon, 21 Nov 2022 15:21:25 +0000 (16:21 +0100)
committerVincent Petry <vincent@nextcloud.com>
Mon, 21 Nov 2022 15:24:22 +0000 (16:24 +0100)
When querying the free space through user management APIs, don't use the
cached quota value. The latter is only there to accelerate PROPFINDs.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
apps/provisioning_api/lib/Controller/AUserData.php
lib/private/legacy/OC_Helper.php

index f2fbea7b04f90b5581ce9404bc7871a62038ee8a..0fc2bb6f0d3d0d12268b42371e500a99fc6331ea 100644 (file)
@@ -245,7 +245,7 @@ abstract class AUserData extends OCSController {
                try {
                        \OC_Util::tearDownFS();
                        \OC_Util::setupFS($userId);
-                       $storage = OC_Helper::getStorageInfo('/');
+                       $storage = OC_Helper::getStorageInfo('/', null, true, false);
                        $data = [
                                'free' => $storage['free'],
                                'used' => $storage['used'],
index b793029e1f1f659cb1b583c6e8ebe1d72463e28c..3b409fd1d04060b841eb94a05e6b32950e7da86f 100644 (file)
@@ -457,10 +457,12 @@ class OC_Helper {
         *
         * @param string $path
         * @param \OCP\Files\FileInfo $rootInfo (optional)
+        * @param bool $includeMountPoints whether to include mount points in the size calculation
+        * @param bool $useCache whether to use the cached quota values
         * @return array
         * @throws \OCP\Files\NotFoundException
         */
-       public static function getStorageInfo($path, $rootInfo = null, $includeMountPoints = true) {
+       public static function getStorageInfo($path, $rootInfo = null, $includeMountPoints = true, $useCache = true) {
                /** @var ICacheFactory $cacheFactory */
                $cacheFactory = \OC::$server->get(ICacheFactory::class);
                $memcache = $cacheFactory->createLocal('storage_info');
@@ -470,9 +472,11 @@ class OC_Helper {
 
                $fullPath = Filesystem::getView()->getAbsolutePath($path);
                $cacheKey = $fullPath. '::' . ($includeMountPoints ? 'include' : 'exclude');
-               $cached = $memcache->get($cacheKey);
-               if ($cached) {
-                       return $cached;
+               if ($useCache) {
+                       $cached = $memcache->get($cacheKey);
+                       if ($cached) {
+                               return $cached;
+                       }
                }
 
                if (!$rootInfo) {