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

H5P exports cannot include multiple versions of the same library

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 3.11.11, 4.0.5, 4.1
    • None
    • H5P
    • MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE

    Description

      It is possible for H5Ps to end up requiring multiple versions of the same library. The code that builds the list of dependencies only keys off of machine name, and thus will only include one version of a library.

      This only seems to impact the mobile app because the web experience is not dependent on the export file to load the dependencies. However the mobile app will throw dependency errors trying to open the same H5P. However, I have noticed that sometimes, if you view another H5P that includes the missing dependency, and then view the broken H5P, it will start working. It would seem that the mobile app has some capacity to cache dependencies and make them available between modules.

      This is my post on the H5P forum about the issue:
      https://h5p.org/node/1322877

      Steps to reproduce

      1. Create an mod_h5pactivity instance using the attached `broken.h5p` file
      2. Open the mobile app try to view the app
      3. You should see the attached error screenshot.

      One note on testing: Because it seems that the mobile app can cache dependencies from one module to another, you'll need to delete your local cache for the mobile app. The easiest way to do this is to log out and remove the site, and add it back again.

      What I think is happening

      This H5P was created on h5p.com and is a CoursePresentation v1.22.0. This depends on both H5PEditor.ColorSelector v1.2 and H5P.Shape v1.0. It comes bundled with H5P.Shape v1.0.0, which depends on H5PEditor.ColorSelector v1.2. However, the latest version of H5P.Shape is v1.0.4 and depends on H5PEditor.ColorSelector v1.3. 

      I believe at some point the cron task updated H5P.Shape on our server and that is when we started experiencing this issue.

      I determined this by comparing the export file that my local server sent to the mobile app to the h5p I uploaded to the server. I attached a copy of that export file to this issue.

      Possible fix:

      Simply make the dependency list key off machine name AND version. I changed these 3 lines in my local version, forced the exports to regenerate, and then the bug went away:

      https://github.com/petermAprende/moodle/compare/MOODLE_311_STABLE...petermAprende:moodle:h5p_dependency_fix?expand=1

      I was forcing the export files to regenerate by deleting the their matching row from the files table, but I would recommend just deleting the module instance and re-creating it.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              peter-aprende Peter Miller
              Amaia Anabitarte, Carlos Escobedo, Laurent David, Mikel Martín Corrales, Sabina Abellan, Sara Arjona (@sarjona)
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: