-
Improvement
-
Resolution: Fixed
-
Minor
-
2.6.2, 2.7
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
MOODLE_27_STABLE
-
wip-
MDL-44720-master -
This used to be a part of MDL-44615 but I want to move it into separate issue because it is a very useful function and it looks like MDL-44615 is going to be delayed.
I add a function cm_info::get_course_module_record() that allows to get an object from cm_info that is exactly the same as record in course_modules.
Also it can be used instead of get_coursemodule_from_id() which is a very expensive function:
$cm = get_coursemodule_from_id(null, $cmid, $courseid, true, MUST_EXIST);
|
may be substituted with:
$cm = get_fast_modinfo($courseid)->get_cm($cmid)->get_course_module_record(true);
|
Assuming we are talking about current course, everything is already cached and the second option performs no DB queries.
unittest included
- blocks
-
MDL-44615 require_login simplified and improved
-
- Closed
-