moodle-mod_choicegroup icon indicating copy to clipboard operation
moodle-mod_choicegroup copied to clipboard

mod_choicegroup events are not restored from backup

Open LiFaytheGoblin opened this issue 2 years ago • 2 comments

I had a course in another Moodle instance that used the choicegroup plugin. There were various events recorded for a choicegroup module in a course. I exported a back up of the course and imported the .mbz in a different Moodle instance. It did not restore some or all choicegroup events, but instead raised errors like the following:

moodleapp_1  | [Tue Aug 02 11:37:46.860380 2022] [php7:notice] [pid 18] [client 172.18.0.1:42526] 
PHP Notice:  In order to restore course logs accurately the event "mod_choicegroup\\event\\course_module_viewed" must define the function get_objectid_mapping().
<ul style="text-align: left" data-rel="backtrace">
<li>line 550 of /lib/classes/event/base.php: call to debugging()</li>
<li>line 101 of /admin/tool/log/backup/moodle2/restore_tool_log_logstore_subplugin.class.php: call to core\\event\\base::get_objectid_mapping()</li>
<li>line 63 of /admin/tool/log/store/standard/backup/moodle2/restore_logstore_standard_subplugin.class.php: call to restore_tool_log_logstore_subplugin->process_log()</li>
<li>line 137 of /backup/util/plan/restore_structure_step.class.php: call to restore_logstore_standard_subplugin->process_logstore_standard_log()</li>
<li>line 121 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()</li>
<li>line 178 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()</li>
< in /var/www/html/lib/weblib.php on line 3257, referer: http://localhost/backup/restore.php

It says that the module's events need to implement get_objectid_mapping() which none of them currently do.

LiFaytheGoblin avatar Aug 02 '22 12:08 LiFaytheGoblin

I would like to see a fix for this

Urpokarhu1 avatar Dec 04 '23 05:12 Urpokarhu1

Hello @LiFaytheGoblin @Urpokarhu1, we have been investigating this issue with @ndunand today (sorry for the delay), and we were not able to reproduce it.

Here is what we tried, on a Moodle 4.2 platform using PHP 8.1 and Choicegroup 1.44 :

  • creating a choicegroup activity in a course,
  • checking that logs related to the activity are present
  • backing up the course including logs
  • restoring the course (logs included) on a different Moodle platform => the logs are correctly restored (though they are now related to the new activity ID), and we did not encounter any warning.

Could you please provide more details on how to reproduce the issue ? (Moodle version, plugin version, steps...)

Thank you !

NicoAlexH avatar Jan 17 '24 14:01 NicoAlexH