The following sequence of events happened to us last week:
- LMB creates course for the current term.
- Teacher imports course data from past term.
- Teacher ticks box that says 'overwrite course configuration' (we think)
- Course idnumber gets annihilated somehow
The next day LMB (we run in bulk mode) tried to re-create the now missing course, but encountered a fatal error since the shortname still existed. Stack trace:
Default exception handler: Short name is already used for another course Debug:
Error code: shortnametaken
- line 3837 of /course/lib.php: moodle_exception thrown
- line 778 of /enrol/lmb/lib.php: call to create_course()
- line 635 of /enrol/lmb/lib.php: call to enrol_lmb_plugin->create_shell_course()
- line 465 of /enrol/lmb/lib.php: call to enrol_lmb_plugin->process_course_section_tag()
- line 277 of /enrol/lmb/lib.php: call to enrol_lmb_plugin->process_group_tag()
- line 385 of /enrol/lmb/lib.php: call to enrol_lmb_plugin->process_file()
- line 72 of /enrol/lmb/cli/folderprocess.php: call to enrol_lmb_plugin->process_folder()
!!! Short name is already used for another course !!!
LMB stopped on this exception, preventing it from running until we'd tracked down the bad course. This proved difficult since create_course() doesn't include the bad shortname or idnumber in the exception. I've raised that issue in
MDL-41256. What I'm wondering is if LMB can perhaps catch these exceptions and log them, so that one bad course doesn't stop the whole process.