Revision 58755146
Von Tamino Steinert vor 11 Monaten hinzugefügt
SL/File/Backend/Filesystem.pm | ||
---|---|---|
4 | 4 |
|
5 | 5 |
use parent qw(SL::File::Backend); |
6 | 6 |
use SL::DB::File; |
7 |
use SL::DB::FileVersion; |
|
7 | 8 |
|
8 | 9 |
use File::Copy; |
9 | 10 |
use File::Slurp; |
... | ... | |
92 | 93 |
print OUT $params{file_contents}; |
93 | 94 |
close(OUT); |
94 | 95 |
} |
96 |
|
|
97 |
# save file version |
|
95 | 98 |
my $doc_path = $::lx_office_conf{paths}->{document_path}; |
96 | 99 |
my $rel_file = $tofile; |
97 | 100 |
$rel_file =~ s/$doc_path//; |
98 |
|
|
99 | 101 |
my $fv = SL::DB::FileVersion->new( |
100 |
file_id => $dbfile->id, |
|
101 |
version => $dbfile->backend_data, |
|
102 |
file_location => $rel_file, |
|
103 |
doc_path => $doc_path, |
|
104 |
backend => 'Filesystem', |
|
105 |
guid => create_uuid_as_string(UUID_V4), |
|
106 |
)->save; |
|
102 |
file_id => $dbfile->id, |
|
103 |
version => $dbfile->backend_data, |
|
104 |
file_location => $rel_file, |
|
105 |
doc_path => $doc_path, |
|
106 |
backend => 'Filesystem', |
|
107 |
guid => create_uuid_as_string(UUID_V4), |
|
108 |
)->save; |
|
109 |
|
|
107 | 110 |
if ($params{mtime}) { |
108 | 111 |
utime($params{mtime}, $params{mtime}, $tofile); |
109 | 112 |
} |
SL/File/Backend/Webdav.pm | ||
---|---|---|
4 | 4 |
|
5 | 5 |
use parent qw(SL::File::Backend); |
6 | 6 |
use SL::DB::File; |
7 |
use SL::DB::FileVersion; |
|
7 | 8 |
|
8 | 9 |
use SL::System::Process; |
9 | 10 |
use File::Copy; |
... | ... | |
12 | 13 |
use File::Path qw(make_path); |
13 | 14 |
use File::MimeInfo::Magic; |
14 | 15 |
use File::stat; |
16 |
use UUID::Tiny ':std'; |
|
15 | 17 |
|
16 | 18 |
# |
17 | 19 |
# public methods |
... | ... | |
59 | 61 |
print OUT $params{file_contents}; |
60 | 62 |
close(OUT); |
61 | 63 |
} |
64 |
|
|
65 |
# save file version |
|
66 |
my $doc_path = $self->get_rootdir(); |
|
67 |
my $rel_file = $tofile; |
|
68 |
$rel_file =~ s/$doc_path//; |
|
69 |
my $fv = SL::DB::FileVersion->new( |
|
70 |
file_id => $params{dbfile}->id, |
|
71 |
version => 1, # Webdav doesn't have versions by now. |
|
72 |
file_location => $rel_file, |
|
73 |
doc_path => $doc_path, |
|
74 |
backend => 'Webdav', |
|
75 |
guid => create_uuid_as_string(UUID_V4), |
|
76 |
)->save; |
|
77 |
|
|
62 | 78 |
return 1; |
63 | 79 |
} |
64 | 80 |
|
Auch abrufbar als: Unified diff
S:F:B:Webdav: Lege beim Speichern Dateiversion an