Course restore from Moodle v3.4.6 to v3.6.3 error/unknown_context_mapping

H5P version 1.17.2 with all library updated.

attempting to restore a Moodle v3.4.6+ course with H5P activity(Interactive video) to a Moodle v3.6.3 would result "error/unknown_context_mapping"

Steps to reproduce the error:

  1. Add an h5p activity to a moodle 3.4 course.
  2. Backup the moodle 3.4 course.
  3. Restore into a moodle 3.6 course.
  4. The backup will fail with an error/unknown_context_mapping error.

On screen debug output on screen from Moodle v3.6 is attached in the post.

nadavkav's picture

I am experiancing the same issue

(And it was also reported here:

https://h5p.org/node/488557

https://tracker.moodle.org/browse/MDL-65361 )

This happens when for some reason, in mdl_context the first line id is not 1. (The context line of the site itself)

We were able to get around this currently by editing: mod/hvp/backup/moodle2/restore_hvp_stepslib.php

in function after_execute() line 291

replacing:

$this->add_related_files('mod_hvp', 'libraries', null, $context->id);

with:$this->add_related_files('mod_hvp', 'libraries', null, 1);
This will only work when the origin site had his id set to one (mdl_context.id)we need to really pass the old context id, I currently don't know how to do this Thanks