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

Automated Backup fails when using "course backup area" with an empty directory config

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.3, 2.8.1, 2.9
    • Fix Version/s: 2.7.4, 2.8.2
    • Component/s: Backup
    • Labels:
    • Testing Instructions:
      Hide
      1. Turn on full debugging
      2. Go to Site administration / ►Courses / ►Backups / ►Automated backup setup
      3. Set the following:-
        1. backup_auto_active - Enabled
        2. backup_auto_storage - Specified directory for automated backups
        3. backup_auto_destination - Path to a folder that doesn't exist
        4. Use course name in backup filename - checked
        5. backup_auto_skip_modif_days - never
        6. backup_auto_skip_modif_prev - unchecked
      4. Run php php admin/cli/automated_backups.php
      5. Make sure you get logs like:-

        Specified backup directory is not writable -  /ankit/moodles/stable_master/backup
        

      6. Go to Site admin>reports>backups
      7. Make sure status of all courses that were backed up is "Error"
      8. Make sure no new backup is generated in "course automated backup area" (click on course >restore)
      9. set 'backup_auto_destination' to null, by making the input box empty.
      10. Run php php admin/cli/automated_backups.php
      11. Make sure you get logs like:-

        No directory specified for automated backups
        

      12. Go to Site admin>reports>backups
      13. Make sure status of all courses that were backed up is "warning"
      14. Check course backup area, make sure there is a new backup.
      15. Now test again with a proper writable directory and make sure backups are generated properly.
      16. Now repeat everything with 'backup_auto_storage' set to "Course backup filearea and specified directory"
      17. Now set 'backup_autostorage' to 'course backup filearea' and run the backup tool. Make sure no errors are noticed in the out put. View the backup report and make sure the status of backups are "OK".
      18. Do exploratory testing with automated backups to make sure nothing is broken.
      Show
      Turn on full debugging Go to Site administration / ►Courses / ►Backups / ►Automated backup setup Set the following:- backup_auto_active - Enabled backup_auto_storage - Specified directory for automated backups backup_auto_destination - Path to a folder that doesn't exist Use course name in backup filename - checked backup_auto_skip_modif_days - never backup_auto_skip_modif_prev - unchecked Run php php admin/cli/automated_backups.php Make sure you get logs like:- Specified backup directory is not writable - /ankit/moodles/stable_master/backup Go to Site admin>reports>backups Make sure status of all courses that were backed up is "Error" Make sure no new backup is generated in "course automated backup area" (click on course >restore) set 'backup_auto_destination' to null, by making the input box empty. Run php php admin/cli/automated_backups.php Make sure you get logs like:- No directory specified for automated backups Go to Site admin>reports>backups Make sure status of all courses that were backed up is "warning" Check course backup area, make sure there is a new backup. Now test again with a proper writable directory and make sure backups are generated properly. Now repeat everything with 'backup_auto_storage' set to "Course backup filearea and specified directory" Now set 'backup_autostorage' to 'course backup filearea' and run the backup tool. Make sure no errors are noticed in the out put. View the backup report and make sure the status of backups are "OK". Do exploratory testing with automated backups to make sure nothing is broken.
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull Master Branch:
      MDL-48556-master
    • Sprint:
      BACKEND Sprint 19

      Description

      We have incorrect precedence of && and || operators in automated backups.
      In backup/util/helper/backup_cron_helper.class.php we have

                  } else if (!file_exists($dir) || !is_dir($dir) || !is_writable($dir) && $storage !== 0) {
      

      which should be

      } else if ((!file_exists($dir) || !is_dir($dir) || !is_writable($dir)) && $storage !== 0) {
      

      Since that branch should be executed only if $storage !== 0

      This leads to the problem that when backup_auto_storage is set to "course backup filearea" and backup_auto_destination is empty (i.e. the default settings), no backups happen since $storage is set to 0 in this case.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/Jan/15