mdl_context - Null path for course context

mdl_context - Null path for course context

by Dickie Layden -
Number of replies: 3
Hi all

We're working with an Identity Management provider who are helping us to automatically provision students and courses from our student management system.

We're hoping that their solution will create a whole batch of new courses for us (and then enrol students onto them).

Basically they are creating drivers that will insert values into the mdl_course table to create a new course.

They will then construct a mysql trigger that will insert a row into the mdl_context table (with values for contextlevel = 50 and the instanceid of the course just created).
This trigger will fire on an INSERT event into the mdl_course table.

We've tried a few tests and the resultant mdl_context entry for that course has a PATH field of NULL.

My question is - will this cause a problem for us at all somewhere down the line (if the trigger is called whenever a course is created then we'll have all subsequent courses with a path that contains NULL too)

Hope I'm explaining myself (very probably not)

Does anyone have any suggestions or comments that would help?

Many thanks

Dickie









Average of ratings: -
In reply to Dickie Layden

Re: mdl_context - Null path for course context

by Hubert Chathi -
1. Yes, this will definitely cause a problem if the path field is NULL.
2. You probably don't want to use a trigger. If you ever create a course from within Moodle, you will end up with two records in mdl_context, which will most likely confuse something in Moodle.
3. You should avoid manipulating the Moodle database directly.

You may want to look into using the external database enrolment plugin instead.
In reply to Hubert Chathi

Re: mdl_context - Null path for course context

by Dickie Layden -
Many thanks for your time Hubert.

Thats pretty much what I thought too - thanks for confirming!

Dickie
In reply to Hubert Chathi

Re: mdl_context - Null path for course context

by sarendar vennapureddy -
Hi Hubert.

    Could you explain me in detail. I am facing same error moodle version 3.0.3 after upgrade.
When am create a  course in moodle. The mdl_context table PATH field create with NULL and depth is 0.
I am not understand why this happen.