Merge branch 'MDL-74123_h5p_duplicate_file' of https://github.com/davosmith/moodle

This commit is contained in:
Sara Arjona
2022-03-10 08:40:55 +01:00
+15 -1
View File
@@ -238,8 +238,22 @@ class core extends H5PCore {
$factory = new factory();
// Download the latest content type from the H5P official repository.
$fs = get_file_storage();
// Delete any existing file, if it was not deleted during a previous download.
$existing = $fs->get_file(
(\context_system::instance())->id,
'core_h5p',
'library_sources',
0,
'/',
$library['machineName']
);
if ($existing) {
$existing->delete();
}
// Download the latest content type from the H5P official repository.
$file = $fs->create_file_from_url(
(object) [
'component' => 'core_h5p',