Skip to content

Commit

Permalink
Fixed some warnings with role mappings.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyshane committed Dec 19, 2006
1 parent ce49928 commit fa1df4d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backup/restorelib.php
Expand Up @@ -6012,9 +6012,12 @@ function restore_create_roles($restore, $xmlfile) {
// the following code creates new roles
// but we could use more intelligent detection, and role mapping
// get role mapping info from $restore
$rolemappings = array();

$rolemappings = $restore->rolesmapping; // an array
if ($info->roles) {
if (!empty($restore->rolesmapping)) {
$rolemappings = $restore->rolesmapping;
}
if (isset($info->roles) && $info->roles) {
foreach ($info->roles as $oldroleid=>$roledata) {

/// first we check if the roles are in the mappings
Expand Down Expand Up @@ -6069,7 +6072,6 @@ function restore_create_roles($restore, $xmlfile) {
}
}
}

return true;
}

Expand Down Expand Up @@ -6102,12 +6104,10 @@ function restore_roles_settings($restore, $xmlfile) {

if (!empty($course->roleoverrides)) {
$courseoverrides = $course->roleoverrides;
$rolemappings = $restore->rolesmapping;
foreach ($courseoverrides as $oldroleid => $courseoverride) {

// if not importing into exiting course, or creating new role, we are ok
// local course overrides to be respected (i.e. restored course overrides ignored)
if ($restore->restoreto != 1 || empty($rolemappings[$oldroleid])) {
if ($restore->restoreto != 1 || empty($restore->rolesmapping[$oldroleid])) {
restore_write_roleoverrides($restore, $courseoverride->overrides, "course", CONTEXT_COURSE, $course->course_id, $oldroleid);
}
}
Expand Down

0 comments on commit fa1df4d

Please sign in to comment.