I used some bad prctice to fix the restore problem from HVP to H5P, where on restore the context ($context->id) genertated an error.
i changed mod/hvp/backup/moodle2/restore_hvp_stepslib.php
line 291 >>
protected function after_execute() {
global $COURSE;
global $USER;
$usercontext = context_user::instance($USER->id);
// Add files for libraries.
$context = \context_system::instance();
$this->add_related_files('mod_hvp', 'libraries', null, $usercontext->id);
}
How should it be done properly.
Thank you
Avi