Revision 58755146
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
| SL/File/Backend/Filesystem.pm | ||
|---|---|---|
|
|
||
|
use parent qw(SL::File::Backend);
|
||
|
use SL::DB::File;
|
||
|
use SL::DB::FileVersion;
|
||
|
|
||
|
use File::Copy;
|
||
|
use File::Slurp;
|
||
| ... | ... | |
|
print OUT $params{file_contents};
|
||
|
close(OUT);
|
||
|
}
|
||
|
|
||
|
# save file version
|
||
|
my $doc_path = $::lx_office_conf{paths}->{document_path};
|
||
|
my $rel_file = $tofile;
|
||
|
$rel_file =~ s/$doc_path//;
|
||
|
|
||
|
my $fv = SL::DB::FileVersion->new(
|
||
|
file_id => $dbfile->id,
|
||
|
version => $dbfile->backend_data,
|
||
|
file_location => $rel_file,
|
||
|
doc_path => $doc_path,
|
||
|
backend => 'Filesystem',
|
||
|
guid => create_uuid_as_string(UUID_V4),
|
||
|
)->save;
|
||
|
file_id => $dbfile->id,
|
||
|
version => $dbfile->backend_data,
|
||
|
file_location => $rel_file,
|
||
|
doc_path => $doc_path,
|
||
|
backend => 'Filesystem',
|
||
|
guid => create_uuid_as_string(UUID_V4),
|
||
|
)->save;
|
||
|
|
||
|
if ($params{mtime}) {
|
||
|
utime($params{mtime}, $params{mtime}, $tofile);
|
||
|
}
|
||
| SL/File/Backend/Webdav.pm | ||
|---|---|---|
|
|
||
|
use parent qw(SL::File::Backend);
|
||
|
use SL::DB::File;
|
||
|
use SL::DB::FileVersion;
|
||
|
|
||
|
use SL::System::Process;
|
||
|
use File::Copy;
|
||
| ... | ... | |
|
use File::Path qw(make_path);
|
||
|
use File::MimeInfo::Magic;
|
||
|
use File::stat;
|
||
|
use UUID::Tiny ':std';
|
||
|
|
||
|
#
|
||
|
# public methods
|
||
| ... | ... | |
|
print OUT $params{file_contents};
|
||
|
close(OUT);
|
||
|
}
|
||
|
|
||
|
# save file version
|
||
|
my $doc_path = $self->get_rootdir();
|
||
|
my $rel_file = $tofile;
|
||
|
$rel_file =~ s/$doc_path//;
|
||
|
my $fv = SL::DB::FileVersion->new(
|
||
|
file_id => $params{dbfile}->id,
|
||
|
version => 1, # Webdav doesn't have versions by now.
|
||
|
file_location => $rel_file,
|
||
|
doc_path => $doc_path,
|
||
|
backend => 'Webdav',
|
||
|
guid => create_uuid_as_string(UUID_V4),
|
||
|
)->save;
|
||
|
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
Auch abrufbar als: Unified diff
S:F:B:Webdav: Lege beim Speichern Dateiversion an