mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-37714: Correctly identify frequently used comments during restore
This commit is contained in:
parent
9788e26805
commit
20c9f4a133
@ -65,7 +65,7 @@ class backup_gradingform_guide_plugin extends backup_gradingform_plugin {
|
||||
|
||||
$pluginwrapper->add_child($criteria);
|
||||
$criteria->add_child($criterion);
|
||||
$criteria->add_child($comments);
|
||||
$pluginwrapper->add_child($comments);
|
||||
$comments->add_child($comment);
|
||||
|
||||
// Set sources to populate the data.
|
||||
|
@ -48,6 +48,11 @@ class restore_gradingform_guide_plugin extends restore_gradingform_plugin {
|
||||
$paths[] = new restore_path_element('gradingform_guide_comment',
|
||||
$this->get_pathfor('/guidecomments/guidecomment'));
|
||||
|
||||
// MDL-37714: Correctly locate frequent used comments in both the
|
||||
// current and incorrect old format.
|
||||
$paths[] = new restore_path_element('gradingform_guide_comment_legacy',
|
||||
$this->get_pathfor('/guidecriteria/guidecomments/guidecomment'));
|
||||
|
||||
return $paths;
|
||||
}
|
||||
|
||||
@ -99,6 +104,20 @@ class restore_gradingform_guide_plugin extends restore_gradingform_plugin {
|
||||
$DB->insert_record('gradingform_guide_comments', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes comments element data
|
||||
*
|
||||
* @param array|stdClass $data The data to insert as a comment
|
||||
*/
|
||||
public function process_gradingform_guide_comment_legacy($data) {
|
||||
global $DB;
|
||||
|
||||
$data = (object)$data;
|
||||
$data->definitionid = $this->get_new_parentid('grading_definition');
|
||||
|
||||
$DB->insert_record('gradingform_guide_comments', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes filling element data
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user