Skip to content
Snippets Groups Projects
Commit 451daf3a authored by Robin Appelman's avatar Robin Appelman
Browse files

Keep user quota into account when the storage backend has unkown free space

parent d96146a0
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment