mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
filters: MDL-7336 refactor in backup/restore ready for local filter settings.
This commit is contained in:
parent
6b037e0420
commit
7b8dcbc352
@ -715,12 +715,11 @@
|
||||
fwrite ($bf,full_tag("ENROLENDDATE",3,false,$course->enrolenddate));
|
||||
fwrite ($bf,full_tag("ENROLPERIOD",3,false,$course->enrolperiod));
|
||||
fwrite ($bf,full_tag("ENABLECOMPLETION",3,false,$course->enablecompletion));
|
||||
|
||||
/// write local course overrides here?
|
||||
write_role_overrides_xml($bf, $context, 3);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $preferences, $context, 3);
|
||||
//Print header end
|
||||
|
||||
// Write role assigns, overrides, etc.
|
||||
write_per_context_data($bf, $preferences, $context, 3);
|
||||
|
||||
// Print header end
|
||||
fwrite ($bf,end_tag("HEADER",2,true));
|
||||
} else {
|
||||
$status = false;
|
||||
@ -1073,10 +1072,11 @@
|
||||
$status = $blockobj->instance_backup($bf, $preferences);
|
||||
fwrite ($bf,end_tag('INSTANCEDATA',4,true));
|
||||
}
|
||||
|
||||
// Write role assigns, overrides, etc.
|
||||
$context = get_context_instance(CONTEXT_BLOCK, $instance->id);
|
||||
write_role_overrides_xml($bf, $context, 4);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $preferences, $context, 4);
|
||||
write_per_context_data($bf, $preferences, $context, 4);
|
||||
|
||||
//End Block
|
||||
fwrite ($bf,end_tag('BLOCK',3,true));
|
||||
}
|
||||
@ -1233,10 +1233,9 @@
|
||||
fwrite ($bf,full_tag("AVAILABLEUNTIL",6,false,$course_module->availableuntil));
|
||||
fwrite ($bf,full_tag("SHOWAVAILABILITY",6,false,$course_module->showavailability));
|
||||
|
||||
// get all the role_capabilities overrides in this mod
|
||||
write_role_overrides_xml($bf, $context, 6);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $preferences, $context, 6);
|
||||
// Write role assigns, overrides, etc.
|
||||
write_per_context_data($bf, $preferences, $context, 6);
|
||||
|
||||
// write completion data if enabled and user data enabled
|
||||
require_once($CFG->libdir.'/completionlib.php');
|
||||
$completion=new completion_info($course);
|
||||
@ -1460,11 +1459,10 @@
|
||||
fwrite ($bf,end_tag("USER_PREFERENCES",4,true));
|
||||
}
|
||||
|
||||
// Write role assigns, overrides, etc.
|
||||
$context = get_context_instance(CONTEXT_USER, $user->old_id);
|
||||
write_per_context_data($bf, $preferences, $context, 4);
|
||||
|
||||
write_role_overrides_xml($bf, $context, 4);
|
||||
/// write role_assign code here
|
||||
write_role_assignments_xml($bf, $preferences, $context, 4);
|
||||
//End User tag
|
||||
fwrite ($bf,end_tag("USER",3,true));
|
||||
//Do some output
|
||||
@ -2817,6 +2815,14 @@
|
||||
return $roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes out all of the data that should appear for every context.
|
||||
*/
|
||||
function write_per_context_data($bf, $preferences, $context, $startlevel) {
|
||||
write_role_overrides_xml($bf, $context, $startlevel);
|
||||
write_role_assignments_xml($bf, $preferences, $context, $startlevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* function to print xml for overrides
|
||||
*/
|
||||
|
@ -8682,7 +8682,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
// try to restore roles even when restore is going to fail - teachers might have
|
||||
// at least some role assigned - this is not correct though
|
||||
$status = restore_create_roles($restore, $xml_file) && $status;
|
||||
$status = restore_roles_settings($restore, $xml_file) && $status;
|
||||
$status = restore_roles_and_filter_settings($restore, $xml_file) && $status;
|
||||
|
||||
//Now if all is OK, update:
|
||||
// - course modinfo field
|
||||
@ -8696,7 +8696,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
$course = $DB->get_record("course", array("id"=>$restore->course_id));
|
||||
fix_course_sortorder();
|
||||
// Check if the user has course update capability in the newly restored course
|
||||
// there is no need to load his capabilities again, because restore_roles_settings
|
||||
// there is no need to load his capabilities again, because restore_roles_and_filter_settings
|
||||
// would have loaded it anyway, if there is any assignments.
|
||||
// fix for MDL-6831
|
||||
$newcontext = get_context_instance(CONTEXT_COURSE, $restore->course_id);
|
||||
@ -8992,7 +8992,7 @@ WHERE
|
||||
* in course/user/block/mod level, it passed through
|
||||
* the xml file again
|
||||
*/
|
||||
function restore_roles_settings($restore, $xmlfile) {
|
||||
function restore_roles_and_filter_settings($restore, $xmlfile) {
|
||||
// data pulls from course, mod, user, and blocks
|
||||
|
||||
/*******************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user