Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-37028

Integrity check the course module sequence/sections

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4, 2.5.2
    • Fix Version/s: 2.6
    • Component/s: Course
    • Labels:
    • Testing Instructions:
      Hide

      Test 1 (on-the-fly correction).

      1. Edit DB directly and artificially corrupt the course_modules/course_sections tables with one of the following way:
      • course_sections.sequence contains a module id twice throughout the course
      • course_sections.sequence contains module id and for the same module course_modules.section does not match the section id (note that autofix will think that section sequence is more important!)
      1. Edit anything in the course (for example, open /course/edit.php page and save even without making any changes) - this will result in rebuilding the cache and auto correction
      2. Make sure debugging messages appear
      3. Open DB and make sure that corruptions were automatically fixed.

      Test 2 (cli script).

      1. Corrupt DB as mentioned above or also you can:
      • have an orphaned module (no course_sections.sequence in the course references to it)
      • have some non-existing id in course_sections.sequence
      1. Run php admin/cli/fix_course_sequence.php
      2. Try running with different arguments and make sure it is understandable what script is doing.
      3. Finally run with --fix and make sure everything is fixed in DB.
      Show
      Test 1 (on-the-fly correction). Edit DB directly and artificially corrupt the course_modules/course_sections tables with one of the following way: course_sections.sequence contains a module id twice throughout the course course_sections.sequence contains module id and for the same module course_modules.section does not match the section id (note that autofix will think that section sequence is more important!) Edit anything in the course (for example, open /course/edit.php page and save even without making any changes) - this will result in rebuilding the cache and auto correction Make sure debugging messages appear Open DB and make sure that corruptions were automatically fixed. Test 2 (cli script). Corrupt DB as mentioned above or also you can: have an orphaned module (no course_sections.sequence in the course references to it) have some non-existing id in course_sections.sequence Run php admin/cli/fix_course_sequence.php Try running with different arguments and make sure it is understandable what script is doing. Finally run with --fix and make sure everything is fixed in DB.
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull Master Branch:
      wip-MDL-37028-master
    • Sprint:
      BACKEND Sprint 4

      Description

      As I discovered in MDLSITE-1938, its possible to get to a situation where the course_modules records are pointing to a course_section, but the course_section.sequence doesn't contain a reference to the course_module.

      There is duplication of data, and after talking to Marina, there might be other situations where this sort of thing could happen.

      So this issue is to investigate whether we should do something to integrity check this data, or adapt to it.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  18/Nov/13