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

Recycle bin backs up unfinished course restores

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1, 3.1 regressions
    • Fix Version/s: 3.1.2
    • Component/s: Backup
    • Labels:
    • Testing Instructions:
      Hide

      Web based restore

      1. Comment out the if clause at this line
      2. Browse to "Site administration" > "Plugins" > "Admin tools" > "Recycle bin"
      3. Turn off auto hide
      4. Create multiple choice question in the "Category for system"
      5. Create a course with a quiz, add this question to the quiz
      6. Turn developer debugging mode off
      7. Backup and restore the course
      8. You will see an error, that's OK
      9. Navigate to "Site administration" > "Courses" > "Manage courses and categories"
      10. Click on the category for the course you backed up (probably "Miscellaneous"
      11. Open the recycle bin (it should be in the settings block under the category menu)
      12. Verify there is no mention of unfinished restores in it
      13. Uncomment the if from step 1
      14. Reattempt the restore
      15. Verify it completed successfully and there is nothing odd in the recycle bin

      CLI Restore

      1. Comment out the if again
      2. Follow the instructions here to make a CLI script. Note that the documentation is wrong, and you must configure $CFG->tempdir in your config.php and place your extracted backup in a folder there (the .mbz backups are just .tar.gz files)
      3. Execute the backup, you should get the error and the course should not be in the recycle bin
      4. Uncomment the if
      5. Restore the course
      6. Verify it completed successfully and there is nothing odd in the recycle bin
      Show
      Web based restore Comment out the if clause at this line Browse to "Site administration" > "Plugins" > "Admin tools" > "Recycle bin" Turn off auto hide Create multiple choice question in the "Category for system" Create a course with a quiz, add this question to the quiz Turn developer debugging mode off Backup and restore the course You will see an error, that's OK Navigate to "Site administration" > "Courses" > "Manage courses and categories" Click on the category for the course you backed up (probably "Miscellaneous" Open the recycle bin (it should be in the settings block under the category menu) Verify there is no mention of unfinished restores in it Uncomment the if from step 1 Reattempt the restore Verify it completed successfully and there is nothing odd in the recycle bin CLI Restore Comment out the if again Follow the instructions here to make a CLI script. Note that the documentation is wrong, and you must configure $CFG->tempdir in your config.php and place your extracted backup in a folder there (the .mbz backups are just .tar.gz files) Execute the backup, you should get the error and the course should not be in the recycle bin Uncomment the if Restore the course Verify it completed successfully and there is nothing odd in the recycle bin
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull Master Branch:
      MDL-54771-master
    • Sprint:
      3.2 Sprint 2

      Description

      It looks like when restore process was aborted because of an error/exception the recycle bin hook is still executed and we backup unfinished restore. This looks a bit odd

      To reproduce:

      1. Hack the restore code somewhere to insert an exception. In my case I was testing MDL-54769
      2. Backup and restore course, the restore should fail with the exception
      3. Go to the course category recycle bin - you will see the unfinished restore course there

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/Sep/16