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

Fix setting disabled task as enabled VIA config override

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.11
    • Fix Version/s: 3.11
    • Component/s: Tasks
    • Labels:
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_311_STABLE
    • Fixed Branches:
      MOODLE_311_STABLE
    • Pull 3.11 Branch:
      MDL-70341-311-task-override-fix-disabled
    • Pull Master Branch:
      MDL-70341-task-override-fix-disabled

      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

              Assignee:
              jamie.stamp Jamie Stamp
              Reporter:
              jamie.stamp Jamie Stamp
              Peer reviewer:
              Brendan Heywood Brendan Heywood
              Integrator:
              Víctor Déniz Falcón Víctor Déniz Falcón
              Tester:
              Janelle Barcega Janelle Barcega
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/May/21

                  Time Tracking

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