adlnet / Moodle-mod_cmi5launch

A Moodle plugin which allows teachers to upload cmi5 packaged lessons within a Moodle Course Activity and then assign the activity to students
Apache License 2.0
5 stars 5 forks source link

Error attempting backup/restore of course containing activity module instance #23

Closed logan-reynolds closed 1 month ago

logan-reynolds commented 9 months ago

On Moodle 3.11.17 (Build: 20231009) running latest 'main' branch of mod_cmi5launch version 2018110100 release 1.3RC2 (Build: 2016060300), when adding an instance of the cmi5launch activity to a course and attempting backup/restore it fails with the following exception because files need to be renamed with filename matching the frankenstyle plugin name:

Exception - Class 'backup_cmi5launch_activity_task' not found

More information about this error
Debug info:
Error code: generalexceptionmessage
Stack trace:

    line 107 of /backup/util/factories/backup_factory.class.php: Error thrown
    line 133 of /backup/moodle2/backup_plan_builder.class.php: call to backup_factory::get_backup_activity_task()
    line 167 of /backup/moodle2/backup_plan_builder.class.php: call to backup_plan_builder::build_activity_plan()
    line 188 of /backup/moodle2/backup_plan_builder.class.php: call to backup_plan_builder::build_section_plan()
    line 101 of /backup/moodle2/backup_plan_builder.class.php: call to backup_plan_builder::build_course_plan()
    line 163 of /backup/util/factories/backup_factory.class.php: call to backup_plan_builder::build_plan()
    line 67 of /backup/util/plan/backup_plan.class.php: call to backup_factory::build_plan()
    line 463 of /backup/controller/backup_controller.class.php: call to backup_plan->build()
    line 149 of /backup/controller/backup_controller.class.php: call to backup_controller->load_plan()
    line 125 of /backup/backup.php: call to backup_controller->__construct()

Likely renaming the files under /backup/moodle2/ should be all that's needed, but may want to doublecheck there are no leftover references which statically reference incorrect plugin names/values. Expected outcome is that plugin must always allow for successful course backup/restore.

ADLMeganBohland commented 8 months ago

@logan-reynolds Thank you for bringing this to my attention and apologies for stagnation on the issue, I believe I have resolved the issue in the new version of the plugin, but please let me know if it is still not working for you. Thank you!

logan-reynolds commented 6 months ago

@ADLMeganBohland thank you; just noting I pulled the latest version of this plugin, but encountered errors trying to install/upgrade it per notes in https://github.com/adlnet/Moodle-mod_cmi5launch/issues/35 and #36 . Feel free to contact if you need more specific information on either of those bug reports, and once those are addressed I'm happy to test again for resolution of this issue.

ADLMeganBohland commented 6 months ago

@logan-reynolds I believe those issues have been resolved if you want to test again

logan-reynolds commented 5 months ago

Thank you; it does look like the prior issue was resolved with newer mod_cmi5launch version 2024032112, however I'm still running into some problems getting the backup/restore of a course containing activity module instance to work.

On Moodle 3.11.18 (Build: 20231211)

On Moodle 4.1.9 (Build: 20240212)

More information about this error Debug info: Error code: ddltablenotexist Stack trace:

line 673 of /lib/dml/moodle_database.php: dml_exception thrown
line 1711 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
line 210 of /mod/cmi5launch/lib.php: call to moodle_database->get_field()
line 5207 of /lib/moodlelib.php: call to cmi5launch_delete_instance()
line 5070 of /lib/moodlelib.php: call to remove_course_contents()
line 68 of /course/delete.php: call to delete_course()```
ADLMeganBohland commented 5 months ago

@logan-reynolds Thankyou, I will investigate these. I started with "FEATURE_MOD_PURPOSE" as I understand it, this just enables different backgrounds on the icons. This is actually not necessary, would a acceptable fix be simply to remove this constant? Or is it required?

ADLMeganBohland commented 5 months ago

@logan-reynolds Thank you for your attention to this and pointing out the issues. I believe I have resolved them. I found out somehow that old table was hardcoded to be deleted even though it wasn't there. I have a question though about the purpose of "delete_instance". Should it delete ALL data associated with the activity? Such as all the separate user info about it, such as sessions, grades, etc ?

logan-reynolds commented 5 months ago

@ADLMeganBohland since the expectations for activity instance backup and restore may differ between releases I'd just refer you to the Moodle developer documentation specific to your component type, in this case for a mod at https://moodledev.io/docs/4.4/apis/plugintypes/mod . If you're confirming functionality on older versions you can switch the drop-down in the top right to get documentation appropriate for your version, or instructions on the older Moodle 3.x and lower series legacy documentation.

ADLMeganBohland commented 1 month ago

Plugin has been updated