Skip to content

Commit

Permalink
Merge pull request #35308 from nextcloud/bugfix/34961/user-mgmt-quota…
Browse files Browse the repository at this point in the history
…-no-cache

Don't use quota cache through user management
  • Loading branch information
szaimen authored Nov 21, 2022
2 parents 83badcb + 0b09531 commit 09345f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/provisioning_api/lib/Controller/AUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ protected function fillStorageInfo(string $userId): array {
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'],
Expand Down
12 changes: 8 additions & 4 deletions lib/private/legacy/OC_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,12 @@ public static function findBinaryPath(string $program): ?string {
*
* @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');
Expand All @@ -470,9 +472,11 @@ public static function getStorageInfo($path, $rootInfo = null, $includeMountPoin

$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) {
Expand Down

0 comments on commit 09345f7

Please sign in to comment.