|
http://cvs.moodle.org/contrib/plugins/mod/assignment/type/uploadpdf/
At a guess I think it would work like this: If those files exist for $assignment->assignmenttype then include it and call some function in there like assignment_backup_one_mod_uploadpdf ($bf,$preferences,$assignment) and in there produce XML for the assignment_uploadpdf_comment and assignment_uploadpdf tables Those two tables are keyed to assignment id and assignment submissions id I don't think you can backup/restore the template tables so easily, but perhaps that's not a problem No problem if you put the subtype hook stuff in stable, it's probably just a few lines Yeah, sorry, for some reason I didn't see that, I generally only have the 1.9 contrib checkout up to date
Anyway I'll come up with a patch and get Eloy to review it for the core stuff, and figure something out with David for the template tables. I guess used-templates can be backed up in each backup, and restore can check if one exists already and skip it if it's the same. I had started to think about implementing the backup, but hadn't actually got as far as to write any code (family/holidays/lesson preparation all got in the way).
Very happy to help clarify how any of the bits of uploadpdf fit together and discuss anything to do with the backup format, although further discussions specific to uploadpdf (rather than general backup of assignment types), should go here: Changes required to the assignment module to support backup/restore in subtypes.
Small changes to the uploadpdf subtype to support being able to have custom extra backup, as well as method stubs.
Eloy, can you please review the assignment changes, since it affects backup? (Don't worry about the subtype specific patch)
David, can you please review the 4 new hooks and confirm it will cover everything?
I think those 4 hooks cover everything - but that is only from a short look at them.
dev chat with eloy:
13:32 < stronk7> so, penny, you've implemented it by allowing two hooks: one at module So I'll commit this later today or tomorrow. As commented in HQ chat:
So:
Tons of thanks, ciao i committed this and then almost immediately backed it out once i figured the course_module stuff wasn't going to work. backup_getid wants the id of the old coursemodule, not the id of the old module instance. i'll come up with another patch, we'll have to use the subtype classes statically I think, and pass $assignment to them.
new version, using the methods statically.
although i am following convention here in the assignment module & subtypes, i don't approve of using a constructor with 'staticonly' as an id argument. why aren't we using proper static calls?! surely php4 has static? anyway, eloy please re-review. Yay, fixed in stable & head
static keyword for methods not supported in php4 so i left it out but they're in HEAD. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I have to add backup/restore support to your uploadpdf subtype for a client. I'm going to patch the main assignment backuplib.php and restorelib.php to do this, I'll attach the patch when it's done.
I can't see your module in contrib - is there any chance we can get it in there? If so, I can just commit directly there, that would be great.
Cheers,
Penny