From ad7c7ceb0a2a01542fb0f139282fe5d5355fb698 Mon Sep 17 00:00:00 2001 From: Richard Lobb Date: Thu, 14 Nov 2024 14:55:47 +1300 Subject: [PATCH] Remove pointless check for existing file. --- classes/combinator_grader_outcome.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/classes/combinator_grader_outcome.php b/classes/combinator_grader_outcome.php index 567a67f8..9348e00f 100644 --- a/classes/combinator_grader_outcome.php +++ b/classes/combinator_grader_outcome.php @@ -120,23 +120,10 @@ private function save_files($files) { 'filepath' => '/', // File path within the context. 'filename' => $extendedfilename, ]; - // Get the file storage object. + + // Create the file in Moodle's filesystem. $fs = get_file_storage(); - - // Check if the file already exists to avoid duplicates. - if ( - !$fs->file_exists( - $contextid, - $fileinfo['component'], - $fileinfo['filearea'], - $fileinfo['itemid'], - $fileinfo['filepath'], - $fileinfo['filename'] - ) - ) { - // Create the file in Moodle's filesystem. - $file = $fs->create_file_from_string($fileinfo, $decoded); - } + $file = $fs->create_file_from_string($fileinfo, $decoded); // Generate a URL to the saved file. $url = '@@PLUGINFILE@@/' . $extendedfilename;