Thanks for reply!!
Actually what you told is something new for me i.e remove external plugins before up-gradation.
But if we closely look the last line of cron, it is related to quiz and we dont have any external plugin for quiz based activities. But we utilized quiz activities in lot of courses.
Is there any possibility that it is happening in corruption of quiz related data in database ?? And if yes how we can rectify it or any further information which i can provide so that it can help you to assist in resolving this issue.
Thanks!
this is the code. So the context is null for some reason.
has_capability('mod/quiz:ignoretimelimits', $this->context, null, false));
Maybee you can had in the code some traces to know the course that cause problem and the quiz.
Like
mtrace ('Tintin - courseid : ' . $course->id );
mtrace ('Tintin - quizid : ' . $quiz->id,);
Tintin is just to find it quickly in log...
I think that the good place to put it is in the function create() of the file
\mod\quiz\attemptlib.php
between these two lines :
$course = $DB->get_record('course', array('id' => $quiz->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('quiz', $quiz->id, $course->id, false, MUST_EXIST);
I hope it's not just.... stupid.
Sometime record is missing for some reasons...
Dominique.
Thanks
The problem you have is that $this->context in mod/quiz/attemptlib.php is null as Dominique has mentioned. The context for the class is set in the __construct() function based on the course module but may not be set if not required. It may be worth adding some trace code in that function as well as the create() function. The issue suggests to me a Quiz or Quiz attempt record that does not relate back to a course module. I would check my quiz database records 1st.
At the risk of telling you something you know already, if you are going to add debugging to core files, I suggest you backup the file first so you can restore it once you have determined what the issue is.
Actually we have run some cli admin commands like,
Fix orphaned question categories
--------------------------------------
admin/cli/fix_orphaned_question_categories.php --fix
Fix course/module sequences
-----------------------------------
php admin/cli/fix_course_sequence.php -c=* --fix
After this we are running cron.
Does the above command like can create a problem which justify your statement "The issue suggests to me a Quiz or Quiz attempt record that does not relate back to a course module."