Skip to content

Commit

Permalink
S:F:B:FileSystem: FIX: suche nach aktuellster FileVerison ohne Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
z4m1n0 committed Feb 22, 2024
1 parent a2d2f52 commit c631d7c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions SL/File/Backend/Filesystem.pm
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,15 @@ sub _filesystem_path {

die "No files backend enabled" unless $::instance_conf->get_doc_files || $::lx_office_conf{paths}->{document_path};

unless ($version) {
my $file_version = SL::DB::Manager::FileVersion->get_first(
where => [file_id => $dbfile->id],
sort_by => 'version DESC'
) or die "Could not find a file version for file with id " . $dbfile->id;
$version = $file_version->version;
}

# use filesystem with depth 3
$version ||= $dbfile->file_versions_sorted->[-1]->version;
confess "Version is required." unless $version;
my $iddir = sprintf("%04d", $dbfile->id % 1000);
my $path = File::Spec->catdir($::lx_office_conf{paths}->{document_path}, $::auth->client->{id}, $iddir, $dbfile->id);
if (!-d $path) {
Expand Down

0 comments on commit c631d7c

Please sign in to comment.