MDL-18543 restore of role assignments / overrides - skip non-restored contexts. Merged from 19_STABLE

This commit is contained in:
stronk7 2009-03-12 22:21:57 +00:00
parent 36fa17855f
commit 382d4d9fbe

View File

@ -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