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

Scheduled Tasks - Cron syntax inconsistent

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.2.3, 3.3.3, 3.4, DEV backlog
    • Fix Version/s: None
    • Component/s: Administration, Tasks
    • Labels:
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE

      Description

      Validation in the scheduled tasks form prevents using more "complex" values using standard cron syntax.

      Sources:
      https://github.com/moodle/moodle/blob/master/lib/classes/task/scheduled_task.php

      • eval_cron_field($field, $min, $max)

      https://github.com/moodle/moodle/blob/master/admin/tool/task/classes/edit_scheduled_task_form.php

      • validate_fields($field, $value)

      A valid hour value in "eval_cron_field" is "0-3,5-7", which is evaluated to to "0,1,2,3,5,6,7".

      But the form for a scheduled task tells me the above is invalid syntax in "validate_fields".
      It only allows simple syntax (commas XOR dashes).

      Fix:

      • Extract regular expression constants for the cron syntax
      • Use those constants in both instances

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              poggenpohlda Daniel Poggenpohl
              Participants:
              Component watchers:
              Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amaia Anabitarte, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: