Hi everyone
I have a Moodle 3.3.4+ (Build: 20180118) course backup containing quizzes with random questions. I have been trying to restore that backup to a Moodle 4.0.4+ (Build: 20221007) installation. Debugging mode indicates the failure as follows:
Notice: Undefined property: stdClass::$includingsubcategories in /opt/moodle/mod/quiz/backup/moodle2/restore_quiz_stepslib.php on line 346
Notice: Trying to get property 'qtype' of non-object in /opt/moodle/mod/quiz/backup/moodle2/restore_quiz_stepslib.php on line 335
Notice: Trying to get property 'questionbankentryid' of non-object in /opt/moodle/mod/quiz/backup/moodle2/restore_quiz_stepslib.php on line 359
... ultimately ending with "Error writing to database". I am now quite sure that this flows from changes made to the random question type at some point (https://tracker.moodle.org/browse/MDL-61380, perhaps), and my falling foul of a line beyond which backward compatibility seems to have broken. I've been trawling the source code hoping to muster enough understanding to attempt to fix this, but I'm actually quite stumped. Can anybody throw me any sort of lifeline, please?:
- It's clear enough from the above where the newly upgraded question needs to be written, but can anybody direct me to where it is being parsed from the backup file to begin with? It seems that the random question is a special case, and I'd like to see where that is implemented.
- Perhaps there is a more appropriate migration path than directly from 3.3.4+ to 4.0.4+. I am not at liberty to upgrade the 3.3.4+ server, but I might be able to spin up another Moodle 3.x as an intermediate step, if that has any prospect of success. What version might that be?
I do understand that I could simply rebuild all 325 random questions on the new server if there really is no other way, but I'm especially loathe to be losing all of the usage statistics gathered over time. I'm really hoping there's some way to do this migration without losing those. Any and all help is appreciated, thank you.
Mark