by Lazaros Sotiriadis.
Hi Simon,
Good to know the code worked. As I can verify too there are more problems with restoring course backups, not just from cli that have to be solved. Usually the errors occur when restoring quizzes or multiple answer questions, not just users and they appear in UI restorations as well.
In some of my backups (usually large courses) I am unable to restore backups and I get similar errors with temp tables hanging in the end. I think this is a general moodle problem that has to be addressed. Any moodle backup has to be able to restore otherwise we can't really rely
on the backup system. Right now I have courses that I am unable to restore from backups.
If as you say restore from UI works then we just have to see what restore options your UI uses. The only options that I specify in my restore script that could affect the process are TARGET_NEW_COURSE or TARGET_DELETE_EXISTING and MODE_GENERAL.
The first 2 are chosen if the course has to be created as new or overwrites an existing one.
The second one has to do with the way the controller restores data and can be any of MODE_[ GENERAL | HUB | IMPORT | SAMESITE].
We have to investigate differences and if one of those restores the courses completely without error then we might want to make an extra option for it on the restore script, so we can try different approaches.
I will also have to ask if it's possible for you to test single restore of one of the courses (with grid format), to see if overwrite works.
I will update the script with "--mode" option for you to test.
Regards,
Lazaros
Good to know the code worked. As I can verify too there are more problems with restoring course backups, not just from cli that have to be solved. Usually the errors occur when restoring quizzes or multiple answer questions, not just users and they appear in UI restorations as well.
In some of my backups (usually large courses) I am unable to restore backups and I get similar errors with temp tables hanging in the end. I think this is a general moodle problem that has to be addressed. Any moodle backup has to be able to restore otherwise we can't really rely
on the backup system. Right now I have courses that I am unable to restore from backups.
If as you say restore from UI works then we just have to see what restore options your UI uses. The only options that I specify in my restore script that could affect the process are TARGET_NEW_COURSE or TARGET_DELETE_EXISTING and MODE_GENERAL.
The first 2 are chosen if the course has to be created as new or overwrites an existing one.
The second one has to do with the way the controller restores data and can be any of MODE_[ GENERAL | HUB | IMPORT | SAMESITE].
We have to investigate differences and if one of those restores the courses completely without error then we might want to make an extra option for it on the restore script, so we can try different approaches.
I will also have to ask if it's possible for you to test single restore of one of the courses (with grid format), to see if overwrite works.
I will update the script with "--mode" option for you to test.
Regards,
Lazaros