more fixes

i don´t understand why this worked before.
This commit is contained in:
Frank Karlitschek 2012-05-31 21:10:03 +02:00
parent d4ea853fcf
commit 57a56299d8
1 changed files with 9 additions and 9 deletions

View File

@ -96,14 +96,14 @@ class Storage {
}
// check filesize
if(filesize($filesfoldername.$filename)>\OCP\Config::getSystemValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)){
if(filesize($filesfoldername.'/'.$filename)>\OCP\Config::getSystemValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)){
return false;
}
// check mininterval if the file is being modified by the owner (all shared files should be versioned despite mininterval)
if ($uid == \OCP\User::getUser()) {
$matches=glob($versionsfoldername.$filename.'.v*');
$matches=glob($versionsfoldername.'/'.$filename.'.v*');
sort($matches);
$parts=explode('.v',end($matches));
if((end($parts)+Storage::DEFAULTMININTERVAL)>time()){
@ -114,10 +114,10 @@ class Storage {
// create all parent folders
$info=pathinfo($filename);
@mkdir($versionsfoldername.$info['dirname'],0700,true);
if(!file_exists($versionsfoldername.'/'.$info['dirname'])) mkdir($versionsfoldername.'/'.$info['dirname'],0700,true);
// store a new version of a file
copy($filesfoldername.$filename,$versionsfoldername.$filename.'.v'.time());
copy($filesfoldername.'/'.$filename,$versionsfoldername.'/'.$filename.'.v'.time());
// expire old revisions
Storage::expire($filename);
@ -143,7 +143,7 @@ class Storage {
$filesfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/files';
// rollback
if ( @copy($versionsfoldername.$filename.'.v'.$revision,$filesfoldername.$filename) ) {
if ( @copy($versionsfoldername.'/'.$filename.'.v'.$revision,$filesfoldername.$filename) ) {
return true;
@ -172,7 +172,7 @@ class Storage {
$versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
// check for old versions
$matches=glob($versionsfoldername.$filename.'.v*');
$matches=glob($versionsfoldername.'/'.$filename.'.v*');
if(count($matches)>1){
return true;
}else{
@ -201,7 +201,7 @@ class Storage {
$versions=array();
// fetch for old versions
$matches=glob($versionsfoldername.$filename.'.v*');
$matches=glob($versionsfoldername.'/'.$filename.'.v*');
sort($matches);
foreach($matches as $ma) {
$parts=explode('.v',$ma);
@ -238,14 +238,14 @@ class Storage {
$versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
// check for old versions
$matches=glob($versionsfoldername.$filename.'.v*');
$matches=glob($versionsfoldername.'/'.$filename.'.v*');
if(count($matches)>\OCP\Config::getSystemValue('files_versionmaxversions', Storage::DEFAULTMAXVERSIONS)){
$numbertodelete=count($matches-\OCP\Config::getSystemValue('files_versionmaxversions', Storage::DEFAULTMAXVERSIONS));
// delete old versions of a file
$deleteitems=array_slice($matches,0,$numbertodelete);
foreach($deleteitems as $de){
unlink($versionsfoldername.$filename.'.v'.$de);
unlink($versionsfoldername.'/'.$filename.'.v'.$de);
}
}
}