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

Remove aging automated backups with a minimum to keep limit

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.0
    • Component/s: Backup
    • Testing Instructions:
      Hide

      Test renaming of backup_auto_keep setting

      • On master branch, change the value of the backup_auto_keep config to 5.
      • Checkout the MDL-50602-master and do the upgrade.
      • Assert that backup_auto_max_kept value is set to 5.

      Unit tests

      • Run the following unit tests :

        vendor/bin/phpunit backup_cron_helper_testcase backup/util/helper/tests/cronhelper_test.php
        

      Test with Automated backup storage set to 'Course backup area'

      1. When the feature is deactivated the automated backup run normally.

      • Set parameters in Site administration > Courses > Backup > Automated backup setup
        • Automated backup storage (backup | backup_auto_storage): Course backup area
        • Maximum number of backups kept (backup | backup_auto_max_kept) : 5
        • Delete backups older than (backup | backup_auto_delete_days) : Never
        • Minimum number of backups kept (backup | backup_auto_min_kept) : None
      • Create a new course with an activity (ex. label)
      • Run the automated backup : php admin/cli/automated_backups.php
      • Check in Course administration > Restore
        • There is one backup with current date in the list.
      • Repeat the following instructions after changing the system date: (current +1 days, current +2 days, current +5 days, current +7 days)
        • Run the automated backup : php admin/cli/automated_backups.php
        • Check in Course administration > Restore
          • There is one more backup with the specified system date in the list.
      • Change the system date to current + 8 days
      • Run the automated backup : php admin/cli/automated_backups.php
      • Check in Course administration > Restore
        • You still have 5 backups but the older one has been deleted.

      2. When the 'Delete backups older than' is activated, only backups older than a specified days are deleted.

      • Set parameters in Site administration > Courses > Backup > Automated backup setup
        • Delete backups older than (backup | backup_auto_delete_days) : 5 days
        • Minimum number of backups kept (backup | backup_auto_min_kept) : 2
      • Change the system date current + 11 days
      • Run the automated backup : php admin/cli/automated_backups.php
      • Check in Course administration > Restore
        • The list contains 3 backups. Only backups older than 5 days are deleted.

      3. When the 'Minimum number of backups kept' is activated, backups are not deleted even if backups are older than a specified days.

      • Change the system date current + 20 days
      • Run the automated backup : php admin/cli/automated_backups.php
      • Check in Course administration > Restore
        • The list contains the 2 most recent backups.

      Repeat the tests with Automated backup storage set to 'Specified directory for automated backups'

      • Create a directory to store the backups.
      • Follow the same preceding steps but change the following settings in "Site administration > Courses > Backup > Automated backup setup"
        • Automated backup storage (backup | backup_auto_storage): Specified directory for automated backups
        • Save to : the directory you have created.
      • Check the backups creation and removal in the specified directory
      Show
      Test renaming of backup_auto_keep setting On master branch, change the value of the backup_auto_keep config to 5. Checkout the MDL-50602 -master and do the upgrade. Assert that backup_auto_max_kept value is set to 5. Unit tests Run the following unit tests : vendor/bin/phpunit backup_cron_helper_testcase backup/util/helper/tests/cronhelper_test.php Test with Automated backup storage set to 'Course backup area' 1. When the feature is deactivated the automated backup run normally. Set parameters in Site administration > Courses > Backup > Automated backup setup Automated backup storage (backup | backup_auto_storage): Course backup area Maximum number of backups kept (backup | backup_auto_max_kept) : 5 Delete backups older than (backup | backup_auto_delete_days) : Never Minimum number of backups kept (backup | backup_auto_min_kept) : None Create a new course with an activity (ex. label) Run the automated backup : php admin/cli/automated_backups.php Check in Course administration > Restore There is one backup with current date in the list. Repeat the following instructions after changing the system date: (current +1 days, current +2 days, current +5 days, current +7 days) Run the automated backup : php admin/cli/automated_backups.php Check in Course administration > Restore There is one more backup with the specified system date in the list. Change the system date to current + 8 days Run the automated backup : php admin/cli/automated_backups.php Check in Course administration > Restore You still have 5 backups but the older one has been deleted. 2. When the 'Delete backups older than' is activated, only backups older than a specified days are deleted. Set parameters in Site administration > Courses > Backup > Automated backup setup Delete backups older than (backup | backup_auto_delete_days) : 5 days Minimum number of backups kept (backup | backup_auto_min_kept) : 2 Change the system date current + 11 days Run the automated backup : php admin/cli/automated_backups.php Check in Course administration > Restore The list contains 3 backups. Only backups older than 5 days are deleted. 3. When the 'Minimum number of backups kept' is activated, backups are not deleted even if backups are older than a specified days. Change the system date current + 20 days Run the automated backup : php admin/cli/automated_backups.php Check in Course administration > Restore The list contains the 2 most recent backups. Repeat the tests with Automated backup storage set to 'Specified directory for automated backups' Create a directory to store the backups. Follow the same preceding steps but change the following settings in "Site administration > Courses > Backup > Automated backup setup" Automated backup storage (backup | backup_auto_storage): Specified directory for automated backups Save to : the directory you have created. Check the backups creation and removal in the specified directory
    • Affected Branches:
      MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-50602-master

      Description

      The purpose of this feature is to remove the automated backups when they are older than a specified period. That way it will be possible to retrieve the disk space used by courses that are no more active.

      Two settings will control the process:

      • one to indicate after how many days a backup can be removed. Setting a value will activate the remove of old backups
      • one to indicate the minimun number of old backups to keep.

        Attachments

        1. MDL-50602_settings.png
          MDL-50602_settings.png
          15 kB
        2. MDL-50602_settings2.png
          MDL-50602_settings2.png
          19 kB
        3. MDL-50602_settings3.png
          MDL-50602_settings3.png
          31 kB
        4. MDL-50602.PNG
          MDL-50602.PNG
          23 kB

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  16/Nov/15