Keep user quota into account when the storage backend has unkown free space
This commit is contained in:
parent
d96146a017
commit
451daf3ab1
|
@ -62,21 +62,21 @@ class OC_FileProxy_Quota extends OC_FileProxy{
|
||||||
* @var string $internalPath
|
* @var string $internalPath
|
||||||
*/
|
*/
|
||||||
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($path);
|
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($path);
|
||||||
$owner=$storage->getOwner($internalPath);
|
$owner = $storage->getOwner($internalPath);
|
||||||
if (!$owner) {
|
if (!$owner) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$totalSpace=$this->getQuota($owner);
|
$totalSpace = $this->getQuota($owner);
|
||||||
if($totalSpace==-1) {
|
if($totalSpace == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$view = new \OC\Files\View("/".$owner."/files");
|
$view = new \OC\Files\View("/".$owner."/files");
|
||||||
|
|
||||||
$rootInfo=$view->getFileInfo('/');
|
$rootInfo = $view->getFileInfo('/');
|
||||||
$usedSpace=isset($rootInfo['size'])?$rootInfo['size']:0;
|
$usedSpace = isset($rootInfo['size'])?$rootInfo['size']:0;
|
||||||
return $totalSpace-$usedSpace;
|
return $totalSpace - $usedSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postFree_space($path, $space) {
|
public function postFree_space($path, $space) {
|
||||||
|
@ -84,6 +84,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{
|
||||||
if($free==-1) {
|
if($free==-1) {
|
||||||
return $space;
|
return $space;
|
||||||
}
|
}
|
||||||
|
if ($space < 0){
|
||||||
|
return $free;
|
||||||
|
}
|
||||||
return min($free, $space);
|
return min($free, $space);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue