Revision c17045ff
Von Jan Büren vor 11 Monaten hinzugefügt
SL/File/Backend/Filesystem.pm | ||
---|---|---|
|
||
sub save {
|
||
my ($self, %params) = @_;
|
||
die 'dbfile not exists' unless $params{dbfile};
|
||
my $dbfile = $params{dbfile};
|
||
die 'no file contents' unless $params{file_path} || $params{file_contents};
|
||
|
||
die 'dbfile not exists' unless ref $params{dbfile} eq 'SL::DB::File';
|
||
die 'no file contents' unless $params{file_path} || $params{file_contents};
|
||
|
||
my $dbfile = delete $params{dbfile};
|
||
|
||
# Do not save and do not create a new version of the document if file size of last version is the same.
|
||
if ($dbfile->source eq 'created' && $self->get_version_count(dbfile => $dbfile)) {
|
||
... | ... | |
my $tofile = $self->_filesystem_path($dbfile);
|
||
if ($params{file_path} && -f $params{file_path}) {
|
||
File::Copy::copy($params{file_path}, $tofile);
|
||
}
|
||
elsif ($params{file_contents}) {
|
||
} elsif ($params{file_contents}) {
|
||
open(OUT, "> " . $tofile);
|
||
print OUT $params{file_contents};
|
||
close(OUT);
|
Auch abrufbar als: Unified diff
Kosmetik, Überprüfung auf exakten Typ