Just wondering, does anyone have a script that they can share that performs a course import on the command-line (CLI)?
We have a course with a huge question bank that is failing to backup/restore properly and I want to run the import via CLI to avoid timeout issues. The import on the GUI is taking 2+ hours until something times out.
There is a CLI script to do the backup: https://github.com/moodle/moodle/blob/master/admin/cli/backup.php
And a moosh script to do the restore: https://github.com/tmuras/moosh/blob/master/Moosh/Command/Moodle33/Course/CourseRestore.php
But does anyone have any code on how to do the import via CLI?
I tried looking at how to make this page CLI: https://github.com/moodle/moodle/blob/master/backup/import.php
But questions abound like:
- How do I set the backup controller to get to the final stage so it can execute?
- It seems I need to setup the import_ui(), but how do you step through it to get to the end via CLI?
- I see that backup::INTERACTIVE_YES is being set even on CLI scripts, what is it never not set to backup::INTERACTIVE_NO?
Just hoping someone did the heavy lifting from before and can share.