mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
"MDL-14460, fix get_context_instance, merged from MOODLE_19_STABLE"
This commit is contained in:
parent
2cb5f03a66
commit
12d0687748
8 changed files with 23 additions and 23 deletions
|
@ -2199,7 +2199,7 @@ function main_upgrade($oldversion=0) {
|
|||
if (!empty($CFG->rolesactive) and $oldversion < 2006091212) { // Reload the guest roles completely with new defaults
|
||||
if ($guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) {
|
||||
delete_records('capabilities');
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
foreach ($guestroles as $guestrole) {
|
||||
delete_records('role_capabilities', 'roleid', $guestrole->id);
|
||||
assign_capability('moodle/legacy:guest', CAP_ALLOW, $guestrole->id, $sitecontext->id);
|
||||
|
|
|
@ -1798,7 +1798,7 @@ function main_upgrade($oldversion=0) {
|
|||
if (!empty($CFG->rolesactive) and $oldversion < 2006091212) { // Reload the guest roles completely with new defaults
|
||||
if ($guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) {
|
||||
delete_records('capabilities');
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
foreach ($guestroles as $guestrole) {
|
||||
delete_records('role_capabilities', 'roleid', $guestrole->id);
|
||||
assign_capability('moodle/legacy:guest', CAP_ALLOW, $guestrole->id, $sitecontext->id);
|
||||
|
|
|
@ -881,7 +881,7 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||
|
||||
if( $defaultroleid != $userrole->id ) {
|
||||
// Add in the new moodle/my:manageblocks capibility to the default user role
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
assign_capability('moodle/my:manageblocks',CAP_ALLOW,$defaultroleid,$context->id);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue