Moodle

restore course, deleting ir first fails

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.9.2
  • Fix Version/s: 1.9.5
  • Component/s: Backup
  • Labels:
    None
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

When I restore a course using the option: 'Current course, deleting it first', the course is restored in the main course!!!!! The restore process remove all blocks and Site Files!

The problem happens because in restorelib.php, at line 7528, $restore->course_id ALWAYS is 1

Activity

Hide
Moises Carretero added a comment -

I solve the problem with this modification:

7528........... //$course = get_record("course","id",$restore->course_id);
7529........... $course = get_record("course", "shortname", $restore->course_shortname);
7530........... $restore->course_id = $course->id;

This works, but I think the best solution is to obtain the correct $restore->course_id

Show
Moises Carretero added a comment - I solve the problem with this modification: 7528........... //$course = get_record("course","id",$restore->course_id); 7529........... $course = get_record("course", "shortname", $restore->course_shortname); 7530........... $restore->course_id = $course->id; This works, but I think the best solution is to obtain the correct $restore->course_id
Hide
Petr Škoda (skodak) added a comment -

Eloy, could you please have a look at this?

Show
Petr Škoda (skodak) added a comment - Eloy, could you please have a look at this?
Hide
Mary Parke added a comment -

Moises,

What role are you in when you attempt to do the restore? Currently, only users in the role of "admin" or "course creator" can restore to a course OTHER than the "current course".

So, if you choose the option "Current course, deleting it first" it will overwrite the course you were in and performing the restore from.

Check your role....this is an issue for others who would like users in the role of "teacher" to be able to choose from a list of other courses that they have rights assigned to, but that is as they say, a separate issue.

Best,

Mary

Show
Mary Parke added a comment - Moises, What role are you in when you attempt to do the restore? Currently, only users in the role of "admin" or "course creator" can restore to a course OTHER than the "current course". So, if you choose the option "Current course, deleting it first" it will overwrite the course you were in and performing the restore from. Check your role....this is an issue for others who would like users in the role of "teacher" to be able to choose from a list of other courses that they have rights assigned to, but that is as they say, a separate issue. Best, Mary
Hide
Petr Škoda (skodak) added a comment -

can not reproduce

Show
Petr Škoda (skodak) added a comment - can not reproduce
Hide
Eloy Lafuente (stronk7) added a comment -

Tested here too. Both with teacher and admin account. Seems to be working ok and courses are restored as normal courses.

Closing as "Cannot Reproduce". If you can provide any additional info in order to reproduce it, feel free to do so and reopen this, Moises.

Gracias!

Show
Eloy Lafuente (stronk7) added a comment - Tested here too. Both with teacher and admin account. Seems to be working ok and courses are restored as normal courses. Closing as "Cannot Reproduce". If you can provide any additional info in order to reproduce it, feel free to do so and reopen this, Moises. Gracias!
Hide
Rahim Virani added a comment -

Just quickly, I have tried to restore two courses now and I still experience "Something must be wrong" I know, its so helpfull, see the screenshot, it looks like someone is running var_dump() on fail.

Show
Rahim Virani added a comment - Just quickly, I have tried to restore two courses now and I still experience "Something must be wrong" I know, its so helpfull, see the screenshot, it looks like someone is running var_dump() on fail.
Hide
Eloy Lafuente (stronk7) added a comment -

Yes, Rahim, the "Something must be wrong" message is displayed (together with some debug - var_dump() like - info) if something fails in the early steps of restore.

That includes problems with sessions, with the XML parsing and so on. If you can send (privately if needed) some more info about all the output generated by those restore operations (executed with moodle's debug enabled), we can try to detect the ultimate cause for that error.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Yes, Rahim, the "Something must be wrong" message is displayed (together with some debug - var_dump() like - info) if something fails in the early steps of restore. That includes problems with sessions, with the XML parsing and so on. If you can send (privately if needed) some more info about all the output generated by those restore operations (executed with moodle's debug enabled), we can try to detect the ultimate cause for that error. Ciao

Dates

  • Created:
    Updated:
    Resolved: