From 22c5c19376e4933aa667ca5a684418b29b183979 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 14 Oct 2015 13:51:20 +0200 Subject: handle versions expire for home storages with unlimited quota --- apps/files_versions/lib/storage.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'apps/files_versions') diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php index ae86b6741b5..dd8af1b8d18 100644 --- a/apps/files_versions/lib/storage.php +++ b/apps/files_versions/lib/storage.php @@ -676,17 +676,21 @@ class Storage { // calculate available space for version history // subtract size of files and current versions size from quota - if ($softQuota) { - $files_view = new \OC\Files\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 + $offset); // how much space can be used for versions + if ($quota >= 0) { + if ($softQuota) { + $files_view = new \OC\Files\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 + $offset); // how much space can be used for versions + } else { + $availableSpace = $free - $versionsSize - $offset; + } } else { - $availableSpace = $free - $versionsSize - $offset; + $availableSpace = $quota - $offset; } } else { - $availableSpace = $quota - $offset; + $availableSpace = PHP_INT_MAX; } $allVersions = Storage::getVersions($uid, $filename); -- cgit v1.2.3