Skip to content

Commit

Permalink
Fixes undefined variable $cm
Browse files Browse the repository at this point in the history
Fixes test: core_calendar\container_test::test_delete_module_delete_events
  • Loading branch information
ScottVerbeek committed Jul 25, 2023
1 parent 68adb39 commit a410bcb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,13 @@ function oublog_delete_instance($oublogid) {
// instances
$DB->delete_records('oublog_instances', array('oublogid'=>$oublog->id));

if (!$cm = get_coursemodule_from_instance('oublog', $oublog->id)) {
throw new moodle_exception('invalidcoursemodule');
}

// Fulltext search data
require_once(dirname(__FILE__).'/locallib.php');
if (oublog_search_installed()) {
$moduleid=$DB->get_field('modules', 'id', array('name'=>'oublog'));
$cm=$DB->get_record('course_modules', array('module'=>$moduleid, 'instance'=>$oublog->id));
if (!$cm) {
throw new moodle_exception('invalidcoursemodule');
}
local_ousearch_document::delete_module_instance_data($cm);
}

Expand Down

0 comments on commit a410bcb

Please sign in to comment.