So, quick notes about the selection/upload of backup files and so on (named, since now, the restore pre-ui).
This restore pre-ui must be responsible, IMO, of a bunch of tasks (none of them implemented in the restore process at all). Here is one list:
1) Pick one backup file (from repo, from file browser...). By default I think that the list to be shown is the list of files present in the context the user selects "restore" (course/activity/user). But the UI must allow the user to quick switch to other contexts. I really know nothing about the file manager/browser/repos stuff, so I cannot comment about implementation details too much. But, in my mind, each "restore" link must display the files available in that area. Or upload (and download) new files to it if the user has perms.
2) Once one file is picked, it's moved to one "xxxxxx" directory under CFG->dataroot/temp/backup and unzipped there. Note there is one restore_controller::get_tempdir_name() method available to generate correct "xxxxxx" names.
3) If possible, one page showing the main info for that backup is displayed (much like the 1.9 restore).
==== And here the complex things begin!
The restore pre-ui is also responsible for allowing the user to specify the target of the restore operation. And this is a complex thing. It must support different alternatives like:
a) new course, existing course, current course.
b) deleting info or adding info.
c) pickup category when new course is selected
d) pickup course when existing is selected
e) keep current course (the one we have ignited the restore operation from)
f) delete course contents when one of the "deleting" options is selected.
g) do all this in an "secure way", checking for permission for each of the options/categories/courses.
I know it sounds like a complex thing, but all that is implemented in restore 1.9, so perhaps, the first step is to see all the possibilities working in one 1.9 site, with various categories/courses, as admin and teacher with different permissions.
At the end, all the restore process needs is:
- One target courseid where the restore will happen.
- One target mode (see the backup::TARGET_xxxx constants in backup.class.php) to let the process know how to present some settings/execute some steps.
Let's comment. But plz, first, take a look to 1.9 restore with detail, I'm sure it will make things easier to discuss.