tmuras / moosh

Moosh
GNU General Public License v3.0
234 stars 177 forks source link

Command QuestionImport: Questions in XML file cannot be imported in Moodle 4.1 #499

Open minhduchoang195 opened 2 months ago

minhduchoang195 commented 2 months ago

Actual behaviour

The latest module for "QuestionImport" belongs to Moodle39. And this module calls some deprecated functions in Moodle 4. Therefore, this import could not be carried out successfully so far with the following error messages.

++ Class 'question_edit_contexts' has been renamed for the autoloader and is now deprecated. Please use 'core_question\local\bank\question_edit_contexts' instead. ++
* line 143 of /lib/classes/component.php: call to debugging()
* line ? of unknownfile: call to core_component::classloader()
* line 40 of /usr/local/moosh/1.21-fix-472/Moosh/Command/Moodle39/Question/QuestionImport.php: call to spl_autoload_call()
* line 363 of /usr/local/moosh/1.21-fix-472/moosh.php: call to Moosh\Command\Moodle39\Question\QuestionImport->execute()
++ Parsing questions from import file. ++
!! Cannot read import file (or file is empty) !!
++ The function print_error() is deprecated. Please throw a new moodle_exception instance instead. ++
* line 3664 of /lib/deprecatedlib.php: call to debugging()
* line 71 of /usr/local/moosh/1.21-fix-472/Moosh/Command/Moodle39/Question/QuestionImport.php: call to print_error()
* line 363 of /usr/local/moosh/1.21-fix-472/moosh.php: call to Moosh\Command\Moodle39\Question\QuestionImport->execute()
Default exception handler: Import error Debug:
Error code: cannotimport
* line 3665 of /lib/deprecatedlib.php: moodle_exception thrown
* line 71 of /usr/local/moosh/1.21-fix-472/Moosh/Command/Moodle39/Question/QuestionImport.php: call to print_error()
* line 363 of /usr/local/moosh/1.21-fix-472/moosh.php: call to Moosh\Command\Moodle39\Question\QuestionImport->execute()

!!! Import error !!!
!!
Error code: cannotimport !!
!! Stack trace: * line 3665 of /lib/deprecatedlib.php: moodle_exception thrown
* line 71 of /usr/local/moosh/1.21-fix-472/Moosh/Command/Moodle39/Question/QuestionImport.php: call to print_error()
* line 363 of /usr/local/moosh/1.21-fix-472/moosh.php: call to Moosh\Command\Moodle39\Question\QuestionImport->execute()
 !!

Expected behaviour

To adapt to Moodle 4.1, a new module for question import should be created.

Steps to reproduce

Use the question-import command to import questions from an XML file into a quiz in Moodle 4.1.