mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
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 <vincent@nextcloud.com>
This commit is contained in:
parent
d0c72cc11a
commit
0b09531dc6
2 changed files with 9 additions and 5 deletions
|
|
@ -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'],
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue