Which tables to update if we are adding a PDF file in a moodle course externally through a JDBC program
1. Do I need to update any other table in moodle? Because the file is not appearing in the specific course.
2. I need to know more about source attribute of mdl_files table.
Re: Which tables to update if we are adding a PDF file in a moodle course externally through a JDBC program
This sounds like a terrible idea - you would be far better to write a script in PHP that calls the appropriate files API to add the files, etc. (For example, your external code could put a file in a temporary location on the server, then call a new command-line PHP script that copies it from the given path, into Moodle itself).
To get new resources to appear within a Moodle course, you need to call the 'rebuild_course_cache' function (there is no way to do this via external access to the database, as the cache is not, usually, stored in the database), assuming you have already set up the entry in mdl_course_modules and the entry in mdl_course_sections to go with it.
The function 'add_moduleinfo' (in course/modlib.php) does everything you need (assuming you have an up-to-date version of Moodle).
Re: Which tables to update if we are adding a PDF file in a moodle course externally through a JDBC program
Thanks a lot! It was helpful.
I updated the following tables: mdl_files, mdl_resource, mdl_context, mdl_course_modules, mdl_course_sections
Then, I was able to rebuild the course caches by adding an extra plugin: https://moodle.org/plugins/pluginversion.php?id=2400