-
Bug
-
Resolution: Fixed
-
Blocker
-
2.2.11, 2.3.9, 2.4.7, 2.5.3, 2.6
-
MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
-
MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
-
w52_
MDL-43367_m27_contextpath -
-
4
-
BACKEND Sprint 8
This problem was reported by partner. The trouble is that for various reasons the context path may be missing which results in invalid SQL like path selector in get_child_contexts() - we need to verify the path is valid before using it. The problem is that the get_child_contexts() may be used when deleting data which resulted in deletion of all contexts in several existing sites when using some add-ons...
Short term solution:
- print debugging message when get_child_contexts() on contexts that do not have path or depth and return empty array
- prevent deleting of system context
Long term solution (new issue to be created):
- prevent deleting of invalid contexts in UI
- add CLI tool for diagnostics and rebuilding of context paths
- add more debugging notices to inform admins that there is something wrong with contexts
- add more debugging info for admins that try to insert data directly to database tables without rebuilding the contexts
- maybe add workaround code for invalid contexts that tries to lookup children using some other info