Skip to content

Commit

Permalink
Fix typeid in backup and restore.
Browse files Browse the repository at this point in the history
  • Loading branch information
srobotta committed Dec 5, 2024
1 parent 2599294 commit b306ee6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
16 changes: 8 additions & 8 deletions backup/moodle2/backup_verbalfeedback_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,35 @@ protected function define_structure() {
$category = new backup_nested_element('category', ['id'], ['instanceid', 'paramtemplatecategoryid', 'position', 'weight']);

$categoryheaders = new backup_nested_element('categoryheaders');
$categoryheader = new backup_nested_element('categoryheader', ['id'], ['foreignkey', 'type', 'languageid', 'string']);
$categoryheader = new backup_nested_element('categoryheader', ['id'], ['foreignkey', 'typeid', 'languageid', 'string']);

$criteria = new backup_nested_element('criteria');
$criterion = new backup_nested_element('criterion', ['id'],
['paramtemplatecriterionid', 'categoryid', 'position', 'weight']);

$criteriontexts = new backup_nested_element('criteriontexts');
$criteriontext = new backup_nested_element('criteriontext', ['id'], ['foreignkey', 'type', 'languageid', 'string']);
$criteriontext = new backup_nested_element('criteriontext', ['id'], ['foreignkey', 'typeid', 'languageid', 'string']);

$subratings = new backup_nested_element('subratings');
$subrating = new backup_nested_element('subrating', ['id'], ['criterionid']);

$subratingtitles = new backup_nested_element('titles');
$subratingtitle = new backup_nested_element('title', ['id'], ['foreignkey', 'type', 'languageid', 'string']);
$subratingtitle = new backup_nested_element('title', ['id'], ['foreignkey', 'typeid', 'languageid', 'string']);

$subratingdescriptions = new backup_nested_element('descriptions');
$subratingdescription = new backup_nested_element('description', ['id'], ['foreignkey', 'type', 'languageid', 'string']);
$subratingdescription = new backup_nested_element('description', ['id'], ['foreignkey', 'typeid', 'languageid', 'string']);

$subratingverynegatives = new backup_nested_element('verynegatives');
$subratingverynegative = new backup_nested_element('verynegative', ['id'], ['foreignkey', 'type', 'languageid', 'string']);
$subratingverynegative = new backup_nested_element('verynegative', ['id'], ['foreignkey', 'typeid', 'languageid', 'string']);

$subratingnegatives = new backup_nested_element('negatives');
$subratingnegative = new backup_nested_element('negative', ['id'], ['foreignkey', 'type', 'languageid', 'string']);
$subratingnegative = new backup_nested_element('negative', ['id'], ['foreignkey', 'typeid', 'languageid', 'string']);

$subratingpositives = new backup_nested_element('positives');
$subratingpositive = new backup_nested_element('positive', ['id'], ['foreignkey', 'type', 'languageid', 'string']);
$subratingpositive = new backup_nested_element('positive', ['id'], ['foreignkey', 'typeid', 'languageid', 'string']);

$subratingverypositives = new backup_nested_element('verypositives');
$subratingverypositive = new backup_nested_element('verypositive', ['id'], ['foreignkey', 'type', 'languageid', 'string']);
$subratingverypositive = new backup_nested_element('verypositive', ['id'], ['foreignkey', 'typeid', 'languageid', 'string']);

$submissions = new backup_nested_element('submissions');
$submission = new backup_nested_element('submission', ['id'], ['instanceid', 'fromuserid', 'touserid', 'status',
Expand Down
3 changes: 1 addition & 2 deletions backup/moodle2/restore_verbalfeedback_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,7 @@ private function process_localized_string($foreigenkeymapping, $data) {
$data = (object) $data;
$data->foreignkey = $this->get_mappingid($foreigenkeymapping, $data->foreignkey);
$data->languageid = $this->get_mappingid('language', $data->languageid);
$data->typeid = localized_string_type::str2id($data->type);
unset($data->type);
$data->typeid = $this->get_mappingid('typeid', $data->typeid);
$data->instanceid = $this->instanceid;
$DB->insert_record('verbalfeedback_local_string', $data);
}
Expand Down

0 comments on commit b306ee6

Please sign in to comment.