I am using moodle for one of our apps.
I am developing an authentication plugin that relies on specific cohorts and courses existing.
My goal is to:
- Create cohorts (working)
- Create courses that have a self-enrolment record, limited to folks in one of the cohorts made above,
- authenticate against another system (working),
- slot users into cohorts based on information in that system (not done, but I have no concerns about it).
# 1 is where the problem lies.
I am using create_course, from /course/lib.php. This fails, since it tries to rebuild the course cache, which cannot be done during install/upgrade.
What is the proper way to handle this?
is there a different method I should use?
direct $DB calls?
importing a CSV programmatically?
Just add the courses in a separate step? (technically, the plugin only needs to care about the cohorts.)
Thanks.