* @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) {
if($free==-1) {
return $space;
}
+ if ($space < 0){
+ return $free;
+ }
return min($free, $space);
}