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);
 | ||
|   }
 | ||
Auch abrufbar als: Unified diff
S:F:B:Webdav: Lege beim Speichern Dateiversion an