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

Make resetting of large courses asynchronous

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 5.0
    • Course
    • MOODLE_500_STABLE
    • MDL-85517_500_STABLE
    • MDL-85517_main
    • Hide

      1. Create 2 test courses, one extra small and one medium:

      • php admin/tool/generator/cli/maketestcourse.php --shortname=XSmall --size=XS
      • php admin/tool/generator/cli/maketestcourse.php --shortname=Medium --size=M

      2. Login as admin
      3. Visit the "XSmall" course
      4. Navigate to More > Course reuse > Reset
      5. Select all options and click "Reset course"
      6. Confirm that the reset process completes in a few seconds, and the results are displayed.
      7. Visit the "Medium" course
      8. Navigate to More > Course reuse > Reset
      9. Select all options and click "Reset course"
      10. Confirm That an indicator is shown explaining that the course is being reset.
      11. Reload the page
      12. Confirm That the indicator is still shown, instead of the Reset form.
      13. Run the following command line to trigger the ad-hoc task: `php admin/cli/adhoc_task.php --class='\core_course\task\reset_course' --execute`
      14. Confirm that the reset process starts, with a progress bar displayed both in the CLI output, and in the indictor on the web page.
      15. Wait for the command to complete, which will take about 2 minutes.
      16. Confirm that the results are displayed in the command line output one the process completes.
      17. Confirm that the web page is redirected to the course page once the process completes.
      18. Navigate to the course participants page
      19. Confirm that there are no students enrolled, as the course has been reset.

      Show
      1. Create 2 test courses, one extra small and one medium: php admin/tool/generator/cli/maketestcourse.php --shortname=XSmall --size=XS php admin/tool/generator/cli/maketestcourse.php --shortname=Medium --size=M 2. Login as admin 3. Visit the "XSmall" course 4. Navigate to More > Course reuse > Reset 5. Select all options and click "Reset course" 6. Confirm that the reset process completes in a few seconds, and the results are displayed. 7. Visit the "Medium" course 8. Navigate to More > Course reuse > Reset 9. Select all options and click "Reset course" 10. Confirm That an indicator is shown explaining that the course is being reset. 11. Reload the page 12. Confirm That the indicator is still shown, instead of the Reset form. 13. Run the following command line to trigger the ad-hoc task: `php admin/cli/adhoc_task.php --class='\core_course\task\reset_course' --execute` 14. Confirm that the reset process starts, with a progress bar displayed both in the CLI output, and in the indictor on the web page. 15. Wait for the command to complete, which will take about 2 minutes. 16. Confirm that the results are displayed in the command line output one the process completes. 17. Confirm that the web page is redirected to the course page once the process completes. 18. Navigate to the course participants page 19. Confirm that there are no students enrolled, as the course has been reset.
    • Hide

      Code verified against automated checks.

      Checked MDL-85517 using repository: https://github.com/marxjohnson/moodle.git

      More information about this report

      Built on: Tue May 20 14:17:24 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-85517 using repository: https://github.com/marxjohnson/moodle.git MOODLE_500_STABLE (0 errors / 0 warnings) [branch: MDL-85517_500_STABLE | CI Job ] main (0 errors / 0 warnings) [branch: MDL-85517_main | CI Job ] More information about this report Built on: Tue May 20 14:17:24 UTC 2025

      Resetting courses is performed by a synchronous request upon reset of the Reset Course form. Depending on the size of the course, this may result in a long request lasting several minutes, which may time out on the frontend and/or exceed the PHP time limit.

      As we did with MDL-81714 for regrading of large courses, we can resolve this by making the reset process asynchronous.

      Steps to reproduce:
      1. Create 2 test courses, one extra small and one medium:

      • php admin/tool/generator/cli/maketestcourse.php --shortname=XSmall --size=XS
      • php admin/tool/generator/cli/maketestcourse.php --shortname=Medium --size=M

      2. Login as admin
      3. Visit the "Small" course
      4. Navigate to More > Course reuse > Reset
      5. Select all options and click "Reset course"
      6. Confirm that the reset process completes in a few seconds, and the results are displayed.
      7. Visit the "Medium" course
      8. Navigate to More > Course reuse > Reset
      9. Select all options and click "Reset course"
      10. Expected: The process completes and the results are displayed.
      Actual: The request runs for several minutes, and may time out depending on the server configuration.

            marxjohnson Mark Johnson
            marxjohnson Mark Johnson
            CMR CMR
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m

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