Revision 56371b77
Von Martin Helmling martin.helmling@octosoft.eu vor mehr als 7 Jahren hinzugefügt
SL/File/Backend/Filesystem.pm | ||
---|---|---|
16 | 16 |
my ($self, %params) = @_; |
17 | 17 |
$main::lxdebug->message(LXDebug->DEBUG2(), "del in backend " . $self . " file " . $params{dbfile}); |
18 | 18 |
$main::lxdebug->message(LXDebug->DEBUG2(), "file id=" . ($params{dbfile}->id * 1)); |
19 |
die "no dbfile" unless $params{dbfile}; |
|
19 |
$main::lxdebug->message(LXDebug->DEBUG2(), "last=" . $params{last}." all_bnl=". $params{all_but_notlast}); |
|
20 |
die "no dbfile in backend delete" unless $params{dbfile}; |
|
20 | 21 |
my $backend_data = $params{dbfile}->backend_data; |
21 | 22 |
$backend_data = 0 if $params{last}; |
22 | 23 |
$backend_data = $params{dbfile}->backend_data-1 if $params{all_but_notlast}; |
... | ... | |
30 | 31 |
} |
31 | 32 |
if ($params{all_but_notlast}) { |
32 | 33 |
my $from = $self->_filesystem_path($params{dbfile},$params{dbfile}->backend_data); |
33 |
my $to = $self->_filesystem_path($params{dbfile},$params{dbfile}->backend_data);
|
|
34 |
die "file not exists" unless -f $from; |
|
34 |
my $to = $self->_filesystem_path($params{dbfile},1);
|
|
35 |
die "file not exists in backend delete" unless -f $from;
|
|
35 | 36 |
rename($from,$to); |
36 | 37 |
$params{dbfile}->backend_data(1); |
37 | 38 |
} else { |
38 | 39 |
$params{dbfile}->backend_data(0); |
39 | 40 |
my $dir_path = $self->_filesystem_path($params{dbfile}); |
40 | 41 |
rmdir($dir_path); |
41 |
$main::lxdebug->message(LXDebug->DEBUG2(), "unlink " .$dir_path);
|
|
42 |
$main::lxdebug->message(LXDebug->DEBUG2(), "rmdir " .$dir_path);
|
|
42 | 43 |
} |
43 | 44 |
} else { |
44 | 45 |
my $file_path = $self->_filesystem_path($params{dbfile},$params{dbfile}->backend_data); |
45 |
die "file not exists" unless -f $file_path; |
|
46 |
die "file not exists in backend delete" unless -f $file_path;
|
|
46 | 47 |
unlink($file_path); |
47 | 48 |
$params{dbfile}->backend_data($params{dbfile}->backend_data-1); |
48 | 49 |
} |
50 |
return 1; |
|
49 | 51 |
} |
50 | 52 |
|
51 | 53 |
sub rename { |
... | ... | |
85 | 87 |
die "unknown version" if $params{version} && |
86 | 88 |
($params{version} < 0 || $params{version} > $params{dbfile}->backend_data) ; |
87 | 89 |
my $path = $self->_filesystem_path($params{dbfile},$params{version}); |
88 |
die "no file found in backend or configuration to filesystem is wrong" if !-f $path;
|
|
90 |
die "no file found in backend get_mtime" if !-f $path;
|
|
89 | 91 |
my @st = stat($path); |
90 | 92 |
my $dt = DateTime->from_epoch(epoch => $st[9])->clone(); |
91 | 93 |
$main::lxdebug->message(LXDebug->DEBUG2(), "dt=" .$dt); |
... | ... | |
96 | 98 |
my ($self, %params) = @_; |
97 | 99 |
die "no dbfile" unless $params{dbfile}; |
98 | 100 |
my $path = $self->_filesystem_path($params{dbfile},$params{version}); |
99 |
die "no file" if !-f $path; |
|
101 |
die "no file in backend get_filepath" if !-f $path;
|
|
100 | 102 |
return $path; |
101 | 103 |
} |
102 | 104 |
|
Auch abrufbar als: Unified diff
Filemanagement: Löschen von DMS-Anhängen wirft Fehler
Hier war der Rückgabewert der delete-Funktion im Backend verschwunden.
fix redmine #275