moodleou/moodle-mod_oublog

Validation for Course Module id in OU Blog Maintenance Cron Task

Opened this issue · 0 comments

Hi

Moodle Version: 4.1

Description:
We encountered an error during the execution of the OU Blog maintenance cron task. The task fails due to an 'Invalid course module ID,' and it appears that no validation is added to check if the course module id is valid before the task runs.

Error Details:

     Execute scheduled task: OU blog maintenance jobs (mod_oublog\task\cron_task)
 ... started 11:06:38. Current memory use 3.0 MB.
 Debugging increased temporarily due to faildelay of 86400
 ... used 5 dbqueries
 ... used 0.11644983291626 seconds
 Scheduled task failed: OU blog maintenance jobs (mod_oublog\task\cron_task),Invalid course module ID
 Debug info:
 SELECT id,course FROM {course_modules} WHERE id IS NULL
 [array (
 )]
 11:06:39 Backtrace:
 * line 1630 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
 * line 7442 of /lib/accesslib.php: call to moodle_database->get_record()
 * line 54 of /mod/oublog/classes/task/cron_task.php: call to context_module::instance()
 * line 309 of /lib/cronlib.php: call to mod_oublog\task\cron_task->execute()
 * line 167 of /admin/cli/scheduled_task.php: call to cron_run_inner_scheduled_task() 

Also we noticed another area that needed the coursemodule validation in lib.php

https://github.com/moodleou/moodle-mod_oublog/blob/master/lib.php#L176