diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-17 10:58:31 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-17 10:58:31 +0100 |
commit | 9e415a956af39692e470fab5b48ffaa787ffe3f5 (patch) | |
tree | f3da24bd52b5d439dff494b33916e68b09bcf0af /apps/files_trashbin | |
parent | 774109b7628aa62a1975f7c2dea4f8280f563b28 (diff) | |
parent | de58364eb850a918ed84df84983c620b31493606 (diff) | |
download | nextcloud-server-9e415a956af39692e470fab5b48ffaa787ffe3f5.tar.gz nextcloud-server-9e415a956af39692e470fab5b48ffaa787ffe3f5.zip |
Merge pull request #22451 from owncloud/use-proper-user-folder
Handles null as return code and uses proper UserFolder in trashbin
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/lib/trashbin.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index c91cfe082fd..62d70d7356a 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -561,11 +561,12 @@ class Trashbin { * @return int available free space for trash bin */ private static function calculateFreeSpace($trashbinSize, $user) { - $config = \OC::$server->getConfig(); - $softQuota = true; - $quota = \OC::$server->getUserManager()->get($user)->getQuota(); - $view = new \OC\Files\View('/' . $user); + $userObject = \OC::$server->getUserManager()->get($user); + if(is_null($userObject)) { + return 0; + } + $quota = $userObject->getQuota(); if ($quota === null || $quota === 'none') { $quota = \OC\Files\Filesystem::free_space('/'); $softQuota = false; @@ -580,8 +581,11 @@ class Trashbin { // calculate available space for trash bin // subtract size of files and current trash bin size from quota if ($softQuota) { - $rootInfo = $view->getFileInfo('/files/', false); - $free = $quota - $rootInfo['size']; // remaining free space for user + $userFolder = \OC::$server->getUserFolder($user); + if(is_null($userFolder)) { + return 0; + } + $free = $quota - $userFolder->getSize(); // remaining free space for user if ($free > 0) { $availableSpace = ($free * self::DEFAULTMAXSIZE / 100) - $trashbinSize; // how much space can be used for versions } else { |