Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Simple task to run the tag cron. More...
Public Member Functions | |
bulk_delete_instances ($instances) | |
This function will delete numerous tag instances efficiently. More... | |
cleanup () | |
Clean up the tag tables, making sure all tagged object still exists. More... | |
compute_correlations ($mincorrelation=2) | |
Calculates and stores the correlated tags of all tags. More... | |
eval_cron_field ($field, $min, $max) | |
Take a cron field definition and return an array of valid numbers with the range min-max. More... | |
execute () | |
Do the job. More... | |
get_component () | |
Getter for $component. More... | |
get_cron_lock () | |
Get the current lock for the entire cron. More... | |
get_day () | |
Getter for $day. More... | |
get_day_of_week () | |
Getter for $dayofweek. More... | |
get_disabled () | |
Getter for $disabled. More... | |
get_fail_delay () | |
Getter for $faildelay. More... | |
get_hour () | |
Getter for $hour. More... | |
get_last_run_time () | |
Get the last run time for this scheduled task. More... | |
get_lock () | |
Get the current lock for this task. More... | |
get_minute () | |
Getter for $minute. More... | |
get_month () | |
Getter for $month. More... | |
get_name () | |
Get a descriptive name for this task (shown to admins). More... | |
get_next_run_time () | |
Get the next run time for this task. More... | |
get_next_scheduled_time () | |
Calculate when this task should next be run based on the schedule. More... | |
get_run_if_component_disabled () | |
Override this function if you want this scheduled task to run, even if the component is disabled. More... | |
is_blocking () | |
Getter for $blocking. More... | |
is_customised () | |
Has this task been changed from it's default config? More... | |
process_computed_correlation (stdClass $tagcorrelation) | |
This function processes a tag correlation and makes changes in the database as required. More... | |
set_blocking ($blocking) | |
Setter for $blocking. More... | |
set_component ($component) | |
Setter for $component. More... | |
set_cron_lock (\core\lock\lock $lock) | |
Set the current lock for the entire cron process. More... | |
set_customised ($customised) | |
Has this task been changed from it's default config? More... | |
set_day ($day) | |
Setter for $day. More... | |
set_day_of_week ($dayofweek) | |
Setter for $dayofweek. More... | |
set_disabled ($disabled) | |
Setter for $disabled. More... | |
set_fail_delay ($faildelay) | |
Setter for $faildelay. More... | |
set_hour ($hour) | |
Setter for $hour. More... | |
set_last_run_time ($lastruntime) | |
Set the last run time for this scheduled task. More... | |
set_lock (\core\lock\lock $lock) | |
Set the current lock for this task. More... | |
set_minute ($minute) | |
Setter for $minute. More... | |
set_month ($month) | |
Setter for $month. More... | |
set_next_run_time ($nextruntime) | |
Set the next run time for this task. More... | |
Public Attributes | |
const | DAYOFWEEKMAX = 6 |
Maximum dayofweek value. | |
const | DAYOFWEEKMIN = 0 |
Minimum dayofweek value. | |
const | HOURMAX = 23 |
Maximum hour value. | |
const | HOURMIN = 0 |
Minimum hour value. | |
const | MINUTEMAX = 59 |
Maximum minute value. | |
const | MINUTEMIN = 0 |
Minimum minute value. | |
Simple task to run the tag cron.
core\task\tag_cron_task::bulk_delete_instances | ( | $instances | ) |
This function will delete numerous tag instances efficiently.
This removes tag instances only. It doesn't check to see if it is the last use of a tag.
array | $instances | An array of tag instance objects with the addition of the tagname and tagrawname (used for recording a delete event). |
core\task\tag_cron_task::cleanup | ( | ) |
Clean up the tag tables, making sure all tagged object still exists.
This method is called from cron.
This should normally not be necessary, but in case related tags are not deleted when the tagged record is removed, this should be done once in a while, perhaps on an occasional cron run. On a site with lots of tags, this could become an expensive function to call.
core\task\tag_cron_task::compute_correlations | ( | $mincorrelation = 2 | ) |
Calculates and stores the correlated tags of all tags.
The correlations are stored in the 'tag_correlation' table.
Two tags are correlated if they appear together a lot. Ex.: Users tagged with "computers" will probably also be tagged with "algorithms".
The rationale for the 'tag_correlation' table is performance. It works as a cache for a potentially heavy load query done at the 'tag_instance' table. So, the 'tag_correlation' table stores redundant information derived from the 'tag_instance' table.
int | $mincorrelation | Only tags with more than $mincorrelation correlations will be identified. |
|
inherited |
Take a cron field definition and return an array of valid numbers with the range min-max.
string | $field | - The field definition. |
int | $min | - The minimum allowable value. |
int | $max | - The maximum allowable value. |
array(int) |
core\task\tag_cron_task::execute | ( | ) |
Do the job.
Throw exceptions on errors (the job will be retried).
Reimplemented from core\task\task_base.
|
inherited |
Getter for $component.
string |
|
inherited |
Get the current lock for the entire cron.
core |
|
inherited |
Getter for $day.
string |
|
inherited |
Getter for $dayofweek.
string |
|
inherited |
Getter for $disabled.
bool |
|
inherited |
Getter for $faildelay.
int |
|
inherited |
Getter for $hour.
string |
|
inherited |
Get the last run time for this scheduled task.
int |
|
inherited |
Get the current lock for this task.
core |
|
inherited |
Getter for $minute.
string |
|
inherited |
Getter for $month.
string |
core\task\tag_cron_task::get_name | ( | ) |
Get a descriptive name for this task (shown to admins).
string |
Reimplemented from core\task\scheduled_task.
|
inherited |
Get the next run time for this task.
int | timestamp |
|
inherited |
Calculate when this task should next be run based on the schedule.
int::$nextruntime,. |
|
inherited |
Override this function if you want this scheduled task to run, even if the component is disabled.
bool |
|
inherited |
Getter for $blocking.
bool |
|
inherited |
Has this task been changed from it's default config?
bool |
core\task\tag_cron_task::process_computed_correlation | ( | stdClass | $tagcorrelation | ) |
This function processes a tag correlation and makes changes in the database as required.
The tag correlation object needs have both a tagid property and a correlatedtags property that is an array.
stdClass | $tagcorrelation |
int/bool | The id of the tag correlation that was just processed or false. |
|
inherited |
Setter for $blocking.
bool | $blocking |
|
inherited |
Setter for $component.
string | $component |
|
inherited |
Set the current lock for the entire cron process.
core\lock\lock | $lock |
|
inherited |
Has this task been changed from it's default config?
bool |
|
inherited |
Setter for $day.
string | $day |
|
inherited |
Setter for $dayofweek.
string | $dayofweek |
|
inherited |
Setter for $disabled.
bool | $disabled |
|
inherited |
Setter for $faildelay.
int | $faildelay |
|
inherited |
Setter for $hour.
Accepts a special 'R' value which will be translated to a random hour.
string | $hour |
|
inherited |
Set the last run time for this scheduled task.
int | $lastruntime |
|
inherited |
Set the current lock for this task.
core\lock\lock | $lock |
|
inherited |
Setter for $minute.
Accepts a special 'R' value which will be translated to a random minute.
string | $minute |
|
inherited |
Setter for $month.
string | $month |
|
inherited |
Set the next run time for this task.
int | $nextruntime |