mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
4dde1463ee
print_course() can now recognise a $course object that already has a $course->context obj and a $course->managers array, which means that there will be no DB access triggered by print_course(). (Backwards compat is retained so it still works the old way for callers that get a single course printed anyway (during enrolment for example.) And print_courses() now uses get_courses_wmanagers(), and passes the returned $course objects to print_course(). With this patch, a homepage listing 9 courses (with varying numbers of teachers) sheds 63 DB queries (88 to 25). A course listing page with 3 courses sheds 9 (33 to 24). On a single server overall time spent serving the homepage is reduced just a little bit (262ms to 238ms) -- on a clustered environment, less DB queries mean much lower latency and DB costs.