mirror of
https://github.com/moodle/moodle.git
synced 2025-02-08 09:02:07 +01:00
MDL-20636 Fix qtype backup issues.
This commit is contained in:
parent
bea1a6a73a
commit
d6522c33a1
@ -191,4 +191,13 @@ abstract class backup_qtype_plugin extends backup_plugin {
|
||||
}
|
||||
return $components;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns one array with filearea => mappingname elements for the qtype
|
||||
*
|
||||
* Used by {@link get_components_and_fileareas} to know about all the qtype- * files to be processed both in backup and restore.
|
||||
*/
|
||||
public static function get_qtype_fileareas() {
|
||||
// By default, return empty array, only qtypes having own fileareas wil- return array();
|
||||
}
|
||||
}
|
||||
|
@ -177,12 +177,15 @@ abstract class backup_questions_activity_structure_step extends backup_activity_
|
||||
* for question_usages and all the associated data.
|
||||
*/
|
||||
protected function add_question_usages($element, $usageidname) {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/question/engine/lib.php');
|
||||
|
||||
// Check $element is one nested_backup_element
|
||||
if (! $element instanceof backup_nested_element) {
|
||||
throw new backup_step_exception('question_states_bad_parent_element', $element);
|
||||
}
|
||||
if (! $element->get_final_element($questionattemptname)) {
|
||||
throw new backup_step_exception('question_states_bad_question_attempt_element', $questionattemptname);
|
||||
if (! $element->get_final_element($usageidname)) {
|
||||
throw new backup_step_exception('question_states_bad_question_attempt_element', $usageidname);
|
||||
}
|
||||
|
||||
$quba = new backup_nested_element('question_usage', array('id'),
|
||||
@ -199,8 +202,7 @@ abstract class backup_questions_activity_structure_step extends backup_activity_
|
||||
'sequencenumber', 'state', 'fraction', 'timecreated', 'userid'));
|
||||
|
||||
$data = new backup_nested_element('data');
|
||||
$value = new backup_nested_element('value', array('name'),
|
||||
array('value'));
|
||||
$value = new backup_nested_element('value', array('name', 'value'));
|
||||
|
||||
// Build the tree
|
||||
$element->add_child($quba);
|
||||
@ -213,7 +215,7 @@ abstract class backup_questions_activity_structure_step extends backup_activity_
|
||||
|
||||
// Set the sources
|
||||
$quba->set_source_table('question_usages',
|
||||
array('id' => '../../' . $usageidname));
|
||||
array('id' => '../' . $usageidname));
|
||||
$qa->set_source_table('question_attempts',
|
||||
array('questionusageid' => backup::VAR_PARENTID));
|
||||
$step->set_source_table('question_attempt_steps',
|
||||
|
@ -340,13 +340,4 @@ abstract class restore_qtype_plugin extends restore_plugin {
|
||||
|
||||
return $contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns one array with filearea => mappingname elements for the qtype
|
||||
*
|
||||
* Used by {@link get_components_and_fileareas} to know about all the qtype- * files to be processed both in backup and restore.
|
||||
*/
|
||||
public static function get_qtype_fileareas() {
|
||||
// By default, return empty array, only qtypes having own fileareas wil- return array();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user