Skip to content

Commit

Permalink
MDL-62666 course: Only set the groups setting to true when necessary
Browse files Browse the repository at this point in the history
* Plus update the comment to be more descriptive.
  • Loading branch information
junpataleta committed Jan 21, 2019
1 parent 1877ae7 commit 7eeae1a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3420,10 +3420,12 @@ function duplicate_module($course, $cm) {
$rc = new restore_controller($backupid, $course->id,
backup::INTERACTIVE_NO, backup::MODE_IMPORT, $USER->id, backup::TARGET_CURRENT_ADDING);

// Configure the plan.
// Make sure that the restore_general_groups setting is always enabled when duplicating an activity.
$plan = $rc->get_plan();
$groupsetting = $plan->get_setting('groups');
$groupsetting->set_value(true);
if (empty($groupsetting->get_value())) {
$groupsetting->set_value(true);
}

$cmcontext = context_module::instance($cm->id);
if (!$rc->execute_precheck()) {
Expand Down

0 comments on commit 7eeae1a

Please sign in to comment.