Skip to content

Commit

Permalink
Remove pointless check for existing file.
Browse files Browse the repository at this point in the history
  • Loading branch information
trampgeek committed Nov 14, 2024
1 parent b6cee8a commit ad7c7ce
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions classes/combinator_grader_outcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ad7c7ce

Please sign in to comment.