Revision eb4bace4
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Controller/DownloadZip.pm | ||
---|---|---|
53 | 53 |
my @files = SL::File->get_all(object_id => $item->parts_id, |
54 | 54 |
object_type => $element_type, |
55 | 55 |
); |
56 |
my @wanted_files; |
|
57 |
## also for filtering if needed: |
|
58 |
# if ( $doctype ) { |
|
59 |
# @wanted_files = grep { $_->{file_name} =~ /$doctype/ } @files; |
|
60 |
# } else { |
|
61 |
@wanted_files = @files; |
|
62 |
# } |
|
63 |
if ( scalar (@wanted_files) > 0 ) { |
|
64 |
$zip->addDirectory($item->part->partnumber); |
|
65 |
$zip->addFile($_->get_file, |
|
66 |
Encode::encode($name_encoding,$item->part->partnumber.'/'.$_->db_file->file_name) |
|
67 |
) for @wanted_files; |
|
68 |
} |
|
56 |
next unless @files; |
|
57 |
|
|
58 |
$zip->addDirectory($item->part->partnumber); |
|
59 |
$zip->addFile($_->get_file, Encode::encode($name_encoding, $item->part->partnumber . '/' . $_->db_file->file_name)) for @files; |
|
69 | 60 |
} |
70 | 61 |
} |
71 | 62 |
unless ( $zip->writeToFileNamed($sfile->file_name) == Archive::Zip::AZ_OK ) { |
Auch abrufbar als: Unified diff
Dateimanagement: DownloadZip: etwas aufgeräumt