Project: moodle
Issue MDL-34684: Adding a new health check to detect incorrect category path order and/or missing parent categories
Some sites have corrupted hierarchies between course categories, in course_categories->parent field or in course_categories->path. The cause of this issue is not present in the current maintained versions and not all sites are affected by it, so instead of adding an upgrade process we add an extra health check process to explain to the users how to fix the problem, proposing them a sql query to run into the database. *Edited summary and description* -------------------------------------------------------------- *Original description* upgraded from moodle.2.1.1 to moodle.2.2.4 and then finally to Moodle 2.3.1+ (Build: 20120726) PHP PHP 5.3.2-1ubuntu4.17 MySQL 5.1.63-0ubuntu0.10.04.1-log Ubuntu 10.04.4 LTS When I click on a course category it gives me this error (with full debug on): {noformat} Notice: Undefined index: 5 in /var/www/moodle/lib/navigationlib.php on line 1796 Notice: Trying to get property of non-object in /var/www/moodle/lib/navigationlib.php on line 1797 Notice: Trying to get property of non-object in /var/www/moodle/lib/navigationlib.php on line 1801 Coding error detected, it must be fixed by a programmer: Category path order is incorrect and/or there are missing categories Debug info: Error code: codingerror Stack trace: line 1809 of /lib/navigationlib.php: coding_exception thrown line 1195 of /lib/navigationlib.php: call to global_navigation->load_all_categories() line 3039 of /lib/navigationlib.php: call to global_navigation->initialise() line 781 of /lib/pagelib.php: call to navbar->has_items() line 3 of /theme/aardvark_postit/layout/default.php: call to moodle_page->has_navbar() line 765 of /lib/outputrenderers.php: call to include() line 712 of /lib/outputrenderers.php: call to core_renderer->render_page_layout() line ? of unknownfile: call to core_renderer->header() line 1445 of /lib/setuplib.php: call to call_user_func_array() line ? of unknownfile: call to bootstrap_renderer->__call() line 199 of /course/category.php: call to bootstrap_renderer->header() {noformat} As an admin I can go to the course categories with no errors. But when I'm not logged in, I can't. Or other roles. This fix script doesn't change anything: {code}
Story points: 20