]> source.dussan.org Git - nextcloud-server.git/commitdiff
Keep user quota into account when the storage backend has unkown free space
authorRobin Appelman <icewind@owncloud.com>
Sun, 17 Feb 2013 19:09:03 +0000 (20:09 +0100)
committerRobin Appelman <icewind@owncloud.com>
Sun, 17 Feb 2013 19:09:03 +0000 (20:09 +0100)
lib/fileproxy/quota.php

index 07d1d250e4d033bfc1537e3b1b0a61b3bf9175b2..3dac3264fbec6f27db03836410907a8b6d0bad9b 100644 (file)
@@ -62,21 +62,21 @@ class OC_FileProxy_Quota extends OC_FileProxy{
                 * @var string $internalPath
                 */
                list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($path);
-               $owner=$storage->getOwner($internalPath);
+               $owner = $storage->getOwner($internalPath);
                if (!$owner) {
                        return -1;
                }
 
-               $totalSpace=$this->getQuota($owner);
-               if($totalSpace==-1) {
+               $totalSpace = $this->getQuota($owner);
+               if($totalSpace == -1) {
                        return -1;
                }
 
                $view = new \OC\Files\View("/".$owner."/files");
 
-               $rootInfo=$view->getFileInfo('/');
-               $usedSpace=isset($rootInfo['size'])?$rootInfo['size']:0;
-               return $totalSpace-$usedSpace;
+               $rootInfo = $view->getFileInfo('/');
+               $usedSpace = isset($rootInfo['size'])?$rootInfo['size']:0;
+               return $totalSpace - $usedSpace;
        }
 
        public function postFree_space($path, $space) {
@@ -84,6 +84,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{
                if($free==-1) {
                        return $space;
                }
+               if ($space < 0){
+                       return $free;
+               }
                return min($free, $space);
        }