Browse code

Add random temporary prefix to filename if email was provided to not delete an official export

Benjamin Roth authored on18/03/2025 14:26:59
Showing1 changed files
... ...
@@ -166,7 +166,7 @@ class ShopwareExportNewsletterJob extends AbstractController
166 166
             ];
167 167
         }
168 168
 
169
-        $filename = $srcDir . '/recipients_' . date("Ymd", $intStart) . '_' . date("Ymd", $intEnd) . '.csv';
169
+        $filename = $srcDir . '/' . (!empty($email) && Validator::isEmail($email) ? substr(md5(uniqid()), 0, 10) . '_' : '') . 'recipients_' . date("Ymd", $intStart) . '_' . date("Ymd", $intEnd) . '.csv';
170 170
         \file_put_contents($filename, $this->serializer->encode($arrCSV, 'csv', $this->csvContext));
171 171
 
172 172
         // If email is provided, send the CSV file