Permalink
Browse files

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

…s on import/restore
  • Loading branch information...
1 parent 2713f92 commit a2bbc96b3eb7cc3de76bf992f8f1c54ca476d322 @aolley aolley committed with abgreeve May 3, 2012
Showing with 3 additions and 14 deletions.
  1. +3 −14 backup/moodle2/restore_stepslib.php
@@ -843,20 +843,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 a2bbc96

Please sign in to comment.