Course Backup - add additional table

Course Backup - add additional table

by Bernhard Hörterer -
Number of replies: 2

I have an activity module that stores custom settings in an extra table my_activity_settings

I also implemented a custom settings page for courses so privilleged users can set the default values for these activity settings for every course. These settings are stored in the same table as the activity (but with a diffrent realm 'course')


Problem: Backup

I can backup and restore the settings for the activities. But how can I backup and restore the addinional data for courses? Is there  hook?



Average of ratings: Useful (1)
In reply to Bernhard Hörterer

Re: Course Backup - add additional table

by Rodrigo Mady -

You should implement the backup API in your plugin.

Some plugins work with XMLs, so depends of our need.

In reply to Rodrigo Mady

Re: Course Backup - add additional table

by Bernhard Hörterer -

Hi Rodrigo,

I am a little confused by your answer. In my initial post I wrote that I already implemented the backup for my activities. Works no problem. What I want to do is add a backup step to the course backup for my activities, because users can make custom settings per course for all course activity modules.

But there is no hook for that as far as I can see! I tried to add a step to the backup_course_stask but this step does not get executed


protected function define_my_steps() {
  //activity step
$this->add_step(new backup_myactivity_activity_structure_step('myactivity_structure', 'myactivity.xml'));
//add an additional step to the course backup task for the mod course settings
$tasks = $this->plan->get_tasks();
foreach($tasks as &$task) {
if($task instanceof backup_course_task) {
$task->add_step(new backup_course_ivs_settings_step('ivs_settings_structure', 'ivs_course_settings.xml'));
}
}

But this step does not get executed, also my debugger says it successfully added the step