diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-10-14 14:51:20 +0300 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-16 22:41:51 +0300 |
commit | 22c5c19376e4933aa667ca5a684418b29b183979 (patch) | |
tree | 2bf2f726f24d232478e53f3e8272cb49c92e9448 /apps/files_versions | |
parent | 416da0dfe9af2701f0298a9ef2f9c24600deb1ab (diff) |
handle versions expire for home storages with unlimited quota
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/lib/storage.php | 20 |
1 files changed, 12 insertions, 8 deletions
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); |