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

Automated backup reports email should be send after all backups are done (all "Ad-hoc task to save pending course")

XMLWordPrintable

    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-69615-402
    • MDL-69615-403
    • MDL-69615-main
    • Hide

      PHPUnit

      Make sure all the tests in 

      lib/tests/task/automated_backup_task_test.php

      are passed

      Manual testing

      Initial setup

      1. Setup Mailpit: https://github.com/axllent/mailpit
      2. Add below config to config.php
        • // Mailpit.
          $CFG->smtphosts = 'localhost:1025';
          $CFG->smtpsecure = '';
          $CFG->smtpauthtype = 'LOGIN';
          $CFG->smtpuser = '';
          $CFG->smtppass = ''; 

      3. Make sure your mdl_backup_courses table is empty. It will be easier to verify the changes. (You can use any Database tool to delete the records).
      4. Login as admin.
      5. Create two courses called: Backup 1 and Backup 2. (Take note of these course ids).
      6. Navigate to Site Administration> Courses > Backups > Automated backup setup and set the following settings:
        • Active: Enabled
        • Schedule: Check all days.
        • Skip courses not modified since: Never
        • Skip courses not modified since previous backup: Un-check

          Testing

      7. Open your browser and navigate to: http://localhost:8025/ (Mailpit server)
      8. Open your terminal.
      9. Run below command
        • php admin/cli/scheduled_task.php --execute='\core\task\automated_backup_task'

      10. Open your Database tool (Ex: Dbeaver) and run
        • select * from mdl_backup_courses mbc

      11. Verify that you will see three records. Two of them have the course ids that we created before.
      12. Run the following SQL to update the nextstarttime to the past
        • update mdl_backup_courses set nextstarttime = 1703034000

      13. Switch to your terminal and run the below command
        • php admin/cli/scheduled_task.php --execute='\core\task\automated_backup_task'

      14. Verify that you will see something like:
        • Putting backup of course id X in adhoc task queue (X are the course ids that we created before)

      15. Verify that you will see: Automated backups complete.
      16. Switch to Mailpit browser.
      17. Verify that you don't see any backup report emails.
      18. Switch to your terminal and run the below command
        • php admin/cli/scheduled_task.php --execute='\core\task\automated_backup_report_task'

      19. Switch to Mailpit browser.
      20. Verify that you don't see any backup report emails.
      21. Switch to your terminal and run the below command
        • php admin/cli/adhoc_task.php --execute

      22. Switch to Mailpit browser.
      23. Verify that you don't see any backup report emails.
      24. Switch to your terminal and run the below command
        • php admin/cli/scheduled_task.php --execute='\core\task\automated_backup_report_task'

      25. Switch to Mailpit browser.
      26. Verify that you will see one Automated backup status email.
      27. Click on that email to see the details.
      28. Verify that content as below:
        • Courses: 3 (One is for the Site course + 2 newly created courses)
        • OK: 3 (One is for the Site course + 2 newly created courses)
        • Course backup ad hoc task pending: 0
      29. Remember to revert all the configuration changes.
      Show
      PHPUnit Make sure all the tests in  lib/tests/task/automated_backup_task_test.php are passed Manual testing Initial setup Setup Mailpit: https://github.com/axllent/mailpit Add below config to config.php // Mailpit. $CFG->smtphosts = 'localhost:1025' ; $CFG->smtpsecure = '' ; $CFG->smtpauthtype = 'LOGIN' ; $CFG->smtpuser = '' ; $CFG->smtppass = '' ; Make sure your mdl_backup_courses table is empty. It will be easier to verify the changes. (You can use any Database tool to delete the records). Login as admin. Create two courses called: Backup 1 and Backup 2. (Take note of these course ids). Navigate to Site Administration> Courses > Backups > Automated backup setup and set the following settings: Active: Enabled Schedule: Check all days. Skip courses not modified since: Never Skip courses not modified since previous backup: Un-check Testing Open your browser and navigate to: http://localhost:8025/ (Mailpit server) Open your terminal. Run below command php admin/cli/scheduled_task.php --execute= '\core\task\automated_backup_task' Open your Database tool (Ex: Dbeaver) and run select * from mdl_backup_courses mbc Verify that you will see three records. Two of them have the course ids that we created before. Run the following SQL to update the nextstarttime to the past update mdl_backup_courses set nextstarttime = 1703034000 Switch to your terminal and run the below command php admin/cli/scheduled_task.php --execute= '\core\task\automated_backup_task' Verify that you will see something like: Putting backup of course id X in adhoc task queue (X are the course ids that we created before) Verify that you will see: Automated backups complete. Switch to Mailpit browser. Verify that you don't see any backup report emails. Switch to your terminal and run the below command php admin/cli/scheduled_task.php --execute= '\core\task\automated_backup_report_task' Switch to Mailpit browser. Verify that you don't see any backup report emails. Switch to your terminal and run the below command php admin/cli/adhoc_task.php --execute Switch to Mailpit browser. Verify that you don't see any backup report emails. Switch to your terminal and run the below command php admin/cli/scheduled_task.php --execute= '\core\task\automated_backup_report_task' Switch to Mailpit browser. Verify that you will see one Automated backup status email. Click on that email to see the details. Verify that content as below: Courses: 3 (One is for the Site course + 2 newly created courses) OK: 3 (One is for the Site course + 2 newly created courses) Course backup ad hoc task pending: 0 Remember to revert all the configuration changes.
    • 6
    • Team Hedgehog 2023 Sprint 4.3, Team Hedgehog 2023 Review 4

      Hi there,

      We seem to be encountering an issue since upgrading to Moodle 3.9.1 in that the backup report emails have stopped reporting backed up courses as "OK" and all of them seem to be classed as pending. E.G:

      Summary

      Courses: 247
      OK: 0
      Skipped: 194
      Error: 0
      Unfinished: 0
      Course backup ad hoc task pending: 53
      Warning: 0
      Automated backup pending: 0

      Backup completed successfully

      Whereas 3.8 would report:

      Courses: 246
      OK: 38
      Skipped: 208
      Error: 0
      Unfinished: 0
      Warning: 0
      Automated backup pending: 0

      Backup completed successfully

       

      I can see that the Course backup ad hoc category is new so this perhaps may be to do with a change to the way the backups run. The actual back-ups themselves when checked in the morning do report "OK" in the backup reports area so it seems to be an issue particular to the email reports. It is confusing and a bit misleading for this to report as none of the back-ups being "OK" however when it seems they will be once they are complete and no longer pending. 

      Perhaps it's an issue to do with when the emails are being sent out, could they be sent out later in the back-up process if that's the issue?

      Similar forum post: https://moodle.org/mod/forum/discuss.php?d=407376#p1644287

      And (for french reading people) : https://moodle.org/mod/forum/discuss.php?d=407360

      Let me know if you need any more details regarding this.

            huongn@moodle.com Huong Nguyen
            sgodbehere Samuel Godbehere
            Meirza Meirza
            Ilya Tregubov Ilya Tregubov
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            22 Vote for this issue
            Watchers:
            32 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 days, 5 hours, 57 minutes
                4d 5h 57m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.