-
Improvement
-
Resolution: Not a bug
-
Trivial
-
None
-
2.3
On looking at the work in MDL-32937, I've noticed that in this amazing improvement as well as in mod_folder there is potentially room for inconsistency being the creation of the uploaded file - via DnD - in the draft area and the subsequent selection done not in the same "DB transaction", trusting it will be actually the first (more recent logic?) file. See it e.g. from the current pull proposal for that issue:
...
|
file_save_draft_area_files($uploadinfo->draftitemid, $context->id, 'mod_scorm', 'package', 0);
|
$fs = get_file_storage();
|
$files = $fs->get_area_files($context->id, 'mod_scorm', 'package', 0, 'sortorder, itemid, filepath, filename', false);
|
$file = reset($files);
|
$hash = key($files);
|
...
|
While this is normally true it could happen that more than one user is saving files in the draft area in the same course almost at the same time.
What about adding a new property, filename, to dndupload_ajax_processor?
This improvement could improve MDL-32937 current pull with something like:
...
|
file_save_draft_area_files($uploadinfo->draftitemid, $context->id, 'mod_scorm', 'package', 0);
|
$fs = get_file_storage();
|
$file = $fs->get_file($contextid, 'mod_scorm', 'package', 0, '/', $uploadinfo->filename);
|
$hash = $file->get_contenthash();
|
...
|
- Testing discovered
-
MDL-32937 implement drag/drop for SCORM
-
- Closed
-