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

Option to not include legacy course files in backup and restore process

    XMLWordPrintable

Details

    • MOODLE_310_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_400_STABLE
    • MOODLE_310_STABLE
    • MDL-68702-Master
    • Hide
      Setup
      1. Allow "legacyfilesinnewcourses" : /admin/settings.php?section=managerepositoriescommon
      Include/Exclude legacy files during the import process:
      1. Create a course with "Legacy course files" enabled. (Course A)
      2. On Course A's homepage, open the cog menu and click "Legacy course files"
      3. Add some files to the legacy course file of course A
      4. Create another course (Course B)
      5. In course B, import data from course A  with "Include legacy course file" enabled
      6. On Course B's homepage, open the cog menu.
      7. Confirm that you see "Legacy course files on the menu.
      8. Click "Legacy course files"
      9. Confirm that the legacy course files have been imported for Course B
      10. Create another course (Course C) with "Legacy course files" enabled.
      11. In course C, import data from course A  with "Include legacy course file" disabled
      12. On Course C's homepage, open the cog menu.
      13. Click "Legacy course files"
      14. Confirm that no legacy course files have been imported.
      Include/Exclude legacy files during backup process
      1. Backup Course A "Include legacy files" enabled
      2. Restore the backup course into a new course (default setting). Let's call this Course A1.
      3. Confirm that Course A1 has legacy course files.
      4. Backup course A "Include legacy files" disabled
      5. Restore the backup course into a new course (default setting). Let's call this Course A2
      6. Confirm that Course A2 doesn't have legacy course files.
      Include/Exclude legacy files during the automated backup process
      1. Set up outgoing email (e.g. using Mailcatcher or MailHog).
      2. Go to "Site administration / Courses / Backups / Automated backup setup"
      3. Set "Active" (backup | backup_auto_active) to "Manual"
      4. Select all days for "Schedule" (backup | backup_auto_weekdays)
      5. Select the closest time for "Execute at" (backup | backup_auto_hour). E.g. if it's currently 14:08, select 14:10 or 14:15).
      6. Make sure "Include legacy files" (backup | backup_auto_legacyfiles) is enabled
      7. Save the changes.
      8. Open a terminal window and go to your Moodle instance's root directory.
      9. Once the time passes the specified date/time in "Execute at", run the automated backup script to queue the backup adhoc task.

        php admin/cli/automated_backups.php

      10. Run the adhoc tasks

        php admin/cli/adhoc_task.php -e

        You should see something like "Processing automated backup for course: [COURSE NAME]" during the task execution.

      1. Go to Course A's homepage.
      2. Open the cog menu and press "Restore"
      3. Restore the automated backup into a new course (default setting). Let's call this Course A11.
      4. Confirm that Course A11 has legacy course files.
      5. Go back to "Site administration / Courses / Backups / Automated backup setup"
      6. Disable "Include legacy files"
      7. Save the changes.
      8. Using your preferred DB manipulation software (e.g. phppgadmin for Postgres, etc.), set the "nextstarttime" to 1 for the "mdl_backup_courses" table. e.g.

        UPDATE mdl_backup_courses SET nextstarttime = 1;
        

      9. Back on the terminal window, trigger the automated backup.

        php admin/cli/automated_backups.php
        php admin/cli/adhoc_task.php -e
        

      10. Restore the new automated backup file to a new course. Let's call this Course A12.
      11. Confirm that Course A12 doesn't have legacy course files.
         
      Exclude legacy files during the restore process
      1. Restore Course A's backup into a new course. Make sure to untick "Include legacy files". Let's call this Course A3.
      2. Confirm that Course A3 doesn't have legacy course files.
      Show
      Setup Allow "legacyfilesinnewcourses" : /admin/settings.php?section=managerepositoriescommon Include/Exclude legacy files during the import process: Create a course with " Legacy course files " enabled. (Course A) On Course A's homepage, open the cog menu and click " Legacy course files " Add some files to the legacy course file of course A Create another course (Course B) In course B, import data from course A  with "Include legacy course file" enabled On Course B's homepage, open the cog menu. Confirm that you see " Legacy course files on the menu. Click " Legacy course files " Confirm that the legacy course files have been imported for Course B Create another course (Course C) with " Legacy course files " enabled. In course C, import data from course A  with "Include legacy course file" disabled On Course C's homepage, open the cog menu. Click " Legacy course files " Confirm that no legacy course files have been imported. Include/Exclude legacy files during backup process Backup Course A "Include legacy files" enabled Restore the backup course into a new course (default setting). Let's call this Course A1. Confirm that Course A1 has legacy course files. Backup course A "Include legacy files" disabled Restore the backup course into a new course (default setting). Let's call this Course A2 Confirm that Course A2 doesn't have legacy course files. Include/Exclude legacy files during the automated backup process Set up outgoing email (e.g. using Mailcatcher or MailHog). Go to " Site administration / Courses / Backups / Automated backup setup " Set " Active " ( backup | backup_auto_active ) to " Manual " Select all days for " Schedule " ( backup | backup_auto_weekdays ) Select the closest time for " Execute at " (backup | backup_auto_hour). E.g. if it's currently 14:08, select 14:10 or 14:15). Make sure " Include legacy files " ( backup | backup_auto_legacyfiles ) is enabled Save the changes. Open a terminal window and go to your Moodle instance's root directory. Once the time passes the specified date/time in " Execute at ", run the automated backup script to queue the backup adhoc task. php admin/cli/automated_backups.php Run the adhoc tasks php admin/cli/adhoc_task.php -e You should see something like " Processing automated backup for course: [COURSE NAME] " during the task execution. Go to Course A's homepage. Open the cog menu and press " Restore " Restore the automated backup into a new course (default setting). Let's call this Course A11. Confirm that Course A11 has legacy course files. Go back to " Site administration / Courses / Backups / Automated backup setup " Disable " Include legacy files " Save the changes. Using your preferred DB manipulation software (e.g. phppgadmin for Postgres, etc.), set the " nextstarttime " to 1 for the " mdl_backup_courses " table. e.g. UPDATE mdl_backup_courses SET nextstarttime = 1; Back on the terminal window, trigger the automated backup. php admin/cli/automated_backups.php php admin/cli/adhoc_task.php -e Restore the new automated backup file to a new course. Let's call this Course A12. Confirm that Course A12 doesn't have legacy course files.   Exclude legacy files during the restore process Restore Course A's backup into a new course. Make sure to untick "Include legacy files". Let's call this Course A3. Confirm that Course A3 doesn't have legacy course files.

    Description

      When we backup and restore a course which has legacy course files, these files are are brought forward to new course.

      In some cases, there are too many legacy course files and they are not in used, we would like to have a option to get rid of those files during backup/restore process.

      If there are files being in the courses, we may copy back those files from original courses.

      Related forum: https://moodle.org/mod/forum/discuss.php?d=349988

       

       

       

       

      Attachments

        1. Screenshot_1.jpg
          Screenshot_1.jpg
          50 kB
        2. Screenshot_2.jpg
          Screenshot_2.jpg
          33 kB
        3. Screenshot_3.jpg
          Screenshot_3.jpg
          63 kB
        4. Screenshot_4.jpg
          Screenshot_4.jpg
          18 kB

        Issue Links

          Activity

            People

              Nguyen Nathan Nguyen
              Nguyen Nathan Nguyen
              Mihail Geshoski Mihail Geshoski
              Jun Pataleta Jun Pataleta
              Janelle Barcega Janelle Barcega
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/Nov/20

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 6 hours, 20 minutes
                  1d 6h 20m