Change restore setting keep_roles_and_enrolments to yes

Change restore setting keep_roles_and_enrolments to yes

by Ângelo Rigo -
Number of replies: 2

Hi

How can i change the code to have yes, for the default option , when restoring a course i am looking for this setting :  setting_course_keep_roles_and_enrolments .

I can not find in the code at the moment. I need to change this option.

Thank's in advance

 

Average of ratings: -
In reply to Ângelo Rigo

Re: Change restore setting keep_roles_and_enrolments to yes

by Ângelo Rigo -

I comment in the backup/util/ui/restore_ui.class.php file in the execute method these line :

if ($this->controller->get_target() == backup::TARGET_CURRENT_DELETING || $this->controller->get_target() == backup::TARGET_EXISTING_DELETING) {
$options = array();
//$options['keep_roles_and_enrolments'] = $this->get_setting_value('keep_roles_and_enrolments');
$options['keep_roles_and_enrolments'] = 1;
$options['keep_groups_and_groupings'] = $this->get_setting_value('keep_groups_and_groupings');
restore_dbops::delete_course_content($this->controller->get_courseid(), $options);

But seems have no effect even i choose deleting actual course option. 

 

In reply to Ângelo Rigo

Re: Change restore setting keep_roles_and_enrolments to yes

by Ângelo Rigo -

I just found the setting  in the restore_course_task.class.php