Wednesday, November 22, 2023

saga of backing up and restoring a course with H5P content on moodle

My initial understanding was that backing up and restoring a course with H5P content on moodle would not work, based on the discussion at https://moodle.org/mod/forum/discuss.php?d=427198

A test course backup and restore did not work. But then, it turned out that the issue was that the H5P plugin mod_hvp had some missing files (since this moodle instance had its database copied over from another test instance) which were causing H5P content to not display at all. Diagnosed via php errors in /var/log/apache2/error.log.

The relevant course had 90+ H5P activities, it took 2.5 hours to backup via the CLI, and the restore also is likely to have taken a similar amount of time. 
screen
date && sudo -u www-data /usr/bin/php admin/cli/backup.php --courseid=511 && date
Mon Nov 20 14:38:34 UTC 2023
== Performing backup... ==
Backup completed, the new file is listed in the backup area of the given course
Mon Nov 20 17:09:05 UTC 2023

Detailed notes and dead ends listed below.

Looking at the discussion here,
It seems there are two ways in which H5P files can be used in a course - as a "link" and as a "downloadable file".
The "downloadable file" method is such that the course instructors cannot edit the content from the server, they need to download it to their computer and use some other software to edit it - so I guess what you have used is the "link" method.

In that case, there seems to be no easy way to backup and restore, the easiest way may be to re-create the course on the new server, if my understanding of the discussion here is correct - 

(
Another option would be to copy the entire database of the learning server onto the student server - and then you would need to
delete all unnecessary users
delete all unnecessary courses
re-upload files for all necessary courses
re-upload all files for appearance, logo, etc.
but this seems to be more difficult that re-creating the course. 
)

(
According to the last-but-one comment in the bug tracker
course backup and restore would work, but only tested on the same server. 

I tried out the command-line backup option for that course,
but that also did not finish even after an hour - stopping it manually gave the error message
Potential coding error - existing temptables found when disposing database. Must be dropped!
This looks like some sort of bug in the moodle backups code, I guess.

Or maybe just some temp tables which need to be dropped.

Apparently temp tables are automatically dropped when the connection to the database is closed.

)

(
Checking
moodledata/temp/backup/ directory
and
and

Even after clearing the moodledata/temp/backup directory, even a small course is taking a long time to backup.
So, there may be some temp data tables which need to be dropped. Need to check - 
Potential coding error - existing temptables found when disposing database. Must be dropped!

SELECT * FROM information_schema.INNODB_TEMP_TABLE_INFO;
(no results)
)

mentions backup can hang if non-standard course format

delete a file
go to course, choose the file / activity / resource, choose delete

delete a course

h5p backup speedup by disabling backing up libraries

Backup settings page, choose not to include the libraries
But not available in
Site Administration - Courses - General backup defaults

Will enable async backup with
https://devel2.server.of.ours.org/admin/settings.php?section=asyncgeneralsettings
and try.

Tried creating a course on devel2 with
My Courses -> Create new course.

Backup option is inside the course, under More -> Course Reuse -> Backup

Restoring similarly,
can go to any course, More -> Course Reuse -> Restore
and then choose to restore to a new course.
(NOT Import)

Just as in the learning portal, on the student portal also, the H5P hub option is turned on,
https://our.server/admin/search.php?query=hub

I have turned off and turned on this setting as suggested in one of the replies in the thread

In case that does not help, it may be required for you to fill in the H5P Hub account settings,
Register an account on the H5P Hub here

If not,

Another possible cause for confusion may be the two different ways of using H5P, using a plugin and using H5P core.
This discussion above uses Moodle 3.9, but our case with Moodle 4.1 might be different, too, and we might have to investigate further.

mod_h5p and mod_h5pactivity are already installed by default in Moodle 4.
https://server/admin/plugins.php

I tried creating a simple h5p activity in a test course by uploading a file arithmetic-quiz-22-57860.h5p, but the activity is not visible on the student site

To display H5P content in Moodle activities, the Display H5P filter must be enabled, and the URL (e.g., h5p.com) should be listed as an allowed source in Site admin / Plugins / Filters / Display H5P.


https://docs.moodle.org/401/en/Display_H5P_filter

Found a google drive listed there,

https://drive.google.com/file/d/1Mviw-REDACTEDZ3F/view?usp=sharing

After removing, still no. 

I see two possibilities.

1. In the page which talks about setting up h5p on moodle, there is mention of a filters page, where the url of the h5p server should be entered - 
There was a google drive link in that filters section which I have now removed. But then, we may need to add the correct filters. Or perhaps the "show h5p content"  may be sufficient, which is done at this page,
https://server/admin/filters.php 
If you have some url with a working h5p content from the hub, we can put the appropriate url in
https://server/admin/settings.php?section=filtersettingdisplayh5p

2. Another possibility is this thread - 


1. files missing as seen in apache2 errors.log


2. Compatibility issue with PHP 8,

But we're using PHP 7.x, so not this issue.

Trying uninstalling both
mod hvpactivity and mod hvp
installed only mod hvp, working
While installing mod_hvp, it mentioned "automatically registering your site with h5p" - so that is also done.

Even the web-based backup worked, for the test course! Just took an hour. and included 4 MB.

For without user data,
first change backup default setting at
(take backup and then change the default back)

CLI backup completed in around 2.5 hours, it is available to download from the course's restore area
in "User private backup area" of admin user

No comments:

Post a Comment