Hello,
I will refresh this almost 10 years old post. Is there any way to get the new instance id, during the restore or import procedure?. There is only a moodle core function which creates the new instance but don't returns any value.
$newinstanceid = $this->apply_activity_instance($newitemid);
Best regards
Paul
I will really appreciate for any suggestion, information whether there is a chance to get the new instance id.
Best regards
Paul
You might get some hints by looking at the source code of the moosh utility. At the end of a command line restore of an *mbz file you get a message in the form.
New course ID for 'BCP': 301 in 17
Where 301 is the new course id and 17 is the category.
Thanks Marcus for your hint.
I have found a workaround by inserting temporary data and then updating the record. A litte bit dirty way, but it works as expected.