Revision a051b91b
Von Martin Helmling martin.helmling@octosoft.eu vor mehr als 7 Jahren hinzugefügt
SL/File/Backend/Filesystem.pm | ||
---|---|---|
14 | 14 |
|
15 | 15 |
sub delete { |
16 | 16 |
my ($self, %params) = @_; |
17 |
$main::lxdebug->message(LXDebug->DEBUG2(), "del in backend " . $self . " file " . $params{dbfile}); |
|
18 |
$main::lxdebug->message(LXDebug->DEBUG2(), "file id=" . ($params{dbfile}->id * 1)); |
|
19 |
$main::lxdebug->message(LXDebug->DEBUG2(), "last=" . $params{last}." all_bnl=". $params{all_but_notlast}); |
|
20 | 17 |
die "no dbfile in backend delete" unless $params{dbfile}; |
21 | 18 |
my $backend_data = $params{dbfile}->backend_data; |
22 | 19 |
$backend_data = 0 if $params{last}; |
23 | 20 |
$backend_data = $params{dbfile}->backend_data-1 if $params{all_but_notlast}; |
24 | 21 |
|
25 | 22 |
if ($backend_data > 0 ) { |
26 |
$main::lxdebug->message(LXDebug->DEBUG2(), "backend_data=" .$backend_data); |
|
27 | 23 |
for my $version ( 1..$backend_data) { |
28 | 24 |
my $file_path = $self->_filesystem_path($params{dbfile},$version); |
29 |
$main::lxdebug->message(LXDebug->DEBUG2(), "unlink " .$file_path); |
|
30 | 25 |
unlink($file_path); |
31 | 26 |
} |
32 | 27 |
if ($params{all_but_notlast}) { |
... | ... | |
39 | 34 |
$params{dbfile}->backend_data(0); |
40 | 35 |
my $dir_path = $self->_filesystem_path($params{dbfile}); |
41 | 36 |
rmdir($dir_path); |
42 |
$main::lxdebug->message(LXDebug->DEBUG2(), "rmdir " .$dir_path); |
|
43 | 37 |
} |
44 | 38 |
} else { |
45 | 39 |
my $file_path = $self->_filesystem_path($params{dbfile},$params{dbfile}->backend_data); |
... | ... | |
83 | 77 |
sub get_mtime { |
84 | 78 |
my ($self, %params) = @_; |
85 | 79 |
die "no dbfile" unless $params{dbfile}; |
86 |
$main::lxdebug->message(LXDebug->DEBUG2(), "version=" .$params{version}); |
|
87 | 80 |
die "unknown version" if $params{version} && |
88 | 81 |
($params{version} < 0 || $params{version} > $params{dbfile}->backend_data) ; |
89 | 82 |
my $path = $self->_filesystem_path($params{dbfile},$params{version}); |
90 | 83 |
die "no file found in backend get_mtime" if !-f $path; |
91 | 84 |
my @st = stat($path); |
92 | 85 |
my $dt = DateTime->from_epoch(epoch => $st[9])->clone(); |
93 |
$main::lxdebug->message(LXDebug->DEBUG2(), "dt=" .$dt); |
|
94 | 86 |
return $dt; |
95 | 87 |
} |
96 | 88 |
|
... | ... | |
131 | 123 |
$version = $dbfile->backend_data if !$version || $version < 1 || $version > $dbfile->backend_data; |
132 | 124 |
my $iddir = sprintf("%04d", $dbfile->id % 1000); |
133 | 125 |
my $path = File::Spec->catdir($::lx_office_conf{paths}->{document_path}, $::auth->client->{id}, $iddir, $dbfile->id); |
134 |
$main::lxdebug->message(LXDebug->DEBUG2(), "file path=" .$path." id=" .$dbfile->id." version=".$version." basename=".$dbfile->id . '_' . $version); |
|
135 | 126 |
if (!-d $path) { |
136 | 127 |
File::Path::make_path($path, { chmod => 0770 }); |
137 | 128 |
} |
Auch abrufbar als: Unified diff
Filemanagement: DEBUG2 herausgenommen