Restore to a new course option gone?

Restore to a new course option gone?

by Lars Jensen -
Number of replies: 6

Three month ago I did a course restore from back-up and had three option:

  1. Back up and erase data
  2. Back-up and add data
  3. Back-up to a new course

Has the third option been removed?

What is now the recommended method to back up to a new course? Is this what I need to do:

  1. Manually create a new course.
  2. Copy the back-up file into it,
  3. Restore

Lars.

Average of ratings: -
In reply to Lars Jensen

Re: Restore to a new course option gone?

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Lars,

The "Restore to new course" option is restricted to Moodle administrators. If you are logged as an "Editing teacher" (no admin) you'll see:
  • Restore to current course, deleting, and
  • Restore to current course, adding.

As an admin you'll see:
  • Restore to existing course, deleting,
  • Restore to existing course, adding, and
  • Restore to new course.

Is this your situation ?

Finally, note the difference between current and existing words, depending of your roles in Moodle.

Hope it helps, Ciao smile
In reply to Eloy Lafuente (stronk7)

Re: Restore to a new course option gone?

by Daniel Mikšík -
Picture of Core developers Picture of Translators
Hello Eloy,
thanks for clearing this out, I was also a little confused no to see the "new course option" when restoring. But I have another question: What is the exact reason for not allowing teachers to restore into a new course? If a teacher wants to archive a course for some time (students coming to get their credits after two semesters etc.) and at the same time to use the existing course as a template for generating a new instance of the course, then why not let them do it?smile
Dan
In reply to Daniel Mikšík

Re: Restore to a new course option gone?

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Daniel,

I think that the main reason is to be consistent with the rest of Moodle. If teachers cannot create new courses, then I think that there isn't reason to allow them to create courses using the restore feature.

Somebody with appropriate perms (admin, coursecreator) should create the course (empty), grant to the teacher rights to be teacher in the new course too and then, the teacher could restore the course (the old one) in that existing (new and empty) course.

This is the reason. Anyway, every possible alternative will be welcome, of course (if it doesn't break the behaviour of current Moodle's roles).

Ciao smile
In reply to Eloy Lafuente (stronk7)

Re: Restore to a new course option gone?

by Daniel Mikšík -
Picture of Core developers Picture of Translators
Shouldn't course creators then have the permission to restore to a new course, if they can create new courses anyway? I think this would be consistent with the rest of Moodle and would relieve the admin a bit, moreover at a place where s/he has already given out the permission to create new courses. Just a thought. smile

BTW are there any directions on writing a backup/restore libs for backing up/restoring a new module coded by ourselves? If not, don't bother, I'll just dive into your code.tongueout
Dan
In reply to Daniel Mikšík

Re: Restore to a new course option gone?

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
houldn't course creators then have the permission to restore to a new course, if they can create new courses anyway?
Yes, yesterday, when I was writing my response, I thought that you were going to answer exactly this (telepathy perhaps, or only a bit of logic). big grin I'll try to do it, but I've to analyse it...

are there any directions on writing a backup/restore libs for backing up/restoring a new module coded by ourselves?
It's possible, sure. The backup & restore utility has been designed to be modular with Moodle's modules, so creating the backuplib.php and restorelib.php files and including the module_get_participants() function in your mod/module/lib.php should be sufficient. I recommend you to take a look inside every mod/XXX dir (select a similar mod) to see what you need to include in your module.
If you have questions about it, I'm here!! smile

Ciao smile
In reply to Eloy Lafuente (stronk7)

Re: Restore to a new course option gone?

by Penny Leach -
Hi Eloy!

I've just come across this as well - shouldn't the logic look like

if (isteacheredit($id) and !isadmin()) {
$restore_restoreto_options[0] = get_string("currentcoursedeleting");
$restore_restoreto_options[1] = get_string("currentcourseadding");
}
if (isadmin() || iscreator()) {
$restore_restoreto_options[0] = get_string("existingcoursedeleting");
$restore_restoreto_options[1] = get_string("existingcourseadding");
$restore_restoreto_options[2] = get_string("newcourse");
}

:: I changed if (isadmin()) { to if (isadmin() || iscreator()) {