remove DEFAULTMAXFILESIZE limit and make percentage of available space for versions configurable

This commit is contained in:
Björn Schießle 2012-12-18 12:57:28 +01:00
parent e6e9d332cb
commit 21cdf93616
1 changed files with 2 additions and 8 deletions

View File

@ -27,8 +27,7 @@ class Storage {
// - add transparent compression. first test if it´s worth it.
const DEFAULTENABLED=true;
const DEFAULTMAXFILESIZE=10485760; // 10MB
const DEFAULTMAXVERSIONS=50;
const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
private static $max_versions_per_interval = array(1 => array('intervalEndsAfter' => 3600, //first hour, one version every 10sec
'step' => 10),
@ -80,11 +79,6 @@ class Storage {
return false;
}
// check filesize
if($files_view->filesize($filename)>\OCP\Config::getSystemValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)) {
return false;
}
// create all parent folders
$info=pathinfo($filename);
if(!file_exists($versionsFolderName.'/'.$info['dirname'])) {
@ -248,7 +242,7 @@ class Storage {
$free = $quota-$rootInfo['size']; // remaining free space for user
if ( $free > 0 ) {
$availableSpace = 5000 / ($quota-$rootInfo['size']); // 50% of free space can be used for versions
$availableSpace = 100* self::DEFAULTMAXSIZE / ($quota-$rootInfo['size']); // how much space can be used for versions
} // otherwise available space negative and we need to reach at least 0 at the end of the expiration process;
$versions = Storage::getVersions($filename);