use node API for free space calculation in versions app (same method as trashbin app)

Signed-off-by: Felix Nieuwenhuizen <felix@tdlrali.com>
This commit is contained in:
Felix Nieuwenhuizen 2019-03-02 13:44:47 +01:00
parent 1cfa870821
commit 0f43d1dfaa
1 changed files with 5 additions and 3 deletions

View File

@ -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 {