MDL-41219 course: Make properties of course_modinfo read-only
[moodle.git] / rss / file.php
index 0ff00d5..6d7dbc0 100644 (file)
@@ -79,11 +79,7 @@ if ($token==="$inttoken") {
     if ($course = $DB->get_record('course', array('id' => $courseid))) {
         $modinfo = get_fast_modinfo($course);
 
-        if (!isset($modinfo->instances[$componentname])) {
-            $modinfo->instances[$componentname] = array();
-        }
-
-        foreach ($modinfo->instances[$componentname] as $modinstanceid=>$cm) {
+        foreach ($modinfo->get_instances_of($componentname) as $modinstanceid=>$cm) {
             if ($modinstanceid==$instanceid) {
                 $context = context_module::instance($cm->id, IGNORE_MISSING);
                 break;