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

Fix setting disabled task as enabled VIA config override

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.11
    • 3.11
    • Tasks
    • MOODLE_311_STABLE
    • MOODLE_311_STABLE
    • MDL-70341-311-task-override-fix-disabled
    • MDL-70341-task-override-fix-disabled
    • Hide
      1. Start with a clean moodle with all the default tasks schedules.
      2. Navigate to the Scheduled Tasks UI ('/admin/tool/task/scheduledtasks.php').
      3. Disable the '\assignfeedback_editpdf\task\convert_submissions' task from the scheduled task edit page and set the minute value to '*/1'.
      4. Run the cron to execute the scheduled tasks 'php admin/cli/cron.php'.
      5. Verify that '\assignfeedback_editpdf\task\convert_submissions' has not yet run.
      6. Add the following override to the config.php file:

        $CFG->scheduled_tasks = [     
            '\assignfeedback_editpdf\task\convert_submissions' => [
                 'schedule' => '* * * * *',
                 'disabled' => 0,
            ]
        ]; 

      7. Verify that the 'Next run' column no longer reads 'Task disabled'.
      8. Note the 'Last run' time. When the column reads 'ASAP' run the cron again 'php admin/cli/cron.php'.
      9. Verify the last run time has updated.
      10. Update the override in config.php to set the task as disabled:

        $CFG->scheduled_tasks = [     
            '\assignfeedback_editpdf\task\convert_submissions' => [
                 'schedule' => '* * * * *',
                 'disabled' => 1,
            ]
        ]; 

      11. Verify that the task is disabled in the UI.
      12. Note the 'Last run' time and run the cron again 'php admin/cli/cron.php'.
      13. Verify that the last run time did not update.
      Show
      Start with a clean moodle with all the default tasks schedules. Navigate to the Scheduled Tasks UI ('/admin/tool/task/scheduledtasks.php'). Disable the '\assignfeedback_editpdf\task\convert_submissions' task from the scheduled task edit page and set the minute value to '*/1'. Run the cron to execute the scheduled tasks 'php admin/cli/cron.php'. Verify that '\assignfeedback_editpdf\task\convert_submissions' has not yet run. Add the following override to the config.php file: $CFG->scheduled_tasks = [     '\assignfeedback_editpdf\task\convert_submissions' => [     'schedule' => '* * * * *',          'disabled' => 0, ] ]; Verify that the 'Next run' column no longer reads 'Task disabled'. Note the 'Last run' time. When the column reads 'ASAP' run the cron again 'php admin/cli/cron.php'. Verify the last run time has updated. Update the override in config.php to set the task as disabled: $CFG->scheduled_tasks = [     '\assignfeedback_editpdf\task\convert_submissions' => [     'schedule' => '* * * * *',          'disabled' => 1, ] ]; Verify that the task is disabled in the UI. Note the 'Last run' time and run the cron again 'php admin/cli/cron.php'. Verify that the last run time did not update.

    Description

      There is an issue in the new scheduled task override functionality that prevents a task that's disabled in the DB from running, even when the task is enabled VIA the config.php override.

      Attachments

        Issue Links

          Activity

            People

              jamie.stamp Jamie Stamp
              jamie.stamp Jamie Stamp
              Brendan Heywood Brendan Heywood
              Victor Déniz Falcón Victor Déniz Falcón
              Janelle Barcega Janelle Barcega
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                17/May/21

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h