Skip to content

Commit

Permalink
Swap around to show why next commit makes sense.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Vasseur committed Oct 1, 2023
1 parent 193695d commit 1b358ee
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions webapp/src/Service/ExternalContestSourceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand Down

0 comments on commit 1b358ee

Please sign in to comment.