MDL-26399 restore - fix oracle/mssql problems

This commit is contained in:
Eloy Lafuente (stronk7) 2011-02-14 19:42:57 +01:00
parent d911c72bf9
commit d84fe4c8a6

View file

@ -660,8 +660,8 @@ class restore_groups_structure_step extends restore_structure_step {
$params = array('courseid' => $this->get_courseid(), 'grname' => $data->name); $params = array('courseid' => $this->get_courseid(), 'grname' => $data->name);
if (!empty($data->description)) { if (!empty($data->description)) {
$description_clause = ' AND ' . $description_clause = ' AND ' .
$DB->sql_compare_text('description') . ' = ' . $DB->sql_compare_text(':desc'); $DB->sql_compare_text('description') . ' = ' . $DB->sql_compare_text(':description');
$params['desc'] = $data->description; $params['description'] = $data->description;
} }
if (!$groupdb = $DB->get_record_sql("SELECT * if (!$groupdb = $DB->get_record_sql("SELECT *
FROM {groups} FROM {groups}
@ -708,8 +708,8 @@ class restore_groups_structure_step extends restore_structure_step {
$params = array('courseid' => $this->get_courseid(), 'grname' => $data->name); $params = array('courseid' => $this->get_courseid(), 'grname' => $data->name);
if (!empty($data->description)) { if (!empty($data->description)) {
$description_clause = ' AND ' . $description_clause = ' AND ' .
$DB->sql_compare_text('description') . ' = ' . $DB->sql_compare_text(':desc'); $DB->sql_compare_text('description') . ' = ' . $DB->sql_compare_text(':description');
$params['desc'] = $data->description; $params['description'] = $data->description;
} }
if (!$groupingdb = $DB->get_record_sql("SELECT * if (!$groupingdb = $DB->get_record_sql("SELECT *
FROM {groupings} FROM {groupings}
@ -1786,7 +1786,7 @@ class restore_activity_grades_structure_step extends restore_structure_step {
$data->timecreated = $this->apply_date_offset($data->timecreated); $data->timecreated = $this->apply_date_offset($data->timecreated);
$data->timemodified = $this->apply_date_offset($data->timemodified); $data->timemodified = $this->apply_date_offset($data->timemodified);
$gradeitem = new grade_item($data); $gradeitem = new grade_item($data, false);
$gradeitem->insert('restore'); $gradeitem->insert('restore');
//sortorder is automatically assigned when inserting. Re-instate the previous sortorder //sortorder is automatically assigned when inserting. Re-instate the previous sortorder
@ -1809,7 +1809,7 @@ class restore_activity_grades_structure_step extends restore_structure_step {
// TODO: Ask, all the rest of locktime/exported... work with time... to be rolled? // TODO: Ask, all the rest of locktime/exported... work with time... to be rolled?
$data->overridden = $this->apply_date_offset($data->overridden); $data->overridden = $this->apply_date_offset($data->overridden);
$grade = new grade_grade($data); $grade = new grade_grade($data, false);
$grade->insert('restore'); $grade->insert('restore');
// no need to save any grade_grade mapping // no need to save any grade_grade mapping
} }