From 0f43d1dfaa2799f10c070a6d5f825fb3430bea4d Mon Sep 17 00:00:00 2001 From: Felix Nieuwenhuizen Date: Sat, 2 Mar 2019 13:44:47 +0100 Subject: [PATCH] use node API for free space calculation in versions app (same method as trashbin app) Signed-off-by: Felix Nieuwenhuizen --- apps/files_versions/lib/Storage.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index e2e4888cbc..4ed3977435 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -750,9 +750,11 @@ class Storage { // subtract size of files and current versions size from quota if ($quota >= 0) { if ($softQuota) { - $files_view = new View('/' . $uid . '/files'); - $rootInfo = $files_view->getFileInfo('/', false); - $free = $quota - $rootInfo['size']; // remaining free space for user + $userFolder = \OC::$server->getUserFolder($uid); + if(is_null($userFolder)) { + return 0; + } + $free = $quota - $userFolder->getSize(false); // remaining free space for user if ($free > 0) { $availableSpace = ($free * self::DEFAULTMAXSIZE / 100) - $versionsSize; // how much space can be used for versions } else {