Issue Details (XML | Word | Printable)

Key: MDL-12922
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Eloy Lafuente (stronk7)
Reporter: Kenneth Newquist
Votes: 19
Watchers: 10
Operations

Add/Edit UI Mockup to this issue
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: 06/Oct/09 10:09 AM
Return to search
Component/s: Backup
Affects Version/s: 1.8.3, 1.9.3
Fix Version/s: 1.8.8, 1.9.4

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)
Issue Links:
Relates
 

Database: MySQL
Participants: Barron Koralesky, David Kelly, Eloy Lafuente (stronk7), Kenneth Newquist, Martin Dougiamas, Marty Gilbert, Mary Parke, matt greenwolfe, Rahim Virani, Tim Hunt and Yolanda Ordoñez Rufat
Security Level: None
QA Assignee: Tim Hunt
Resolved date: 03/Jan/09
Affected Branches: MOODLE_18_STABLE, MOODLE_19_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE


 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
Eloy Lafuente (stronk7) committed 2 files to 'Moodle CVS' - 03/Jan/09 02:59 AM
MDL-12922 restore roll dates - prevent wrong rolls to 0 happening to teachers. Merged from 19_STABLE
MODIFY backup/restore_form.html   Rev. 1.83    (+6 -1 lines)
MODIFY backup/restore_check.html   Rev. 1.63    (+3 -3 lines)
Eloy Lafuente (stronk7) committed 2 files to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 03/Jan/09 03:00 AM
MDL-12922 restore roll dates - prevent wrong rolls to 0 happening to teachers. Backported from HEAD
MODIFY backup/restore_form.html   Rev. 1.43.2.9    (+7 -2 lines)
MODIFY backup/restore_check.html   Rev. 1.37.2.8    (+3 -3 lines)
Eloy Lafuente (stronk7) committed 3 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 06/Oct/09 09:13 AM
MDL-12922 adding 'moodle/restore:rolldates' cap to control who can roll dates on restore
(defaults to current settings: only course creators (and admins) are able to roll)
MODIFY version.php   Rev. 1.563.2.664    (+1 -1 lines)
MODIFY lib/db/access.php   Rev. 1.75.2.20    (+11 -1 lines)
MODIFY lang/en_utf8/role.php   Rev. 1.47.2.20    (+2 -1 lines)
Eloy Lafuente (stronk7) committed 3 files to 'Moodle CVS' - 06/Oct/09 09:14 AM
MDL-12922 adding 'moodle/restore:rolldates' cap to control who can roll dates on restore
(defaults to current settings: only course creators (and admins) are able to roll) Merged from 19_STABLE
MODIFY lib/db/access.php   Rev. 1.108    (+11 -1 lines)
MODIFY version.php   Rev. 1.1275    (+1 -1 lines)
MODIFY lang/en_utf8/role.php   Rev. 1.95    (+2 -1 lines)
Eloy Lafuente (stronk7) committed 3 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 06/Oct/09 09:22 AM
MDL-12922 'moodle/restore:rolldates' capability - Implement logic on restore
MODIFY backup/restore_check.html   Rev. 1.48.2.19    (+22 -2 lines)
MODIFY backup/restorelib.php   Rev. 1.283.2.79    (+24 -1 lines)
MODIFY backup/restore_form.html   Rev. 1.60.2.20    (+11 -2 lines)
Eloy Lafuente (stronk7) committed 3 files to 'Moodle CVS' - 06/Oct/09 09:27 AM
MDL-12922 'moodle/restore:rolldates' capability - Implement logic on restore. Merged from 19_STABLE
MODIFY backup/restore_form.html   Rev. 1.96    (+11 -2 lines)
MODIFY backup/restore_check.html   Rev. 1.78    (+22 -2 lines)
MODIFY backup/restorelib.php   Rev. 1.396    (+23 -1 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 06/Oct/09 09:44 AM
MDL-12922 'moodle/restore:rolldates' capability - added missing string
MODIFY lang/en_utf8/moodle.php   Rev. 1.141.2.67    (+2 -1 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' - 06/Oct/09 09:58 AM
MDL-12922 'moodle/restore:rolldates' capability - added missing string. Merged from 19_STABLE
MODIFY lang/en_utf8/moodle.php   Rev. 1.260    (+2 -1 lines)
martignoni committed 1 file to 'Lang CVS' - 23/Oct/09 05:35 AM
MDL-12922 String translated
MODIFY fr_utf8/role.php   Rev. 1.122    (+2 -1 lines)
martignoni committed 1 file to 'Lang CVS' - 23/Oct/09 05:38 AM
MDL-12922 New string added
MODIFY fr_utf8/moodle.php   Rev. 1.324    (+2 -1 lines)
martignoni committed 1 file to 'Lang CVS' - 23/Oct/09 05:40 AM
MDL-12922 Rewording
MODIFY fr_utf8/moodle.php   Rev. 1.325    (+2 -2 lines)