-
Bug
-
Resolution: Fixed
-
Major
-
2.9.2, 3.1.1, 3.2
-
MOODLE_29_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE
-
MOODLE_31_STABLE, MOODLE_32_STABLE
-
wip-
MDL-51833-master -
-
3.3 sprint 4
We were testing out Event Monitor on a test copy of our site, and noticed it does pretty horrific things.
So in 2.9, hooks were added for admin tools to add user profile settings. This was used to add a Event Monitor preference page to the user profile. Unfortunately, this was done in a very, very painful way. In admin/tool/monitor/lib.php::tool_monitor_get_user_courses():
- Get an array of every course the user has 'tool/monitor:subscribe' in, using get_user_capability_course()
- This method gets every course context, instantiates it, then checks its capability, and if it has it, stores it in an array
- Then, when we have the list of courses, for each one creates a list of custom formatted strings (to build an options list)
Now that may be the best way to build the dropdown list given the current access library. The real problem is that tool_monitor_extend_navigation_user_settings() builds the dropdown list to check and see if there are any courses the user could possibly have access to. It then discards it and adds a single link to the profile page.
For an admin user on our site, that means that every page takes about 45 seconds to load. It adds a few seconds to most users (who have access to none or a few courses)