Skip to content

Commit

Permalink
MDL-67458 core: removing stale cohortroles and role assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
snake committed Dec 11, 2019
1 parent 94eabe3 commit ae0263d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3787,5 +3787,16 @@ function xmldb_main_upgrade($oldversion) {
// Automatically generated Moodle v3.8.0 release upgrade line.
// Put any upgrade step following this.

if ($oldversion < 2019120500.01) {
// Delete any tool_cohortroles mappings for roles which no longer exist.
$DB->delete_records_select('tool_cohortroles', "roleid NOT IN (SELECT id FROM {role})");

// Delete any role assignments for roles which no longer exist.
$DB->delete_records_select('role_assignments', "roleid NOT IN (SELECT id FROM {role})");

// Main savepoint reached.
upgrade_main_savepoint(true, 2019120500.01);
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2019120500.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2019120500.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '3.9dev (Build: 20191205)'; // Human-friendly version name
Expand Down

0 comments on commit ae0263d

Please sign in to comment.