From 8a0b0bbf99019c0fb7f8a4f022982880b1122b07 Mon Sep 17 00:00:00 2001 From: Dulip Withanage Date: Thu, 26 Sep 2019 11:51:24 +0200 Subject: [PATCH] Remove temporary files after file upload --- TextureHandler.inc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/TextureHandler.inc.php b/TextureHandler.inc.php index 379dff3..05d3676 100644 --- a/TextureHandler.inc.php +++ b/TextureHandler.inc.php @@ -413,8 +413,11 @@ protected function _createDependentFile($genreId, $mediaData, $submission, $subm $newMediaFile->setAssocId($submissionFile->getFileId()); $newMediaFile->setAssocType(ASSOC_TYPE_SUBMISSION_FILE); $newMediaFile->setOriginalFileName($mediaData["fileName"]); + $insertedMediaFile = $submissionFileDao->insertObject($newMediaFile, $tmpfname); - return $submissionFileDao->insertObject($newMediaFile, $tmpfname); + unlink($tmpfname); + + return $insertedMediaFile; } /** @@ -452,8 +455,11 @@ protected function _updateManuscriptFile($fileStage, $genreId, $resources, $subm $newSubmissionFile->setSourceRevision($submissionFile->getRevision()); $newSubmissionFile->setFileId($submissionFile->getFileId()); $newSubmissionFile->setRevision($submissionFile->getRevision() + 1); + $insertedSubmissionFile = $submissionFileDao->insertObject($newSubmissionFile, $tmpfname); + + unlink($tmpfname); - return $submissionFileDao->insertObject($newSubmissionFile, $tmpfname); + return $insertedSubmissionFile; } /**