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 // subtract size of files and current versions size from quota
if ($quota >= 0) { if ($quota >= 0) {
if ($softQuota) { if ($softQuota) {
$files_view = new View('/' . $uid . '/files'); $userFolder = \OC::$server->getUserFolder($uid);
$rootInfo = $files_view->getFileInfo('/', false); if(is_null($userFolder)) {
$free = $quota - $rootInfo['size']; // remaining free space for user return 0;
}
$free = $quota - $userFolder->getSize(false); // remaining free space for user
if ($free > 0) { if ($free > 0) {
$availableSpace = ($free * self::DEFAULTMAXSIZE / 100) - $versionsSize; // how much space can be used for versions $availableSpace = ($free * self::DEFAULTMAXSIZE / 100) - $versionsSize; // how much space can be used for versions
} else { } else {