backup and restore h5p core course

backup and restore h5p core course

ni Hussein Allaham -
Number of replies: 12
we have a lot of courses using h5p interactive content, and we want to migrate them into h5p core in order for them to be downloadable,
so after migrating a course I took a backup then restore it on a different server after restoring finished it shows this exception 

Aliases restore failures

Some aliases included in the backup file could not be restored. The following list contains their expected location and the source file they were referring to at the original site.
  • /323/mod_h5pactivity/package/0/decouvre-5-4657.h5p
  • /324/mod_h5pactivity/package/0/decouvre-ecoute-et-repete-pour-t-039-entrainer-4658.h5p
  • /325/mod_h5pactivity/package/0/je-tu-4659.h5p
  • /326/mod_h5pactivity/package/0/2-presenter-sa-famille-4660.h5p
  • /327/mod_h5pactivity/package/0/ecoute-et-repete-pour-t-039-entrainer-3-4661.h5p
  • /328/mod_h5pactivity/package/0/il-elle-4662.h5p
  • /329/mod_h5pactivity/package/0/decouvre-6-4663.h5p
  • /330/mod_h5pactivity/package/0/ecoute-et-repete-pour-t-039-entrainer-3-4664.h5p
  • /331/mod_h5pactivity/package/0/audio-1-c-119-4665.h5p
  • /322/mod_h5pactivity/package/0/comment-ca-marche-4656.h5p


 when trying to view the course it returns this error,
note that: when turning the editing on, and edit the content it's shown correctly
 
Debug info:
Error code: generalexceptionmessage
Stack trace:
  • line 57 of /mod/h5pactivity/view.php: Error thrown

then just to make sure the new site had the correct configuration to contain h5p core activity, I installed this plugin https://moodle.org/plugins/tool_migratehvp2h5p and did a migration for an existing course, it works fine 

also, I notice that: after migrating h5p interactive content into h5p core, teachers can't edit it anymore, they only can download the h5p file and edit it then upload it, while the manager or admin roles can edit it live on the platform,  

any suggestion or thought in order to copy h5p core courses into another server, and regarding teacher editing h5p core courses 

thanks in advance
Attachment photo_2021-09-22_13-22-47.jpg
Attachment photo_2021-09-22_13-42-4445.jpg
Average of ratings: -
In reply to Hussein Allaham

Re: backup and restore h5p core course

ni Sara Arjona Téllez -
Larawan ng Core developers Larawan ng Moodle HQ Larawan ng Particularly helpful Moodlers Larawan ng Peer reviewers Larawan ng Plugin developers Larawan ng Testers

Hi Hussein Allaham!

