Skip to content
Snippets Groups Projects
Commit b7db2094 authored by Aria Givi's avatar Aria Givi
Browse files

Fehler beim Öffnen der Zip, Ursache unbekannt

parent 29ca3d0d
No related branches found
No related tags found
2 merge requests!912Development,!908Synoptic bug
......@@ -335,22 +335,29 @@ class MailController extends Controller
return redirect(url('synoptic', ['exclude' => $exclude]));
}
$zip = new ZipArchive();
if ($zip->open("langfiles.zip", ZipArchive::OVERWRITE)!==TRUE) {
} else if ($zip->open("langfiles.zip", ZipArchive::CREATE)!==TRUE) {
exit("Cannot open".$filename);
}
if(file_exists("langfiles.zip"))
unlink("langfiles.zip");
$zip = new ZipArchive();
if ($zip->open("langfiles.zip", ZipArchive::CREATE)) {
exit("Cannot open ".$filename);
}
try{
#Erstelle Ausgabedateien
foreach($data as $lang => $entries) {
$output = json_encode($entries, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$output = preg_replace("/\{/si", "[", $output);
$output = preg_replace("/\}/si", "]", $output);
$output = preg_replace("/\": ([\"\[])/si", "\"\t=>\t$1", $output);
$output = "<?php\n\nreturn $output;\n";
$zip->addEmptyDir($lang);
$zip->addFromString($lang."/".$filename, $output);
foreach($data as $lang => $entries) {
$output = json_encode($entries, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$output = preg_replace("/\{/si", "[", $output);
$output = preg_replace("/\}/si", "]", $output);
$output = preg_replace("/\": ([\"\[])/si", "\"\t=>\t$1", $output);
$output = "<?php\n\nreturn $output;\n";
$zip->addEmptyDir($lang);
$zip->addFromString($lang."/".$filename, $output);
}
} catch(ErrorException $e) {
exit("Failed to write ".$filename);
}
$zip->close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment