Commit Graph

20 Commits

Author SHA1 Message Date
sam marshall
ed46ee3dc7 MDL-79966 core_task: NEVER_RUN_TIME did not fit in 10 digits 2023-11-23 16:22:27 +00:00
sam marshall
1c4d433d5f MDL-79966 core_task: Scheduled task timing (crontab fields) is wrong 2023-11-20 17:13:21 +00:00
Paul Holden
75c36558b6 MDL-79186 task: fix evaluation of 'X/Y' cron field format.
The above syntax is defined as supported by the class, for example the
format '5/10' means:

"At every 10th <unit> from 5 through <max>."

It is analogous to '5-<max>/10'.
2023-09-11 09:22:17 +01:00
Charles Fulton
1af1cd3b49 MDL-79090 task: add enable and disable cli commands 2023-08-28 10:33:25 -04:00
Paul Holden
d0b5241786 MDL-75256 task: move abstract get_name method to base class.
Allow adhoc tasks to implement this method, so they too can have
descriptive names for themselves. Default implementation added to
return the class name itself.
2022-07-22 09:13:53 +01:00
Jordi Pujol Ahulló
21f73b29c1 MDL-69764 tool_task: unify crontab verification
Use scheduled_task crontab field verification in
admin/tool/task to unify how Moodle deals with
crontab definition and its verification.
This helps remove duplicated code and fix
crontab definition not allowed in the web form,
but actually was valid.

Updated crontab fields precision on task_scheduled
table to have enough room for the worst case:
all possible different values separated by comma.
2022-02-17 13:24:31 +01:00
David Mudrák
296f714916 MDL-73765 task: Fix calculation of random minute in the task schedule
The random minute was incorrectly set to a random value from the range
0 - 23 instead of 0 - 59 due to this copy & paste mistake.
2022-02-03 19:22:58 +01:00
Jordi Pujol Ahulló
9c4510a358 MDL-70230 admin: add setting sched. task status
When defining settings that are used by scheduled tasks,
it is also useful, or even needed, to know the status
of that scheduled task to have the whole big picture of
that part of the system.

Based on the admin_setting_description, this new setting
reports its name, its status, a link to the configuration.

When adding a new setting of this type, the user can add
an extra description field to complete the whole meaning.
2021-06-04 08:12:16 +02:00
Jamie Stamp
3a232840a5 MDL-65843 tasks: Allow schedules to be overridden in config 2020-11-18 12:44:05 +00:00
Tim Hunt
6fdc0f8796 MDL-68256 task admin: usability improvements
In the table that lists the scheduled tasks:

1. There are badges to show which components are disabled.
2. The plugin name (e.g. auth_ldap) is shown as well as the
   human-readable name (e.g. LDAP server).
3. Where a time column has a non-default value, it is highlighted
   and the default is shown.
4. If the fail-delay is non-zero, the cell is highlighted.
4. If you just interacted with a task (looked at or edited the settings,
   did Run now, or cleared the fail delay) that row is highlighted,
   and scrolled into view when the page loads.

To support this, some of the methods for loading the default tasks
have been extended with an optional argument to leave 'R' as 'R'
rather than replacing with a random number.

Also, mixed into this commit are a bunch of coding style improvements.
Sorry I did not separate them out, but ultimately this makes the
Moodle code better.
2020-03-28 18:40:51 +00:00
Petr Skoda
d6e7a63d9a MDL-49684 timezones: rewrite timezone support
This patch replaces all homegrown timezone
stuff with standard PHP date/time code.

The main change is the introduction of core_date
class that returns normalised user and server
timezones. From now on nobody should be using
$CFG->timezone or $user->timezone directly!

Other new features and fixes:
* admins are prompted for timezone during install
* editing of other users is finally fixed
* timezones are displayed in user profile
* new $this->setTimezone() in phpunit
* time locale is now automatically reset in phpunit
* timezone is now automatically reset in phpunit
* phpunit has Australia/Perth as default timezone
2015-04-06 13:53:51 +12:00
Andrew Davis
f47e4eb4a0 MDL-49070 core_registration: improved site registration scheduled task 2015-03-20 14:22:39 +08:00
Dan Poltawski
16078807f8 MDL-47221 task: allow 'random' time definitions
When working against external services it can be advantageous to not
have automated tasks all hit the service at the exact same time from
many different installations.

This change allows the use of 'R' in hour/minute fields of the scheduled
task definition so a task will be installed with a 'random' hour/minute
value for these sort of occasions.

Note that the task will be installed in the database with a defined
time, this simply randomises the time chosen when loading from the
definiton.
2014-10-05 14:27:04 +01:00
Damyon Wiese
fd57c17e2d MDL-46207 Tasks: Do not run tasks if their component is disabled.
This can be overridden on a per task basis by implementing:
get_run_if_component_disabled() in the scheduled task.
2014-07-21 15:01:54 +08:00
David Mudrák
dc561732b5 MDL-45813 Fix variable name in scheduled task 2014-06-09 09:46:13 +02:00
Petr Škoda
0a5aa65b53 MDL-44733 add support for disabling of scheduled tasks 2014-03-28 10:23:37 +08:00
Petr Škoda
b7f7c3bcf2 MDL-44639 fix some phpdocs issues in tasks classes
There is also one extra () to improve code readability.
2014-03-20 17:32:56 +08:00
Damyon Wiese
bbd9226cb8 MDL-44608 Scheduled Tasks: Use $CFG->timezone if it is set to schedule tasks 2014-03-14 11:47:03 +08:00
Damyon Wiese
76e4de31cc MDL-25505 Tasks: Fix for scheduled task bug on the last day of the month.
On the last day of the month, the scheduled task next time calculation was wrapping
to the 0th day of the month (which is not a valid day).
2014-02-28 13:14:58 +08:00
Damyon Wiese
309ae8921f MDL-25499: Centralise management of all types of cron tasks
Centralise management of all types of cron tasks with registration, scheduling,
parallel task conflicts(blocking) and running once off tasks, all using an
administration screen.

This is a combination of several issues:

MDL-25502: Added "black magic" task allocator for cron
MDL-25503: Add step to cron to run all scheduled tasks
MDL-25504 cron: Refactor to use scheduler
MDL-25505: Add an admin interface to schedule tasks via cron.
MDL-25507: Add support for adhoc tasks.
2014-02-26 12:03:46 +08:00