Thanks for reporting this and adding some screenshots to understand better what you were explaining ngiti

  • Regarding the issue you faced when creating a backup with H5P activities containing a link to the content bank and then restoring it in a new Moodle site, I've just added a comment in https://tracker.moodle.org/browse/MDL-31094.
  • If you want to avoid the previous error, you should review all the H5P activities using a link and replace it with a copy of the file. If you have created these H5P activities using the migration tool, there is one setting to create a copy, instead of a link, which in your case might be more interesting (the recommendation is to use link whenever possible, especially because usually people don't migrated data from one site to a different one).
  • The content bank has one capability, "Manage any content from the content bank (moodle/contentbank:manageanycontent)", that by default is enabled only for Course creators and Managers that you can give to your teachers if you want them to edit any content in the content bank (not just the one they have created).

I hope this helps ngiti

Kind regards from Barcelona,

Sara

In reply to Sara Arjona Téllez

Re: backup and restore h5p core course

ni Przemek Kaszubski -
Larawan ng Particularly helpful Moodlers Larawan ng Testers
I described a possible workaround here:
https://moodle.org/mod/forum/discuss.php?d=424426#p1720914

I think my method works. It is possible to re-link / re-embed the files if we clearly name them in the original course and include the filename info as e.g. in the H5P activity description field (or somehow else keep this info as a teacher's note). I'm assuming that the links point(ed) to the Content Bank files within the original course.

On the use of copies rather than links to the course's Content Bank files: unfortunately in this way it is no longer possible to post-edit the H5P. One would have to manipulate the file outside of the course's context - e.g. download the file, use Lumi to open and edit, then re-upload and replace in the activity / embed context. Cumbersome...

I have of course voted for https://tracker.moodle.org/browse/MDL-31094, and would encourage all H5P Moodlers to do the same ngiti . For a sensible workflow within Moodle - this feature is a must-have.
In reply to Przemek Kaszubski

Re: backup and restore h5p core course

ni Sree M -
Hello @Przemek,
I am experiencing the same issue. I have a course on our moodle test server. I have created some H5p activities on the content bank and linked the files to the course activity (not embed as a copy). Each H5p files are named separately. Please see screenshot.


When I backup and restore the course and content bank to production server, the H5P files are showing up on this content bank with the same file name. But the activity where this file was linked is giving the same error as Mr Hussein.

Can you please let me know where exactly i have to name the files clearly? I didn't understand this part.

Thank you
Sreenath
In reply to Sree M

Re: backup and restore h5p core course

ni Przemek Kaszubski -
Larawan ng Particularly helpful Moodlers Larawan ng Testers
Hi,
This should be quite simple? It would appear that you already have what you need?
Now open each H5P activity, delete any file uploaded / linked there, and add the appropriate H5P file from the course's Content Bank, whether file or copy. You simply have to know which one to choose - on the basis of the info from the backed up course. Your files are consecutively numbered, so perhaps this is all the info you need to make the right choice.
HTH. Good luck,
Przemek
In reply to Przemek Kaszubski

Re: backup and restore h5p core course

ni Sree M -
Hello Przemek,
Thank you for your reply and apologies in responding to you very late.

This is not working because as soon as i click on H5P activity or try to edit the activity, it gives me the error message.

In reply to Sree M

Re: backup and restore h5p core course

ni Przemek Kaszubski -
Larawan ng Particularly helpful Moodlers Larawan ng Testers
I wouldn't know what this is...
To find out more turn on the Debugger (DEVELOPER level + Display debug messages). You will then see the Stack trace displayed underneath the error message. This might help someone to troubleshoot the error.

Do you get the same error when adding a new H5P activity and trying to link to a selected package?

My other two thoughts are:
1) Download the latest packages from h5p.org using the Scheduled task > Run now
2) Maybe you will actually need to re-install H5P ... (an inexpert idea)

HTH. Przemek
In reply to Przemek Kaszubski

Re: backup and restore h5p core course

ni Przemek Kaszubski -
Larawan ng Particularly helpful Moodlers Larawan ng Testers
Follow-up based on migrating my own H5P demo course between two Moodles (both 3.11.*):

Step 1:


Step 2:


Step 3:


Step 4:


Step 5:



Voila. I was able to restore / re-link about thirty activities in this way in about thirty minutes.

I agree this is a bug, and Moodle should remember the linked files. But at least we've got this workaround.

HTH.

In reply to Przemek Kaszubski

Re: backup and restore h5p core course

ni Sree M -
Hello Przemek,

Thank you for the detailed explanation. But the gear icon is not coming for me. If i click edit settings from the moodle activity i am unable to go to the file upload area

BR,
Sreenath

Attachment Screenshot 2022-08-31 123344.png
Attachment Screenshot 2022-08-31 131913.png
In reply to Sree M

Re: backup and restore h5p core course

ni Przemek Kaszubski -
Larawan ng Particularly helpful Moodlers Larawan ng Testers
Yours is a Moodle 4 site. Click the "Settings" tab right of the "H5P" one.
(My example was from Moodle 3.11.)
In reply to Przemek Kaszubski

Re: backup and restore h5p core course

ni Sree M -
We had to get into the moodle code and DB to solve this issue. Unfortunatlely there is no front end level solution for this. Thank you @Przemek.