Skip to content

Commit 30b2b86

Browse files
authored
Merge pull request #35312 from nextcloud/stable25-user-mgmt-quota-no-cache
[stable25] Don't use quota cache through user management
2 parents daba112 + 5ed9925 commit 30b2b86

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

apps/provisioning_api/lib/Controller/AUserData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ protected function fillStorageInfo(string $userId): array {
245245
try {
246246
\OC_Util::tearDownFS();
247247
\OC_Util::setupFS($userId);
248-
$storage = OC_Helper::getStorageInfo('/');
248+
$storage = OC_Helper::getStorageInfo('/', null, true, false);
249249
$data = [
250250
'free' => $storage['free'],
251251
'used' => $storage['used'],

lib/private/legacy/OC_Helper.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,12 @@ public static function findBinaryPath(string $program): ?string {
457457
*
458458
* @param string $path
459459
* @param \OCP\Files\FileInfo $rootInfo (optional)
460+
* @param bool $includeMountPoints whether to include mount points in the size calculation
461+
* @param bool $useCache whether to use the cached quota values
460462
* @return array
461463
* @throws \OCP\Files\NotFoundException
462464
*/
463-
public static function getStorageInfo($path, $rootInfo = null, $includeMountPoints = true) {
465+
public static function getStorageInfo($path, $rootInfo = null, $includeMountPoints = true, $useCache = true) {
464466
/** @var ICacheFactory $cacheFactory */
465467
$cacheFactory = \OC::$server->get(ICacheFactory::class);
466468
$memcache = $cacheFactory->createLocal('storage_info');
@@ -470,9 +472,11 @@ public static function getStorageInfo($path, $rootInfo = null, $includeMountPoin
470472

471473
$fullPath = Filesystem::getView()->getAbsolutePath($path);
472474
$cacheKey = $fullPath. '::' . ($includeMountPoints ? 'include' : 'exclude');
473-
$cached = $memcache->get($cacheKey);
474-
if ($cached) {
475-
return $cached;
475+
if ($useCache) {
476+
$cached = $memcache->get($cacheKey);
477+
if ($cached) {
478+
return $cached;
479+
}
476480
}
477481

478482
if (!$rootInfo) {

0 commit comments

Comments
 (0)