Moodle 2.2 restore with files

Moodle 2.2 restore with files

par Juergen Zimmer,
Nombre de réponses : 1

Dear all,

I've written a module that makes heavy use of files. In my DB tables I store the IDs of files in the files table for easy access. Now I'm working on backup & restore code. I'm adding the file areas to my backup structure. When I restore I call add_related_files in the after_execute method, as other modules do. However, I wonder how I can update the file IDs in DB entries? Is there a mapping available somewhere? For that I would have to add the related files earlier I suppose.

Sorry wrong forum. Now I saw there is a Backup&Restore forum.

Any ideas?

Thanks and cheers

  Juergen

Moyenne des évaluations  -
En réponse à Juergen Zimmer

Re: Moodle 2.2 restore with files

par Davo Smith,
Avatar Core developers Avatar Particularly helpful Moodlers Avatar Peer reviewers Avatar Plugin developers

The files are all restored at the end of the process, after the rest of the restoration is complete.

I would suggest that you should consider changing the way your module works, as there should be no reason to store the file ids for the files (indeed, whilst the file ids may be constant at the moment, there is no guarentee that they remain so in future developments). Normally, you would store your files in a unique area for your module and use the itemid of the file record to identify which record in your table it is associated with.

Davo