diff --git a/mod/assignment/db/upgrade.php b/mod/assignment/db/upgrade.php index 5ebd22c63a643..07fbc54619f54 100644 --- a/mod/assignment/db/upgrade.php +++ b/mod/assignment/db/upgrade.php @@ -86,7 +86,7 @@ function xmldb_assignment_upgrade($oldversion) { if ($filename === '') { continue; } - if (!$fs->file_exists($context->id, $filearea, '0', '/', $filename)) { + if (!$fs->file_exists($context->id, $filearea, $submission->userid, '/', $filename)) { $file_record = array('contextid'=>$context->id, 'filearea'=>$filearea, 'itemid'=>$submission->userid, 'filepath'=>'/', 'filename'=>$filename, 'userid'=>$submission->userid); if ($fs->create_file_from_pathname($file_record, $path.$item->getFilename())) { unlink($path.$item->getFilename()); @@ -108,7 +108,7 @@ function xmldb_assignment_upgrade($oldversion) { if ($filename === '') { continue; } - if (!$fs->file_exists($context->id, $filearea, '0', '/', $filename)) { + if (!$fs->file_exists($context->id, $filearea, $submission->userid, '/', $filename)) { $file_record = array('contextid'=>$context->id, 'filearea'=>$filearea, 'itemid'=>$submission->userid, 'filepath'=>'/', 'filename'=>$filename, 'timecreated'=>$item->getCTime(), 'timemodified'=>$item->getMTime()); if ($submission->teacher) {