Revision e823b5d6
SL/File/Backend/Filesystem.pm | ||
---|---|---|
64 | 64 |
|
65 | 65 |
sub save { |
66 | 66 |
my ($self, %params) = @_; |
67 |
die 'dbfile not exists' unless $params{dbfile}; |
|
68 |
my $dbfile = $params{dbfile}; |
|
69 |
die 'no file contents' unless $params{file_path} || $params{file_contents}; |
|
67 |
|
|
68 |
die 'dbfile not exists' unless ref $params{dbfile} eq 'SL::DB::File'; |
|
69 |
die 'no file contents' unless $params{file_path} || $params{file_contents}; |
|
70 |
|
|
71 |
my $dbfile = delete $params{dbfile}; |
|
70 | 72 |
|
71 | 73 |
# Do not save and do not create a new version of the document if file size of last version is the same. |
72 | 74 |
if ($dbfile->source eq 'created' && $self->get_version_count(dbfile => $dbfile)) { |
... | ... | |
83 | 85 |
my $tofile = $self->_filesystem_path($dbfile); |
84 | 86 |
if ($params{file_path} && -f $params{file_path}) { |
85 | 87 |
File::Copy::copy($params{file_path}, $tofile); |
86 |
} |
|
87 |
elsif ($params{file_contents}) { |
|
88 |
} elsif ($params{file_contents}) { |
|
88 | 89 |
open(OUT, "> " . $tofile); |
89 | 90 |
print OUT $params{file_contents}; |
90 | 91 |
close(OUT); |
Auch abrufbar als: Unified diff
Kosmetik, Überprüfung auf exakten Typ