Skip to content
Snippets Groups Projects
Commit ddde1b65 authored by Björn Schießle's avatar Björn Schießle
Browse files

adapt free space calculation to the way it is done for the trash bin

parent a3999036
Branches
No related tags found
No related merge requests found
......@@ -378,12 +378,14 @@ class Storage {
$versions_fileview = new \OC\Files\View('/'.$uid.'/files_versions');
// get available disk space for user
$softQuota = true;
$quota = \OC_Preferences::getValue($uid, 'files', 'quota');
if ( $quota === null || $quota === 'default') {
$quota = \OC_Appconfig::getValue('files', 'default_quota');
}
if ( $quota === null || $quota === 'none' ) {
$quota = \OC\Files\Filesystem::free_space('/') / count(\OCP\User::getUsers());
$quota = \OC\Files\Filesystem::free_space('/');
$softQuota = false;
} else {
$quota = \OCP\Util::computerFileSize($quota);
}
......@@ -397,6 +399,8 @@ class Storage {
}
// calculate available space for version history
// subtract size of files and current versions size from quota
if ($softQuota) {
$files_view = new \OC\Files\View('/'.$uid.'/files');
$rootInfo = $files_view->getFileInfo('/');
$free = $quota-$rootInfo['size']; // remaining free space for user
......@@ -405,6 +409,10 @@ class Storage {
} else {
$availableSpace = $free-$versionsSize;
}
} else {
$availableSpace = $quota;
}
// after every 1000s run reduce the number of all versions not only for the current file
$random = rand(0, 1000);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment