Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Don't use quota cache through user management
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 <[email protected]>
  • Loading branch information
PVince81 committed Nov 21, 2022
commit 0b09531dc66f6a82fd1db997ceff85b1407f01fa
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