History | Log In     View a printable version of the current page.  
We are currently focused especially on Moodle 2.0, Moodle 1.9.x bugs and Moodle 1.9.x testing.    Confused? Lost? Please read this introduction to the Tracker.
Issue Details (XML | Word | Printable)

Key: MDL-12922
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Martin Dougiamas
Reporter: Kenneth Newquist
Votes: 18
Watchers: 8
Operations

If you were logged in you would be able to see more operations.
Moodle

Course restores for non-admin users appear ~7 years early

Created: 11/Jan/08 06:00 AM   Updated: 25/Nov/08 07:46 AM
Component/s: Backup
Affects Version/s: 1.8.3
Fix Version/s: None

File Attachments: 1. Text File 192_restore_form_patch.txt (2 kb)
2. File backup_restore_fix.diff (0.8 kb)
3. File backup_restore_fix_1.9.diff (2 kb)

Environment: 1.8.3+ (2007021534)

Database: MySQL
Participants: David Kelly, Kenneth Newquist, Martin Dougiamas, matt greenwolfe, Rahim Virani and Yolanda Ordoñez Rufat
Security Level: None


 Description  « Hide
There is a problem in the restore component of backup that causes the dates on forum posts to be wildly off (7+ years) when a course with forums is restored by a teacher. If a course is restored by an admin, the forum post dates come in correctly.

What's happening is that /backup/restore_form.html has logic that checks to see if a course has a start date, and if it does, it gives the user the ability to modify that start date.

However the problem is that this start-date-checking logic is tied to the "course creator" capability -- if you don't have the coursecreator capability (and teachers don't) then it doesn't do the check, and assigns the start date to 0, which triggers some date offset calculations, which results in the wonky dates.

I've created a patch that fixes the problem by moving this logic out of the "coursecreator" portion of "restore_form.html". As a result, teachers will now see the "course startdate" field as well, and everything works as it should. The patch is attached to this bug report.


 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Yolanda Ordoñez Rufat - 31/Jan/08 11:05 PM
There's also a problem with the post dates in the restore if you have the "course creator" capability. So moving the logic out of the "coursecreator" portion of "restore_form.html" doesn't work, sorry Kenneth.
I tried a restore as an admin and I change the start date of the course during restore and I get wrong forum post dates (they are set in the future).

I test it on a 1.8.3 moodle with a 8.2.4 postgres installed in a SUSE Linux Enterprise Server 10 SP1.


David Kelly - 08/Apr/08 05:48 AM
This is still a bug in 1.9, at least as of build 20080307.

Kenneth Newquist - 08/Apr/08 10:16 PM
I haven't tried it with the course creator role in Moodle 1.8.x; we don't make use of that particular one. I'll try and spend some time debugging this later this week or early next. I haven't tried it in Moodle 1.9 yet.

matt greenwolfe - 01/May/08 09:49 AM
Here is a diff file of the changes that worked for me, at least so far, in 1.9.
Following the diff file for 1.8.3, I edited /backup/restore_form.html by moving several lines out of the if statement. The date line shows up for teachers and seems to work correctly so long as the specified date is greater than or equal to the original course start date.

Kenneth Newquist - 17/Jul/08 10:58 PM
I can confirm the problem still exists for teachers in Moodle 1.9.2. Matt's patch failed for me so I've generated a new one based on Moodle 1.9.2 (Build: 20080711).

I can not recreate the problem with the Course Creator role; when logged in as a course creator I was able to see the start data form (which is the way the original code was supposed to work, as that functionality was reserved for course creators, even though non-course creating teachers needed it as well).


Rahim Virani - 18/Jul/08 05:20 AM
I think the patch is broken ". Text File 192_restore_form_patch.txt (2 kb)"

We tried the ". Text File 192_restore_form_patch.txt (2 kb)" from a 1.9.2 intallation, the patch while it did take into account the current date, it did not honor the settings that we set for course start date, if we set the start-date to May 1st, the course startdate after the restore is still July 20th.

Kenneth Newquist - 21/Jul/08 08:45 PM
I'll re-check the patch later today.

Rahim Virani - 29/Aug/08 04:01 AM
EXCUSE THE CAPS, BUT I HOPE SOMEONE READS THIS THAT CAN PUT THE PATCH INTO THE DISTRIBUTION WE HAVE NOW A PROBLEM 171 ASSIGNMENTS IN OUR MOODLE INSTALL HAVE SILLY DUE DATES!!!

The patch has been verified and it works in 1.9.2, We had patched our 1.8.3 distribution but when we did the security upgrade to 1.8.6 we must have lost the patch, it wasnt included in the new distribution so if someone who has access to the main code repository might put this patch in (sorry I dont know how) then this might be avoided.

We have successfully used this patch in 1.8.3 and in 1.9.2 I really dont want to get bit by this again! - Thanks.

Rahim Virani - 25/Nov/08 07:46 AM
So, we checked, this _still_ hasnt made it into Moodle 1.9.3, I'm glad I did my due diligence with this one.

Martin, what can I do to resolve this?

Please advise.