The new recordset support for Postgres requires transactions and
will cause errors if recordsets are not closed correctly. This
commit fixes problems that were identified during unit tests, and
via some basic code analysis, across all core code. Most of these
are incorrect usage of recordset (forgetting to close them).
The function groups_get_user_groups is called too often both before rendering the page and after the page is rendered (using ajax).
The function was executing a query joining 3 tables in each call. The plementation of the function has now modified to store the
query result in a request cache.
* Fix coalesce on postgres.
* The edit icon's alt shows the HTML entities causing
* enrol/tests/behat/add_to_group.feature Contains a '@doit' tag which I assume is there from testing.
* group/classes/output/user_groups_editable.php
** Missing MOODLE_INTERNAL check.
** Unused variables context_system and moodle_exception.
** The PHPDocs for the constructors are wrong.
** export_for_template() returns an array, not stdClass (according to parent docs).
** Change moodle_exception to coding_exception at the beginning.
* group/lib.php
** Missing docs for core_group_inplace_editable().
* user/classes/participants_table.php
** The docs for the class variables $groups, $course and $context need a '\' beforehand as they are in a namespace.
** I would prefer $this->context = $context; and $this->groups = ... to be done at the end of the constructor with the other class variable assignments.
** You could get rid of the class variable courseid if we are setting course and use $this->course->id instead.
** The function col_groups has @param \stdclass $row but it should be $data
* lib/amd/src/form-autocomplete.js and lib/amd/src/inplace_editable.js
** Some issues here CiBot has pointed out.
* lib/classes/output/inplace_editable.php
** @see should be on a new line.
1) Tidied up conditional check and put additional variable on new line.
2) Prevented change of the default behaviour for 'groups_get_potential_members()'.
3) Added another behat test.
MDL-45991 groups: Auto-create groups with ungrouped users only
When using auto-create groups, sometimes it is needed to only create
groups with users that are not already inside a course group. This
patch creates a checkbox that will ignore users that are in already
existing groups. It alters the groups_get_potential_members function so
that the eligible users are retrieved entirely though sql.
This combines the following changes:
* Event for group member added
* Event for group member removed
* Event for group created
* Event for grouping created
* Event for group updated
* Event for grouping updated
* Event for group deleted
* Event for grouping deleted
* Adding tests for deleting functions
* Bulk remove of members uses low-level API
The reason for this is that a bulk event has no value from a logging
perspective as it is not granular. So now, the API is a bit slower,
but the information the events contain makes sense, beside this is
not (and should not be) used very often.
The reason why the events_trigger_legacy() is kept is because we
cannot create a new event for this, as we don't encourage developers
to created bulk events, for the reasons mentioned above.
I removed the call that gets the user record from the function
groups_remove_member() as it was not required and only appeared
to check if the user existed. It appears to be safe not to do
this check as nothing would fail down the line.
* Bulk unassign of groupings uses low-level API
As the previous commit, we keep the legacy event for now as it would
be wrong to create a new event to replace it.
Also, the code has been changed to call the low-level API to unassign
groups from groupins, even though at the moment there are no
events for that function.
* Bulk deletion of groups uses low-level API
Again, we keep the legacy event because replacing it would force
us to create a new event that does not make sense. See MDL-41312.
* Bulk deleting of groupings uses low-level API
* Asserting legacy event name in unit tests
* Minor SQL query and code improvements
GD PHP extension is now required. Add-ons need to remove $CFG->gdversion tests. The worst case regression is that add-on will think GD is not available.
This patch includes following changes and new features:
* Group sync in enrol_cohort plugin.
* Option for editing of role in existing cohort sync instance.
* Group memberships are now restored after enrolments.
* New enrol method for restore of protected group membership.
* New component callback 'restore_group_member' for restore of general plugin group membership.
* New component callback 'restore_role_assignment' for restore of general plugin role assignments.
* Implemented group membership protection in enrolment UI.
* Other minor fixes and cleanup.
Notes:
* The YUI base enrolment page is not reimplemented yet - see MDL-35618.
This commit coverts everything in the codebase to use the new
users_order_by_sql function when sorting lists of users. More details in
the bug.
Note that this does not change places where users are displayed in a
sortable table, and the sort order comes from the table.
New keep roles/enrolments and groups/groupings options, notification CSS fixed, standardised notification texts, added missing delete of module blocks, fixed file deleting and some other minor issues.