Issue Details (XML | Word | Printable)

Key: MDL-13847
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Eloy Lafuente (stronk7)
Reporter: Petr Skoda
Votes: 4
Watchers: 11
Operations

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

backup/restore issues meta

Created: 09/Mar/08 12:06 AM   Updated: Friday 10:52 AM
Component/s: Backup
Affects Version/s: 1.9
Fix Version/s: 1.9.7

File Attachments: 1. Text File grestore17.patch (184 kB)

Issue Links:
Duplicate
 
Relates
 

Participants: Eloy Lafuente (stronk7) and Petr Skoda
Security Level: None
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE

Sub-Tasks  All   Open   
 Sub-Task Progress: 

 Description  « Hide
list of issues in backup/restore, both long standing and gradebook related

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Petr Skoda made changes - 09/Mar/08 09:18 PM
Field Original Value New Value
Link This issue is duplicated by MDL-13617 [ MDL-13617 ]
Petr Skoda made changes - 09/Mar/08 09:45 PM
Link This issue will help resolve MDL-12001 [ MDL-12001 ]
Petr Skoda added a comment - 11/Mar/08 07:50 AM
sending preview of patch for gradebook restore//backup issues,
other stuff will be in second wave

please test/review


Petr Skoda made changes - 11/Mar/08 07:50 AM
Attachment grestore17.patch [ 13325 ]
Eloy Lafuente (stronk7) added a comment - 13/Mar/08 12:10 PM - edited
Hi Petr,

just some quick comments (it has been impossible for me to examine the patch deeply).

1) Grades should be restored a bit below, as talked, after all the modules and instances have been properly set, i.e. after the restore_check_instances() block of code.

2) There are some "grrr..." debugs here and there.

3) The double loops, get_records_select() + foreach should be easily transformed into get_recordset_XXX() loops, saving a bunch of memory, specially for user information records.

4) It seems you are using the gradebook API to build grades and so on (instead or raw DB access). Perfect!

5) Also you've differentiated old gradebooks and new gradebooks from the parser. Good idea!

6) I've seen you've hacked the backup_getid() function to avoid current notices about the "needed" thing. Hehe, I've it in my TODO list. And really think that hack shouldn't be there. It's relate with how that info is added to the backup_ids table (unserialised) and I wan't to fix it on insertion. I think it has one TODO defined somewhere in the file and I'll try to insert it properly serialised.

7) Good idea the conditional addslashes, in backup_todb()

8) Finally, one comment about big parts in the backup and restore. Both must include some output to the browser from time to time (to avoid browser timeouts). I guess all the critical parts of the gradebook will have such pieces of code added (haven't really checked that). For now I'd use the current strategy consisting in something like:

$counter++;

//Do some output
if ($counter % XXXXXX == 0) {
if (!defined('RESTORE_SILENTLY')) {
echo ".";
if ($counter % 20*XXXXX == 0) { echo "<br />"; }
}
backup_flush(300);
}

it's only a matter of adjust XXXXX above to a number granting one dot to be sent to output each, say, 1-2 secs (aprox).

Edited: I missed. Of course those "output blocks" should be out for 2.0 with a central function replacing them, but I'd keep current behaviour for stable.

And that's all I've been able to review, hope it helps. Ciao


Petr Skoda added a comment - 17/Mar/08 06:09 PM
1/ grades were already restored after restore_check_instances() in that patch
2/ grrr is gone
3/ in next patch
6/ the "needed" flag is bloody hack - seems Yu invented most of these in role and user restore; goingto look at this together with roles restore later
8/ only individual grades restore does this - there is always limited number of grade_items and categories ( < 100) - it executes fast enough; anyway I think there should be a function for this in backup/lib.php next patch

going to test this a bit more today and commit, then continue with the rest of backup/restore issues

thanks!


Petr Skoda committed 6 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 18/Mar/08 04:36 AM
MDL-13847 gradebook backup/restore fixes, xhtml strict fixes, other minor fixes
MODIFY backup/restore_check.html   Rev. 1.48.2.1    (+12 -12 lines)
MODIFY backup/backup_form.html   Rev. 1.35.2.4    (+24 -20 lines)
MODIFY backup/restorelib.php   Rev. 1.283.2.28    (+1084 -868 lines)
MODIFY backup/lib.php   Rev. 1.89.2.5    (+16 -8 lines)
MODIFY backup/backuplib.php   Rev. 1.179.2.21    (+73 -97 lines)
MODIFY backup/restore_form.html   Rev. 1.60.2.4    (+74 -51 lines)
Petr Skoda committed 6 files to 'Moodle CVS' - 18/Mar/08 04:56 AM
MDL-13847 gradebook backup/restore fixes, xhtml strict fixes, other minor fixes; merged from MOODLE_19_STABLE
MODIFY backup/backup_form.html   Rev. 1.39    (+24 -20 lines)
MODIFY backup/restore_form.html   Rev. 1.65    (+74 -51 lines)
MODIFY backup/lib.php   Rev. 1.96    (+16 -8 lines)
MODIFY backup/restorelib.php   Rev. 1.313    (+1078 -865 lines)
MODIFY backup/restore_check.html   Rev. 1.50    (+13 -13 lines)
MODIFY backup/backuplib.php   Rev. 1.201    (+77 -99 lines)
Eloy Lafuente (stronk7) added a comment - 19/Mar/08 03:11 AM
Hi Petr, about 6) yup, it wasn't invented for roles but it's a dependency from old (before roles) versions. In fact, somewhere in my TODO list are:
  • TODO: Change this call inserting to a standard backup_putid() call
  • TODO: Also analyse it the "needed" info is really needed for anything. Drop if not.

That I detected when cleaning up a bit users backup http://tracker.moodle.org/browse/MDL-10721

AFAIK, roles assignments and overrides are properly working, I remember I did some tests when fixing that bug and everything worked (with the TODO notes above).

Just FYI, ciao


Petr Skoda added a comment - 19/Mar/08 04:19 AM
thanks Eloy

Martin Dougiamas made changes - 15/May/08 03:02 PM
Fix Version/s 1.9.2 [ 10280 ]
Fix Version/s 1.9.1 [ 10240 ]
Petr Skoda made changes - 05/Jul/08 11:51 PM
Fix Version/s 1.9.2 [ 10280 ]
Fix Version/s 1.9.3 [ 10290 ]
Petr Skoda made changes - 07/Oct/08 06:37 AM
Fix Version/s 1.9.3 [ 10290 ]
Fix Version/s 1.9.4 [ 10300 ]
Petr Skoda made changes - 22/Jan/09 02:19 AM
Fix Version/s 1.9.4 [ 10300 ]
Assignee Petr ?koda [ skodak ] moodle.com [ moodle.com ]
Fix Version/s 1.9.5 [ 10320 ]
Petr Skoda made changes - 22/Jan/09 02:21 AM
Link This issue has been marked as being related by MDL-17917 [ MDL-17917 ]
Petr Skoda made changes - 06/May/09 05:49 PM
Fix Version/s 1.9.6 [ 10340 ]
Fix Version/s 1.9.5 [ 10320 ]
Martin Dougiamas made changes - 21/Oct/09 04:17 PM
Fix Version/s 1.9.7 [ 10360 ]
Fix Version/s 1.9.6 [ 10340 ]
Martin Dougiamas made changes - 20/Nov/09 10:52 AM
Assignee moodle.com [ moodle.com ] Eloy Lafuente (stronk7) [ stronk7 ]