mirror of
https://github.com/PlagiarismCheck/moodle-plagiarism_pchkorg.git
synced 2024-12-22 12:10:08 +00:00
Fix for backup and restore api
This commit is contained in:
parent
0803af58ea
commit
987a4b8674
@ -33,28 +33,28 @@ class backup_plagiarism_pchkorg_plugin extends backup_plagiarism_plugin {
|
|||||||
// Connect the visible container ASAP.
|
// Connect the visible container ASAP.
|
||||||
$plugin->add_child($pluginwrapper);
|
$plugin->add_child($pluginwrapper);
|
||||||
|
|
||||||
$configs = new backup_nested_element('pchkorg_configs');
|
$configs = new backup_nested_element('pchkorg_activities_configs');
|
||||||
$config = new backup_nested_element('pchkorg_config', ['id'], ['name', 'value']);
|
$config = new backup_nested_element('pchkorg_activities_config', ['id'], ['name', 'value']);
|
||||||
$pluginwrapper->add_child($configs);
|
$pluginwrapper->add_child($configs);
|
||||||
$configs->add_child($config);
|
$configs->add_child($config);
|
||||||
$config->set_source_table('plagiarism_pchkorg_config', ['cm' => backup::VAR_PARENTID]);
|
$config->set_source_table('plagiarism_pchkorg_config', ['cm' => backup::VAR_PARENTID]);
|
||||||
|
|
||||||
// Now information about files to module.
|
// Now information about files to module.
|
||||||
$ufiles = new backup_nested_element('pchkorg_files');
|
$files = new backup_nested_element('pchkorg_files');
|
||||||
$ufile = new backup_nested_element('pchkorg_file', ['id'], [
|
$file = new backup_nested_element('pchkorg_file', ['id'], [
|
||||||
'cm', 'fileid', 'userid',
|
'cm', 'fileid', 'userid',
|
||||||
'state', 'score', 'created_at',
|
'state', 'score', 'created_at',
|
||||||
'textid', 'reportid', 'signature',
|
'textid', 'reportid', 'signature',
|
||||||
'attempt', 'itemid'
|
'attempt', 'itemid'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$pluginwrapper->add_child($ufiles);
|
$pluginwrapper->add_child($files);
|
||||||
$ufiles->add_child($ufile);
|
$files->add_child($file);
|
||||||
|
|
||||||
// To know if we are including userinfo.
|
// To know if we are including userinfo.
|
||||||
$userinfo = $this->get_setting_value('userinfo');
|
$userinfo = $this->get_setting_value('userinfo');
|
||||||
if ($userinfo) {
|
if ($userinfo) {
|
||||||
$ufile->set_source_table('plagiarism_pchkorg_files', ['cm' => backup::VAR_PARENTID]);
|
$file->set_source_table('plagiarism_pchkorg_files', ['cm' => backup::VAR_PARENTID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $plugin;
|
return $plugin;
|
||||||
@ -66,21 +66,16 @@ class backup_plagiarism_pchkorg_plugin extends backup_plagiarism_plugin {
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function define_course_plugin_structure() {
|
public function define_course_plugin_structure() {
|
||||||
// Define the virtual plugin element without conditions as the global class checks already.
|
|
||||||
$plugin = $this->get_plugin_element();
|
$plugin = $this->get_plugin_element();
|
||||||
|
|
||||||
// Create one standard named plugin element (the visible container).
|
|
||||||
$pluginwrapper = new backup_nested_element($this->get_recommended_name());
|
$pluginwrapper = new backup_nested_element($this->get_recommended_name());
|
||||||
|
|
||||||
// Connect the visible container ASAP.
|
|
||||||
$plugin->add_child($pluginwrapper);
|
$plugin->add_child($pluginwrapper);
|
||||||
// Save id from pchkorg course.
|
|
||||||
$unconfigs = new backup_nested_element('pchkorg_configs');
|
$configs = new backup_nested_element('pchkorg_configs');
|
||||||
$unconfig = new backup_nested_element('pchkorg_config', ['id'], ['plugin', 'name', 'value']);
|
$config = new backup_nested_element('pchkorg_config', ['id'], ['plugin', 'name', 'value']);
|
||||||
$pluginwrapper->add_child($unconfigs);
|
$pluginwrapper->add_child($configs);
|
||||||
$unconfigs->add_child($unconfig);
|
$configs->add_child($config);
|
||||||
$unconfig->set_source_table('config_plugins', [
|
$config->set_source_table('config_plugins', [
|
||||||
'name' => backup::VAR_PARENTID, 'plugin' => 'plagiarism',
|
'name' => backup::VAR_PARENTID, 'plugin' => backup_helper::is_sqlparam('plagiarism'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $plugin;
|
return $plugin;
|
||||||
|
@ -19,7 +19,7 @@ defined('MOODLE_INTERNAL') || die();
|
|||||||
|
|
||||||
class restore_plagiarism_pchkorg_plugin extends restore_plagiarism_plugin {
|
class restore_plagiarism_pchkorg_plugin extends restore_plagiarism_plugin {
|
||||||
|
|
||||||
public function process_pchkorgconfig($data) {
|
public function process_pchkorg_config($data) {
|
||||||
$data = (object) $data;
|
$data = (object) $data;
|
||||||
|
|
||||||
set_config($this->task->get_courseid(), $data->value, $data->plugin);
|
set_config($this->task->get_courseid(), $data->value, $data->plugin);
|
||||||
@ -49,9 +49,9 @@ class restore_plagiarism_pchkorg_plugin extends restore_plagiarism_plugin {
|
|||||||
protected function define_course_plugin_structure() {
|
protected function define_course_plugin_structure() {
|
||||||
$paths = [];
|
$paths = [];
|
||||||
|
|
||||||
// Add own format stuff.
|
|
||||||
$elename = 'pchkorg_config';
|
$elename = 'pchkorg_config';
|
||||||
$elepath = $this->get_pathfor('pchkorg_configs/pchkorg_config'); // We used get_recommended_name() so this works.
|
$elepath = $this->get_pathfor('/pchkorg_configs/pchkorg_config');
|
||||||
|
|
||||||
$paths[] = new restore_path_element($elename, $elepath);
|
$paths[] = new restore_path_element($elename, $elepath);
|
||||||
|
|
||||||
return $paths; // And we return the interesting paths.
|
return $paths; // And we return the interesting paths.
|
||||||
@ -62,7 +62,7 @@ class restore_plagiarism_pchkorg_plugin extends restore_plagiarism_plugin {
|
|||||||
$paths = [];
|
$paths = [];
|
||||||
|
|
||||||
$elename = 'pchkorgconfigmod';
|
$elename = 'pchkorgconfigmod';
|
||||||
$elepath = $this->get_pathfor('pchkorg_configs/pchkorg_config');
|
$elepath = $this->get_pathfor('/pchkorg_activities_configs/pchkorg_activities_config');
|
||||||
$paths[] = new restore_path_element($elename, $elepath);
|
$paths[] = new restore_path_element($elename, $elepath);
|
||||||
|
|
||||||
$elename = 'pchkorgfiles';
|
$elename = 'pchkorgfiles';
|
||||||
|
@ -26,9 +26,9 @@ defined('MOODLE_INTERNAL') || die();
|
|||||||
if (!isset($plugin)) {
|
if (!isset($plugin)) {
|
||||||
$plugin = new stdClass();
|
$plugin = new stdClass();
|
||||||
}
|
}
|
||||||
$plugin->version = 2022110418;
|
$plugin->version = 2022110716;
|
||||||
$plugin->requires = 2020061501; // Requires Moodle 3.9 .
|
$plugin->requires = 2020061501; // Requires Moodle 3.9 .
|
||||||
$plugin->release = 'v3.13.1';
|
$plugin->release = 'v3.13.2';
|
||||||
$plugin->component = 'plagiarism_pchkorg';
|
$plugin->component = 'plagiarism_pchkorg';
|
||||||
$plugin->maturity = MATURITY_STABLE;
|
$plugin->maturity = MATURITY_STABLE;
|
||||||
$plugin->dependencies = array(
|
$plugin->dependencies = array(
|
||||||
|
Loading…
Reference in New Issue
Block a user