Issue Details (XML | Word | Printable)

Key: MDL-6084
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Eloy Lafuente (stronk7)
Reporter: Ray Lawrence
Votes: 1
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Restore to new course failure notice if logged in as course creator

Created: 12/Jul/06 07:20 AM   Updated: 14/Oct/06 08:00 PM
Return to search
Component/s: Backup
Affects Version/s: 1.6
Fix Version/s: 1.6.3

Environment: Linux

Database: MySQL
Participants: Daniel Miksik, Eloy Lafuente (stronk7), Martin Dougiamas and Ray Lawrence
Security Level: None
Resolved date: 05/Oct/06
Affected Branches: MOODLE_16_STABLE
Fixed Branches: MOODLE_16_STABLE


 Description  « Hide
If I attempt to restore the attached backup file whilst logged in as a course creator I get the following failure notice when restoring to create new course:



An error has occurred and the restore could not be completed!



Adding to an exiting course works fine.



Both sites 1.6+

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Martin Dougiamas added a comment - 12/Jul/06 11:51 PM
From Daniele Cordella (d.cordella at iss.it) Wednesday, 12 July 2006, 01:59 PM:

I saw a strange option during the process.

Attached the screenshot.

From Daniele Cordella (d.cordella at iss.it) Wednesday, 12 July 2006, 02:29 PM:

I do confirm the the error but... in spite of the error notification... the course was restored.

From Ray Lawrence (ray at howtomoodle.com) Wednesday, 12 July 2006, 11:03 PM:

I've isolated this issue to the course creator not being a Teacher in the course being restored. Is this the expected behaviour or a bug?

From paolo oprandi (paolo at sussex.ac.uk) Wednesday, 12 July 2006, 11:36 PM:

Ray, I'd call it slightly buggy - the error message shouldn't be thrown. It is related to the bug I have filed:

http://moodle.org/bugs/bug.php?op=show&bugid=6051&pos=6

From Ray Lawrence (ray at howtomoodle.com) Wednesday, 12 July 2006, 11:39 PM:

Thanks Paolo. I'm watching that bug too. Unfortunately I won't have time to do much more testing on this in the near future.


Michael Blake made changes - 21/Aug/06 04:21 PM
Field Original Value New Value
Assignee Eloy Lafuente [ eloylafuente ] Eloy Lafuente [ stronk7 ]
Daniel Miksik added a comment - 04/Oct/06 10:08 PM
In my environment, the solution was to define the $USER constant as global at the beginning of the restore_execute() function:

— ORIGINAL\backup\restorelib.php Tue Sep 19 13:54:26 2006
+++ MODIFIED\backup\restorelib.php Wed Oct 04 15:39:34 2006
@@ -4850,3 +4850,3 @@
function restore_execute(&$restore,$info,$course_header,&$errorstr) {

  • global $CFG;
    + global $CFG, $USER;
    $status = true;

Without this modification, the restore process finishes correctly (i.e. the whole course is properly restored), the only thing that is not completed is adding the current user as a teacher to the newly created course:

line 5355: $status = add_teacher($USER->id, $restore->course_id);

as the $USER->id is not available to it.


Eloy Lafuente (stronk7) added a comment - 05/Oct/06 01:41 AM
Hi Daniel,

it seems to have sense, so I've applied your suggestion to 1.6! Thanks!


Eloy Lafuente (stronk7) made changes - 05/Oct/06 01:41 AM
Fix Version/s 1.6.3 [ 10140 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Kurt Rosivatz made changes - 14/Oct/06 07:59 PM
Link This issue is blocked by MDL-6722 [ MDL-6722 ]
Kurt Rosivatz made changes - 14/Oct/06 08:00 PM
Link This issue is blocked by MDL-6722 [ MDL-6722 ]