I've been struggling with trying to figure out how to get my local plugin data backed up and after carefully studying all of the documentation I've found and trying things I don't think I'm getting anywhere. Does anyone perhaps have a local plugin that uses backup? Maybe the local_dev plugin used on Moodle.org?
I know there is an undocumented API, and it has various hooks such as the question hook. Knowing that, I've tried to adapt the documentation that exists for activity backup and reports backup. That only resulted in utter confusion and cussing. I don't know if I'm heading the right way at all since the docs for activities are so different than the ones for reports.
My plugin stores some extra data related to questions, and there's no obvious way to know which questions are included in a backup other than to use the question hook (define_question_plugin_structure), I guess that's part of what I need to do. What the heck to code inside of define_question_plugin_structure I have no idea. I'm attaching the code I have now, which throws the error below. What I have now is partially based on a qtype plugin, since that also has a question hook for backup. I sure could use some pointers.
Really, really awesome to have would be a "hello world" plugin that uses define_question_plugin_structure to backup some simple data item associated with a question. That's probably too much to ask, though.
Thanks for any pointers or suggestions.
Error code: baseelementincorrectfinalorattribute
$a contents: include
- line 125 of \backup\util\structure\base_final_element.class.php: base_element_struct_exception thrown
- line 333 of \backup\util\structure\backup_nested_element.class.php: call to base_final_element->find_element_by_path()
- line 73 of \backup\util\structure\backup_optigroup_element.class.php: call to backup_nested_element->find_element()
- line 191 of \backup\util\structure\backup_optigroup_element.class.php: call to backup_optigroup_element->set_condition()
- line 175 of \backup\util\structure\base_nested_element.class.php: call to backup_optigroup_element->set_parent()
- line 56 of \backup\util\structure\backup_optigroup.class.php: call to base_nested_element->add_child()
- line 89 of \backup\moodle2\backup_plugin.class.php: call to backup_optigroup->add_child()
- line 56 of \local\enemyquestions\backup\moodle2\backup_local_enemyquestions_plugin.class.php: call to backup_plugin->get_plugin_element()