You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
We have a large Moodle with over 70000 users using PostgreSQL database. Creating a new course using Collapsed topics format throws a "Error reading database" message.
It seems that course_get_students() function in classes/activity.php is using get_enrolled_users() function in Moodle core. It is trying to get all enrolled users from the current course. But when we are creating a new course the course ID is 1, so it fetches ALL users (from Moodle front page "course").
Debug info is very long and it shows the full database query (I removed the user id's on IN clause):
number of parameters must be between 0 and 65535.
SELECT ra.*, r.name, r.shortname, ra.userid
FROM mdl_role_assignments ra, mdl_role r, mdl_context c
WHERE ra.userid IN (...)
AND ra.roleid = r.id
AND ra.contextid = c.id
AND ra.contextid = XXXX
ORDER BY c.contextlevel DESC, r.sortorder ASC
Stack trace:
line 494 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
line 341 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end()
line 1027 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
line 2970 of /lib/accesslib.php: call to pgsql_native_moodle_database->get_records_sql()
line 692 of /course/format/topcoll/classes/activity.php: call to get_users_roles()
line 740 of /course/format/topcoll/classes/activity.php: call to format_topcoll\activity::course_get_students()
line 866 of /course/format/topcoll/lib.php: call to format_topcoll\activity::maxstudentsnotexceeded()
line 947 of /course/format/classes/base.php: call to format_topcoll->course_format_options()
line 1149 of /course/format/topcoll/lib.php: call to core_courseformat\base->create_edit_form_elements()
line 443 of /course/edit_form.php: call to format_topcoll->create_edit_form_elements()
line 1024 of /lib/formslib.php: call to course_edit_form->definition_after_data()
line 250 of /course/edit.php: call to moodleform->display()
To Reproduce
Steps to reproduce the behaviour:
0. You need a Moodle instance with over 65535 users...
Go to course default setting (Site administration > Courses > Course default settings) and select "Collapsed topics" as default course format.
Go to a course category.
Click on 'Add a new course'.
See error.
Expected behaviour
The new course settings form is displayed.
Versions:
Moodle: 4.1.6
Format: 401.1.1
Browser and version: All
The text was updated successfully, but these errors were encountered:
@anieminen I can understand how this can happen and envision a fix. However, I've always hated this code, so my inclination is to remove the additional functionality that the 'showadditionalmoddata' provides.
Describe the bug
We have a large Moodle with over 70000 users using PostgreSQL database. Creating a new course using Collapsed topics format throws a "Error reading database" message.
It seems that
course_get_students()
function in classes/activity.php is usingget_enrolled_users()
function in Moodle core. It is trying to get all enrolled users from the current course. But when we are creating a new course the course ID is 1, so it fetches ALL users (from Moodle front page "course").Debug info is very long and it shows the full database query (I removed the user id's on IN clause):
To Reproduce
Steps to reproduce the behaviour:
0. You need a Moodle instance with over 65535 users...
Expected behaviour
The new course settings form is displayed.
Versions:
The text was updated successfully, but these errors were encountered: