The function calendar_get_default_courses is responsible for loading all variants of calendar
course lists.
1 the list of courses that the current user will see events for in the site calendar.
2 the list of courses the current user will see when they are looking at a specific course calendar.
3 the list of course calendars the current user can create / edit events in.
Consolidate the logic for the list of courses an admin will see in the calendar.
They will see all courses if calendar_admincanseeall is enabled.
They will see only courses they are enrolled in of calendar_admincanseeall is not enabled.
They will also see the current course, if they are admin and it is not already in the list.
This applies to the course selector and the create and update event forms.
The calendar link in the navigation block has also been changed to link to the current course calendar instead of the global
one.
This method was used when the API was tied to students at risk model,
this method does not make sense any more as it is up to each target
to define what is a valid course.
Triggering a fatal error in an adhoc task is bad. It will be retried indefinitely.
Even though we are not sure how to get a module instance without a course module record,
it is possible and should not kill the Moodle site.
Mathjax currently has a bug in an upstream library that is incorrectly
loading 'process' because it things it's running under Node.js.
We don't load modules by shortname - so it should be fine to map process to
something else.
Because of the syntax they used we need to map it to something that is already loaded
and evaluates to null (Their code will then assume the module could not be loaded and continue).
We have a handy module that is guaranteed to be loaded first and evaluates to null -> core/first.
We should remove this workaround when MathJax releases a fixed version on their CDN and update the docs.
Before this implementation, both resourcekey and password
were not being included in the backups, so old backups are
missing them. To keep upwards compatibility and avoid a PHP
Notice (undefined property), existence is checked via isset(),
that is the usual way all over the restore process.