Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.9.12
Description
We've been seeing the following error on a Moodle 3.9 site:
Execute scheduled task: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task)
|
... started 09:00:48. Current memory use 3.1MB. |
... used 893 dbqueries |
... used 4.5813250541687 seconds |
Scheduled task failed: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task),Cannot create file 1/core_h5p/library_sources/0/H5P.Column (Duplicate entry '88b06733853c58c1ef1f0091cbac4e336fda5734' for key 'mdl_file_pat_uix' |
INSERT INTO mdl_files (contextid,component,filearea,itemid,filepath,filename,timecreated,timemodified,mimetype,userid,source,author,license,status,sortorder,contenthash,filesize,pathnamehash) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
[array (
|
0 => 1, |
1 => 'core_h5p', |
2 => 'library_sources', |
3 => 0, |
4 => '/', |
5 => 'H5P.Column', |
6 => 1646211653, |
7 => 1646211653, |
8 => 'application/zip', |
9 => NULL, |
10 => 'https://api.h5p.org/v1/content-types/H5P.Column', |
11 => NULL, |
12 => NULL, |
13 => 0, |
14 => 0, |
15 => '08554c609daba004c0f20b4ac083eea4493f52b3', |
16 => 5124222, |
17 => '88b06733853c58c1ef1f0091cbac4e336fda5734', |
)])
|
Debug info:
|
Duplicate entry '88b06733853c58c1ef1f0091cbac4e336fda5734' for key 'mdl_file_pat_uix' |
INSERT INTO mdl_files (contextid,component,filearea,itemid,filepath,filename,timecreated,timemodified,mimetype,userid,source,author,license,status,sortorder,contenthash,filesize,pathnamehash) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
[array (
|
0 => 1, |
1 => 'core_h5p', |
2 => 'library_sources', |
3 => 0, |
4 => '/', |
5 => 'H5P.Column', |
6 => 1646211653, |
7 => 1646211653, |
8 => 'application/zip', |
9 => NULL, |
10 => 'https://api.h5p.org/v1/content-types/H5P.Column', |
11 => NULL, |
12 => NULL, |
13 => 0, |
14 => 0, |
15 => '08554c609daba004c0f20b4ac083eea4493f52b3', |
16 => 5124222, |
17 => '88b06733853c58c1ef1f0091cbac4e336fda5734', |
)]
|
Backtrace:
|
* line 1245 of /lib/filestorage/file_storage.php: call to file_storage->create_file_from_pathname() |
* line 239 of /h5p/classes/core.php: call to file_storage->create_file_from_url() |
* line 202 of /h5p/classes/core.php: call to core_h5p\core->fetch_content_type() |
* line 69 of /lib/classes/task/h5p_get_content_types_task.php: call to core_h5p\core->fetch_latest_content_types() |
* line 248 of /lib/cronlib.php: call to core\task\h5p_get_content_types_task->execute() |
* line 120 of /lib/cronlib.php: call to cron_run_inner_scheduled_task() |
* line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks() |
* line 81 of /admin/cron.php: call to cron_run() |
As far as I can see, the expectation is that these files are downloaded, stored in the Moodle Files API, parsed/imported into local H5P code and then deleted.
Clearly, something has gone wrong here and the file has not been deleted, but has, instead been left behind - this is causing all future updates to fail.
Whilst I do not know the cause of the original failure, I wonder if it would be sensible to check for any existing file and delete it?