[Pkg-owncloud-commits] [owncloud] 38/129: handle versions expire for home storages with unlimited quota

David Prévot taffit at moszumanska.debian.org
Thu Nov 5 01:04:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 7cbc348780ab43a46ade3b823500926853498c9f
Author: Robin Appelman <icewind at owncloud.com>
Date:   Wed Oct 14 13:51:20 2015 +0200

    handle versions expire for home storages with unlimited quota
---
 apps/files_versions/lib/storage.php | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php
index ae86b67..dd8af1b 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);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list