By human error, we accidentally triggered a deletion job on our Spring 2021 parent course category, sub-categories and courses (from the category/course management page). We are on Moodle 3.7.3
The deletion job removed the first 5-6 course sub-categories AND their nested courses before we "stopped the bleeding" by shutting down and restarting two of our web servers that we were on around the time the deletion was started.
Now we are seeing an "Can't find data record in database table context" error message in three places:
- When trying to view the categories and course management page
- When trying to perform an import
- Step 2 (destination) when trying to perform a restore
Here is debugging (developer) information when trying to view the categories and course management page:
Can't find data record in database table context.
Debug info: SELECT * FROM {context} WHERE id = ?
[array (
0 => '1807519',
)]
Error code: invalidrecord
Stack trace:
line 1562 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
line 1538 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
line 5191 of /lib/accesslib.php: call to moodle_database->get_record()
line 5577 of /lib/accesslib.php: call to context::instance_by_id()
line 5430 of /lib/accesslib.php: call to context->get_parent_context()
line 5008 of /lib/accesslib.php: call to context->is_locked()
line 484 of /lib/accesslib.php: call to context->get()
line 2288 of /course/lib.php: call to has_capability()
line 1886 of /course/classes/category.php: call to can_delete_course()
line 247 of /course/classes/management/helper.php: call to core_course_category->can_delete_full()
line 258 of /course/classes/management_renderer.php: call to core_course\management\helper::get_category_listitem_actions()
line 164 of /course/classes/management_renderer.php: call to core_course_management_renderer->category_listitem()
line 496 of /course/management.php: call to core_course_management_renderer->category_listing()
Things we've tried:
- Running cronjobs several times
- Clicking "Run Now" on the cleanup and context related tasks in the scheduled tasks area
- Using API webservices to provision new categories to replace the ones that got deleted.
- Tried deletion a sub-category of an old "archived" term to see if it could trigger contexts to get cleaned up
It's important to note that our term-based categories, sub-categories and courses are created normally through a provisioning process from our SIS system - fed through our database to create the categories, courses and finally, feed over enrollments.
Are there any other solutions we can try?