How to manually copy files from one course to another

How to manually copy files from one course to another

د Helena Garcia لخوا -
د ځوابونو شمیر: 3

I'm coding a local plugin in Moodle and I'm trying to copy resources from one course to another one manually (not doing a backup and restoring).

I've tried to manually get the resource, the course_module, the context and finally the file from DB, then copying rows and updating the fields that concern to the new course, and also chaning SHA1 from pathnamehash file's table field.

Any ideas or alternatives to do that?

Thanks!

د درجې بندۍ اوسط:  -
In reply to Helena Garcia

Re: How to manually copy files from one course to another

د Tim Hunt لخوا -
د Core developers انځور د Documentation writers انځور د Particularly helpful Moodlers انځور د Peer reviewers انځور د Plugin developers انځور
In reply to Tim Hunt

Re: How to manually copy files from one course to another

د Helena Garcia لخوا -

It was very useful, thank you موسکا