Skip to content

Commit

Permalink
MDL-67494 calendar: step to set userid 0 to all shared events
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Mar 3, 2021
1 parent dc9701a commit 05540f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2462,5 +2462,17 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2021021600.00);
}

if ($oldversion < 2021022600.01) {
// This upgrade step will update all shared events setting userid to 0.
// Site, category, course, group and action events (except user overrides) dont belong to the user who creates them.
$DB->execute("UPDATE {event} SET userid = 0 WHERE eventtype <> 'user' OR priority <> 0");

// Only user type of subscription should record user id.
$DB->execute("UPDATE {event_subscriptions} SET userid = 0 WHERE eventtype <> 'user'");

// Main savepoint reached.
upgrade_main_savepoint(true, 2021022600.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 = 2021022600.00; // 20201109 = branching date YYYYMMDD - do not modify!
$version = 2021022600.01; // 20201109 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '3.11dev (Build: 20210226)';// Human-friendly version name
Expand Down

0 comments on commit 05540f0

Please sign in to comment.