diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-03-05 09:40:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-05 09:40:11 +0100 |
commit | ede5f4486a39a6eb4b134953968a328eb641fb8d (patch) | |
tree | 0e23c500f3d5943ba33bca54bc649e334326dfa3 /apps | |
parent | c72b4422038c08806a135e31333db7b41749ea58 (diff) | |
parent | 56457505af5446c6c0d9e8ef39d47f19b79185e6 (diff) | |
download | nextcloud-server-ede5f4486a39a6eb4b134953968a328eb641fb8d.tar.gz nextcloud-server-ede5f4486a39a6eb4b134953968a328eb641fb8d.zip |
Merge pull request #14470 from felixn/master
use node API for free space calculation in versions app
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_versions/lib/Storage.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index e2e4888cbce..c09633be3c1 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -750,13 +750,16 @@ 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 - if ($free > 0) { - $availableSpace = ($free * self::DEFAULTMAXSIZE / 100) - $versionsSize; // how much space can be used for versions + $userFolder = \OC::$server->getUserFolder($uid); + if(is_null($userFolder)) { + $availableSpace = 0; } else { - $availableSpace = $free - $versionsSize; + $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 { + $availableSpace = $free - $versionsSize; + } } } else { $availableSpace = $quota; |