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

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

by Barron Koralesky -
Number of replies: 3

We are experiencing an issue with forum dates being almost 7 years early for courses restored by non-admin users. I just restored a course as a normal teacher and the forum posts originally were in Nov 2007, but the restores had them Feb 2001. However, if an admin-level-user restores it the dates are correct.

I don't know what is causing this, do any of you have ideas? We saw this last semester, but hoped it was just because we were restoring moodle v1.5.x classes into v1.8.x, but I guess that isn't it as we are restoring from v1.8.2+ to 1.8.3+.

Has anyone else seen this? Any ideas on what might be causing it?

Thank you!

Average of ratings: -
In reply to Barron Koralesky

Re: course restores for non-admin users appear ~7 years early

by Barron Koralesky -


This appears similar to this issue (#10125) in the bugtracker, but our systems people put that patch on and it didn't fix it. Any other thoughts?


In reply to Barron Koralesky

Re: course restores for non-admin users appear ~7 years early

by Kenneth Newquist -
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.

I created a Tracker report for this bug and posted the patch there:

http://tracker.moodle.org/browse/MDL-12922

More testing and support votes would be greatly appreciated. smile

Ken

In reply to Kenneth Newquist

Re: course restores for non-admin users appear ~7 years early

by Barron Koralesky -

Thanks Ken for finding this issue! My guess is that this will help many people.