MDL-83182 core_files: Add a reference to the create_file_from_string()

This commit is contained in:
meirzamoodle 2024-09-18 17:39:14 +07:00
parent 09e56f2d1a
commit 2f1e4e4f29
2 changed files with 6 additions and 0 deletions

View File

@ -230,6 +230,8 @@ class exifremover_service extends service {
'itemid' => $this->storedfile->get_itemid(),
'filepath' => $this->storedfile->get_filepath(),
'filename' => $this->storedfile->get_filename(),
'repositoryid' => $this->storedfile->get_repository_id(),
'reference' => $this->storedfile->get_reference(),
];
$fs = get_file_storage();
$existingfile = $fs->get_file(

View File

@ -1493,6 +1493,10 @@ class file_storage {
$newrecord->pathnamehash = $this->get_pathname_hash($newrecord->contextid, $newrecord->component, $newrecord->filearea, $newrecord->itemid, $newrecord->filepath, $newrecord->filename);
if (!empty($filerecord->repositoryid)) {
$newrecord->referencefileid = $this->get_or_create_referencefileid($filerecord->repositoryid, $filerecord->reference);
}
try {
$this->create_file($newrecord, $notify);
} catch (dml_exception $e) {