Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-74123

H5P update duplicate file error

    XMLWordPrintable

Details

    • MOODLE_39_STABLE
    • MOODLE_311_STABLE
    • MDL-74123_h5p_duplicate_file
    • Hide
      1. Run the following SQL
        • Add a new entry to mdl_files:

          INSERT INTO mdl_files (contextid, component, filearea, itemid, filepath, filename, timecreated, timemodified, filesize, pathnamehash) VALUES (1, 'core_h5p', 'library_sources', 0, '/', 'H5P.Column', 0, 0, 1, '88b06733853c58c1ef1f0091cbac4e336fda5734');
          

        • In mdl_h5p_libraries - find machinename = 'H5P.Column' and change patchversion to 0 (it should be 1):

          UPDATE mdl_h5p_libraries SET patchversion = 0 WHERE machinename = 'H5P.Column';
          

      2. Run scheduled task "Download available H5P content types from h5p.org"  (\core\task\h5p_get_content_types_task) (you might need to configure the "Path to PHP CLI" if you run it using the UI).
      3. Check the content downloaded without any error (some Warning: unlink might be displayed, because the file we added in step #1 is not real).
      Show
      Run the following SQL Add a new entry to mdl_files: INSERT INTO mdl_files (contextid, component, filearea, itemid, filepath, filename, timecreated, timemodified, filesize, pathnamehash) VALUES (1, 'core_h5p', 'library_sources', 0, '/', 'H5P.Column', 0, 0, 1, '88b06733853c58c1ef1f0091cbac4e336fda5734'); In mdl_h5p_libraries - find machinename = 'H5P.Column' and change patchversion to 0 (it should be 1): UPDATE mdl_h5p_libraries SET patchversion = 0 WHERE machinename = 'H5P.Column'; Run scheduled task "Download available H5P content types from h5p.org"  (\core\task\h5p_get_content_types_task) (you might need to configure the "Path to PHP CLI" if you run it using the UI). Check the content downloaded without any error (some Warning: unlink might be displayed, because the file we added in step #1 is not real).

    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?

      Attachments

        Activity

          People

            davosmith Davo Smith
            davosmith Davo Smith
            Ferran Recio Ferran Recio
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 11 minutes
                2h 11m

                Clockify

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.