From 8f2c99d6102714ab760c336d6ef7651a4c914fdf Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Tue, 1 Dec 2015 13:12:34 +0000 Subject: [PATCH] MDL-52370 role: purge coursecontacts when role is edited This is perhaps a bit more brutal purge than you'd like, but it only affects coursecat role edits. --- admin/roles/classes/define_role_table_advanced.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/admin/roles/classes/define_role_table_advanced.php b/admin/roles/classes/define_role_table_advanced.php index 06f565d59a5..d18c144402d 100644 --- a/admin/roles/classes/define_role_table_advanced.php +++ b/admin/roles/classes/define_role_table_advanced.php @@ -422,6 +422,12 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi } else { // Updating role. $DB->update_record('role', $this->role); + + // This will ensure the course contacts cache is purged so name changes get updated in + // the UI. It would be better to do this only when we know that fields affected are + // updated. But thats getting into the weeds of the coursecat cache and role edits + // should not be that frequent, so here is the ugly brutal approach. + coursecat::role_assignment_changed($this->role->id, context_system::instance()); } // Assignable contexts. -- 2.43.0