diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-02-17 20:09:03 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-02-17 20:09:03 +0100 |
commit | 451daf3ab14edde76f4d04e6fe41519cf517fe47 (patch) | |
tree | 752df48de663c863d1006b173971ba7557136bdc /lib/fileproxy | |
parent | d96146a017bd8f7e4573e4555cea2c198fa9fbad (diff) | |
download | nextcloud-server-451daf3ab14edde76f4d04e6fe41519cf517fe47.tar.gz nextcloud-server-451daf3ab14edde76f4d04e6fe41519cf517fe47.zip |
Keep user quota into account when the storage backend has unkown free space
Diffstat (limited to 'lib/fileproxy')
-rw-r--r-- | lib/fileproxy/quota.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index 07d1d250e4d..3dac3264fbe 100644 --- a/lib/fileproxy/quota.php +++ b/lib/fileproxy/quota.php @@ -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); } |