Potential content loss upon the upgrade of H5P content type Game Map

Hi everyone,

On our platform (Moodle v4.5, the H5P integration is running framework v1.27), we noticed the following:

  • When a Game Map is upgraded from v1.2 to v1.5 (by making edits and saving), the “Stage content” for the stages in the Game Map disappears (or at least shows up empty in the editor).
  • As a result, the entire H5P activity no longer displays in Moodle.

Has anyone else experienced this? Any ideas on possible causes or fixes would be greatly appreciated!

Thanks in advance!

otacke's picture

Could you please share that 1.2 content allowing to replicate what you are experiencing?

Game map versions in the system: 1.2.10 and 1.5.4

otacke's picture

Hi!

Test run 1

  1. Uploaded your 1.2 file on a WordPress site (no GameMap installed before). Content works well.
  2. Updated GameMap to 1.5, content still using 1.2 as it should.
  3. Updated all GameMap instances via the library settings page. Content is upgraded to 1.5 correctly and works well. See editor screen shot now with "exercise bundles" attached.

Test run 2

  1. Uploaded your 1.2 file on a WordPress site (no GameMap installed before). Content works well.
  2. Updated GameMap to 1.5, content still using 1.2 as it should.
  3. Edited and saved the file. Content is upgraded to 1.5 correctly and works well. See editor screen shot now with "exercise bundles" attached.

Test run 3

  1. Uploaded your 1.2 file on an H5P CLI instance (GameMap 1.5 already installed). Content was upgraded and works well.

Test run 4

  1. Uploaded your 1.2 file to the content bank of a moodle sandbox that is running moodle own H5P integration and already has GameMap 1.5 installed. In contrast to other H5P integrations that would upgrade the content here as GameMap 1.5 is already installed, moodle custom H5P integration installs the 1.2 libraries. The content remains at 1.2. That's not common behavior, but if moodle thinks it should be this way ...
  2. Edited and saved the file. Content should get upgraded to 1.5. Content does not show, and an error message in the console indicates that the content's parameters might be corrupted.

Intermediate hypothesis

Something fishy is going on with the upgrade process on moodle's custom H5P integration.

Investigation 1

  1. Intercept parameters from upgraded content as content type gets started. The parameters seem to remain untouched, indicating that the upgrade script might not run on moodle's own H5P integration.

Investigation 2

  1. Deleted content, deleted Game Map 1.5.
  2. Uploaded a modified version of GameMap 1.5 with an upgrade script that would erase all paremeters on upgrade.
  3. Uploaded your 1.2 file.
  4. Edited and saved the file which should then be upgraded. Again, intercepted the parameters. Given the modified upgrade script, they should have been empty, but they were not.

Preliminary conclusion

It looks as if, even though Game Map 1.5 is installed, the relevant function of the upgrade script of GameMap is not run on the parameters of your GameMap 1.2 content before it is saved, and only the library dependencies get upgraded. When H5P then saves the content, H5P detects that the parameters do not match the modified semantic structure that is expected in GameMap 1.5, and hence H5P removes the invalid parameter values - the stage contents that you added.

I don't have a local moodle instance to check more thoroughly and to build a more solid case, but my observations match the aforementioned explanation.

Please reach out to moodle HQ and report your findings and share a link to this post that they may refer to for more information. If the upgrade procedure of moodle's custom H5P integration in fact does not work properly, I'd consider this a bug that should be fixed rather sooner than later.