Implement restore UI 90% equivalent to the backup one (
MDL-22142) but with some differences. Just quick-enumerating them here for further details/discussion.
A) We need support for date (day/month/year) setting. To be added to course settings, it's missing right now.
B) A lot of settings become decided by the backup file contents. For example, the root->users setting will be "No" if the backup was generated without users. In that case, it should display a simply label (dependencies of course, will continue being enforced but NOTHING will change that value). I've somehow configured the default values and the list of options of the current select ui elements. But I'm not sure if that's the way. Needs discussion.
C) Here it's one minimalistic restore API. Follow this steps in order to get it working:
– Set $CFG->keeptempdirectoriesonbackup = true; in your config.php files
– Execute one backup if one course containing at least one choice activity.
– Go to $CFG->dataroot/temp/backup and you will see one xxxxxxx directory. Copy that xxxxxxx
– Create one script with these contents:
As you can see, API is really similar to the backup one, but have two exceptions, both optional (don't happen always), but cause new request to happen:
C1 - If the backup format doesn't correspond to one moodle2 format, status will be STATUS_REQUIRE_CONV and conversion must be performed, surely with one page showing the situation (with continue button) and another to show the conversion process.
C2 - If the execution of the prechecks returns false, that means that something is preventing restore to be executed. The results returned by get_precheck_results() will be an array of warnings and/or errors. warnings will allow to continue with execute_plan() but errors wont. Note there is one new status STATUS_NEED_PRECHECK enforcing the execution of the prechecks.
Both these C1 and C2 mean that, apart from the "typical" settings pages... we'll need to be able to show (conditionally) other pages (stages) "in the middle" of the restore API. Needs discussion, for sure.
E - Tiny detail, once execute_plan() has finished ok, it should show one button to go to the restored course.
F - I'm sure that there was one F, grrr (and important!). But I've forgotten it. Sure it appears when implementing the whole thing.