mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-18543 restore of role assignments / overrides - skip non-restored contexts. Merged from 19_STABLE
This commit is contained in:
parent
36fa17855f
commit
382d4d9fbe
@ -9115,6 +9115,11 @@ WHERE
|
||||
$oldinstance = backup_getid($restore->backup_unique_code,$table,$oldid);
|
||||
}
|
||||
|
||||
// new instance id not found (not restored module/block/user)... skip any assignment
|
||||
if (!$oldinstance || empty($oldinstance->new_id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$newcontext = get_context_instance($contextlevel, $oldinstance->new_id);
|
||||
$assignment->contextid = $newcontext->id; // new context id
|
||||
// might already have same assignment
|
||||
@ -9145,6 +9150,11 @@ WHERE
|
||||
$oldinstance = backup_getid($restore->backup_unique_code,$table,$oldid);
|
||||
}
|
||||
|
||||
// new instance id not found (not restored module/block/user)... skip any override
|
||||
if (!$oldinstance || empty($oldinstance->new_id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$newcontext = get_context_instance($contextlevel, $oldinstance->new_id);
|
||||
$override->contextid = $newcontext->id; // new context id
|
||||
// use assign capability instead so we can add context to context_rel
|
||||
|
Loading…
x
Reference in New Issue
Block a user