From 1b358ee7170d649e5db904a9d132d09405c86338 Mon Sep 17 00:00:00 2001 From: Michael Vasseur Date: Sun, 1 Oct 2023 12:24:27 +0200 Subject: [PATCH] Swap around to show why next commit makes sense. --- .../Service/ExternalContestSourceService.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/webapp/src/Service/ExternalContestSourceService.php b/webapp/src/Service/ExternalContestSourceService.php index 6922cdc37b..db4715b714 100644 --- a/webapp/src/Service/ExternalContestSourceService.php +++ b/webapp/src/Service/ExternalContestSourceService.php @@ -1488,6 +1488,18 @@ protected function importSubmission(string $entityType, ?string $eventId, string message: $message, forceImportInvalid: !$submissionDownloadSucceeded ); + // Clean up the ZIP. + if (isset($zip)) { + $zip->close(); + } + if ($shouldUnlink) { + unlink($zipFile); + } + + // Clean up the temporary submission files. + foreach ($filesToSubmit as $file) { + unlink($file->getRealPath()); + } if (!$submission) { $this->addOrUpdateWarning($eventId, $entityType, $data['id'], ExternalSourceWarning::TYPE_SUBMISSION_ERROR, [ 'message' => 'Cannot add submission: ' . $message, @@ -1505,18 +1517,6 @@ protected function importSubmission(string $entityType, ?string $eventId, string return; } - // Clean up the ZIP. - if (isset($zip)) { - $zip->close(); - } - if ($shouldUnlink) { - unlink($zipFile); - } - - // Clean up the temporary submission files. - foreach ($filesToSubmit as $file) { - unlink($file->getRealPath()); - } } if ($submissionDownloadSucceeded) {