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

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.4, 2.2.1, 2.3.4, 2.4.1, 2.5
    • Fix Version/s: 2.5
    • Component/s: Backup
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      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
    • Workaround:
      Hide

      Find and fix every occurrence of this issue individually

      Show
      Find and fix every occurrence of this issue individually
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull Master Branch:

      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

              Assignee:
              dobedobedoh Andrew Nicols
              Reporter:
              dobedobedoh Andrew Nicols
              Peer reviewer:
              Dan Poltawski
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Adrian Greeve
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/May/13