Permalink
Browse files

MDL-30797 backup: Use correct API call for mapping groups to grouping…

…s on import/restore
  • Loading branch information...
1 parent ca48fe5 commit fdcf4a5f37af9fb4c7b1fff9e363f4119a412d0e @aolley aolley committed with abgreeve May 3, 2012
Showing with 3 additions and 14 deletions.
  1. +3 −14 backup/moodle2/restore_stepslib.php
@@ -824,20 +824,9 @@ public function process_grouping($data) {
}
public function process_grouping_group($data) {
- global $DB;
-
- $data = (object)$data;
-
- $data->groupingid = $this->get_new_parentid('grouping'); // Use new parentid
- $data->groupid = $this->get_mappingid('group', $data->groupid); // Get from mappings
-
- $params = array();
- $params['groupingid'] = $data->groupingid;
- $params['groupid'] = $data->groupid;
-
- if (!$DB->record_exists('groupings_groups', $params)) {
- $DB->insert_record('groupings_groups', $data); // No need to set this mapping (no child info nor files)
- }
+ global $CFG;
+ require_once($CFG->dirroot.'/group/lib.php');
+ groups_assign_grouping($this->get_new_parentid('grouping'), $this->get_mappingid('group', $data->groupid));
}
protected function after_execute() {

0 comments on commit fdcf4a5

Please sign in to comment.