remove DEFAULTMAXFILESIZE limit and make percentage of available space for versions configurable
This commit is contained in:
parent
e6e9d332cb
commit
21cdf93616
1 changed files with 2 additions and 8 deletions
|
@ -27,8 +27,7 @@ class Storage {
|
||||||
// - add transparent compression. first test if it´s worth it.
|
// - add transparent compression. first test if it´s worth it.
|
||||||
|
|
||||||
const DEFAULTENABLED=true;
|
const DEFAULTENABLED=true;
|
||||||
const DEFAULTMAXFILESIZE=10485760; // 10MB
|
const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
|
||||||
const DEFAULTMAXVERSIONS=50;
|
|
||||||
|
|
||||||
private static $max_versions_per_interval = array(1 => array('intervalEndsAfter' => 3600, //first hour, one version every 10sec
|
private static $max_versions_per_interval = array(1 => array('intervalEndsAfter' => 3600, //first hour, one version every 10sec
|
||||||
'step' => 10),
|
'step' => 10),
|
||||||
|
@ -80,11 +79,6 @@ class Storage {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check filesize
|
|
||||||
if($files_view->filesize($filename)>\OCP\Config::getSystemValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create all parent folders
|
// create all parent folders
|
||||||
$info=pathinfo($filename);
|
$info=pathinfo($filename);
|
||||||
if(!file_exists($versionsFolderName.'/'.$info['dirname'])) {
|
if(!file_exists($versionsFolderName.'/'.$info['dirname'])) {
|
||||||
|
@ -248,7 +242,7 @@ class Storage {
|
||||||
$free = $quota-$rootInfo['size']; // remaining free space for user
|
$free = $quota-$rootInfo['size']; // remaining free space for user
|
||||||
|
|
||||||
if ( $free > 0 ) {
|
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;
|
} // otherwise available space negative and we need to reach at least 0 at the end of the expiration process;
|
||||||
|
|
||||||
$versions = Storage::getVersions($filename);
|
$versions = Storage::getVersions($filename);
|
||||||
|
|
Loading…
Reference in a new issue