Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-31389 Backups not sorted adequately
  3. MDL-31390

Allow set_source_table() to specify an optional order

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Fixed
    • Major
    • 2.5
    • 2.1.4, 2.2.1, 2.3.4, 2.4.1, 2.5
    • Backup
    • Any
    • MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_25_STABLE
    • Hide

      Find and fix every occurrence of this issue individually

      Show
      Find and fix every occurrence of this issue individually
    • Hide
      • Open a course
      • Turn editing on
      • Add a new lesson activity
      • Create a new 'Matching' question
      • Add some answers for each field
      • back up the module
        • Confirm that no errors were shown
      • Edit mod/lesson/backup/moodle2/backup_lesson_stepslib.php
      • find the call to set_source_table for lesson_answers ordering by id ASC.
      • change the 'id ASC' to 'id DESC'
      • back up the module
        • Confirm that no errors were shown
      • unzip both of the activity backups and diff the two activities/lesson_xx/lesson.xml files
        • confirm that the order for the answers is reversed on the 'DESC' version
      • restore the ASC backup
        • confirm that the question appears as expected with all answers ordered correctly
      Show
      Open a course Turn editing on Add a new lesson activity Create a new 'Matching' question Add some answers for each field back up the module Confirm that no errors were shown Edit mod/lesson/backup/moodle2/backup_lesson_stepslib.php find the call to set_source_table for lesson_answers ordering by id ASC. change the 'id ASC' to 'id DESC' back up the module Confirm that no errors were shown unzip both of the activity backups and diff the two activities/lesson_xx/lesson.xml files confirm that the order for the answers is reversed on the 'DESC' version restore the ASC backup confirm that the question appears as expected with all answers ordered correctly

    Description

      There are several places where the order of data in a backup is important, but is not necessarily enforced. These cases are difficult to track down because the natural return order of the content tends to match the insert order, and thus the id for a majority of the time.

      The attached patch enforces a sort order on the 'id' field which should satisfy a majority of cases.
      Where this is insufficient, it's possible to supply the sortby field to the set_source_table() function call.

      Attachments

        Issue Links

          Activity

            People

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Dan Poltawski Dan Poltawski
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Adrian Greeve Adrian Greeve
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Clockify

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.