Slow backup / resture using moodle and using sharing cart's picture


We are using H5P on many of our client's sites and we are now experiencing very slow backup and restore of very simple courses.

When using sharing cart - (another 3rd. party extension - "The Sharing Cart is a block for duplicating course items into a personal library and an easy way to move those Moodle resources and activities between multiple courses on your site. " - - we are experiencing very slow insert and copy times. - it uses backup / restore functions from moodle.

The same issue when we back up a course when the course contains an h5p assignment, it takes very long time to backup / restore and almost no time when containing all other assignment types, such as quizzes, assignments and so. We have Moodle making the attached chart for us to see how many processes were used to copy a simple course with one H5P assignment in.

Kind regards 

Henrik Sune Pedersen

icc's picture

Hi Henrik,

This is correct and is actually a result of H5P having many files/dependencies and some shortcomings of the backup system, such as lack of shared resources between activities and iterating many times over the same data. To get around the biggest part of the problem we added a custom option you can set in your Moodle's config.php:

$CFG->mod_hvp_backup_libraries = '0';

This will leave out most of the requirements from the backup, meaning that you have to ensure that the H5P content types are already present on the system where you import the backup. If you are only export/importing on the same site there should be no issues.


21cccs's picture

I'm having the same issue with sharing cart taking forever to restore a copied H5P, but I'm Hosted, so i can't modify the core code. Im on moodle 3.7.4 and using a pretty recent version of sharing cart. Any suggestions for a hosted situation?

we have used : $CFG->mod_hvp_backup_libraries = '0';

in moodle 3.5 and are now upgrading to moodle 3.9, h5p is now part of moodle core, is this workaround still applicable in order to speed up backups and reduce their size?