Merge pull request #35308 from nextcloud/bugfix/34961/user-mgmt-quota-no-cache

Don't use quota cache through user management
This commit is contained in:
Simon L 2022-11-21 18:39:31 +01:00 committed by GitHub
commit 09345f762b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View 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'],

View 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) {