Skip to content

Commit

Permalink
feature: Added logging of zip export create errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Janos Pribelszki committed Nov 6, 2023
1 parent 385df63 commit e7ea1b9
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions model/ZipExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,23 @@ private function getSavePath(string $unsafePath): string
*/
protected function createZipFile($filename, array $exportClasses = [], array $exportFiles = []): string
{
$baseDir = tao_helpers_Export::getExportPath();
$path = $baseDir . '/' . $filename . '.zip';
try {
$errors = [];

$zip = new ZipArchive();
if ($zip->open($path, ZipArchive::CREATE) !== true) {
throw new common_Exception('Unable to create zipfile ' . $path);
}
$baseDir = tao_helpers_Export::getExportPath();
$path = $baseDir . '/' . $filename . '.zip';

if ($zip->numFiles !== 0) {
$zip->close();
$zip = new ZipArchive();
if ($zip->open($path, ZipArchive::CREATE) !== true) {
throw new common_Exception('Unable to create zipfile ' . $path);
}

return $path;
}
if ($zip->numFiles !== 0) {
$zip->close();

return $path;
}

try {
$errors = [];
foreach ($exportFiles as $label => $files) {
$archivePath = '';

Expand Down

0 comments on commit e7ea1b9

Please sign in to comment.