Moodle Course Restore

Moodle Course Restore

by Rami El Sayed -
Number of replies: 1

I have moodle on a raspberrypi running and i made a backup from the courses that are in a moodle v 4.5.3 and I want to restore them on a moodle 4.2.1 using a restore shell script, while doing the process I faced this error(I'm making the restore threw moosh commands) this is the followng error:
 moosh -n course-restore /opt/GRADE1_EFA/Grade1_Arabic/coursebackup2198.mbz 497
Creating new course to restore backup
Restoring (new course id,shortname,destination category): 1933,ArSF101,497
Restore pre-check failed!
array(1) {
  ["warnings"]=>
  array(1) {
    [0]=>
    string(284) "This backup file has been created with Moodle 4.5.3 (Build: 20250317) (2024100703) and it's newer than your currently installed Moodle 4.1.2+ (Build: 20230318) (2022112802.02). This could cause some inconsistencies because backwards compatibility of backup files cannot be guaranteed."
  }
}

and also the course is restored , the h5p inside is empty and show an error on the moodle interface saying:!!! Exception - Error writing to database !!! Potential coding error - existing temptables found when disposing database. Must be dropped!
Can someone help with it?

Average of ratings: -
In reply to Rami El Sayed

Moodle Course Restore

by Marvin H -
Hello Rami,

like the error says, its probly not a good idea to restore a course from a higher version of moodle to a lower version.

Kind of Strange that the coruse is restored to a certain level when the precheck fails. When the restore didn´t finished completly your described behaviour is not strange in my opinion.

Did you try running the command with --ignore-warnings to ignore the precheck? see https://moosh-online.com/commands/ under course-restore
 
"

Example 3: Ignore pre-check warnings, like restoring backup from higher Moodle version.

moosh course-restore --ignore-warnings backup.mbz 1
"


Greetings
Marvin