Moodle PHP Documentation 5.0
Moodle 5.0.1+ (Build: 20250711) (61af040cd5f)
|
Public Member Functions | |
execute () | |
Do the job. | |
fix_wrong_parents () | |
Fix the context of child categories whose contextid does not match that of their parents. | |
get_attempts_available () | |
Get the remaining attempts of the task. | |
get_categories_in_a_different_context_to_their_parent () | |
Get question categories that are in a different context to their parent. | |
get_component () | |
Getter for $component. | |
get_concurrency_limit () | |
Returns effective concurrency limit for this task. | |
get_cron_lock () | |
Get the current lock for the entire cron. | |
get_custom_data () | |
Getter for $customdata. | |
get_custom_data_as_string () | |
Alternate getter for $customdata. | |
get_fail_delay () | |
Getter for $faildelay. | |
get_hostname () | |
Getter for $hostname. | |
get_id () | |
Getter for $id. | |
get_lock () | |
Get the current lock for this task. | |
get_name () | |
Provide default implementation of the task name for backward compatibility. | |
get_next_run_time () | |
Get the next run time for this task. | |
get_pid () | |
Getter for $pid. | |
get_runtime () | |
Returns task runtime. | |
get_runtime_result () | |
Returns if the task has been running for too long. | |
get_timestarted () | |
Getter for $timestarted. | |
get_userid () | |
Getter for $userid. | |
replacement | is_blocking () |
is_component_enabled () | |
Informs whether the task's component is enabled. | |
move_category_and_its_children (int $categoryid, int $newcontextid) | |
Set the contextid of category $categoryid and all its children to $newcontextid. | |
release_concurrency_lock () | |
Release the concurrency lock for this task type. | |
retry_until_success () | |
Used to indicate if the task should be re-run if it fails. | |
set_attempts_available (int $attemptsavailable) | |
Set the remaining attempts of the task. | |
replacement | set_blocking () |
set_component ($component) | |
Setter for $component. | |
set_concurrency_lock (\core\lock\lock $lock) | |
Sets concurrency task lock. | |
set_cron_lock (\core\lock\lock $lock) | |
Set the current lock for the entire cron process. | |
set_custom_data ($customdata) | |
Setter for $customdata. | |
set_custom_data_as_string ($customdata) | |
Alternate setter for $customdata. | |
set_fail_delay ($faildelay) | |
Setter for $faildelay. | |
set_hostname ($hostname=null) | |
Setter for $hostname. | |
set_id ($id) | |
Setter for $id. | |
set_lock (\core\lock\lock $lock) | |
Set the current lock for this task. | |
set_next_run_time ($nextruntime) | |
Set the next run time for this task. | |
set_pid ($pid=null) | |
Setter for $pid. | |
set_timestarted ($timestarted=null) | |
Setter for $timestarted. | |
set_userid ($userid) | |
Setter for $userid. | |
Public Attributes | |
replacement | : null |
replacement | : null |
replacement | final: true |
replacement | mdl: '<a class="el" href="https: reason: 'Blocking tasks are no longer supported' |
replacement | since: '4.4' |
Protected Member Functions | |
create_course (core_course_category $coursecategory, string $shortname) | |
Wrapper for create_course. | |
get_default_concurrency_limit () | |
Returns default concurrency limit for this task. | |
get_top_category_id_for_context (int $contextid) | |
Find the Top category for a context, if there is one. | |
move_question_category (stdClass $oldtopcategory, context $newcontext) | |
Create a new 'Top' category in our new context and move the old categories descendents beneath it. | |
question_category_is_empty (int $categoryid) | |
Recursively check if a question category or its children contain any questions. | |
|
protected |
Wrapper for create_course.
core_course_category | $coursecategory | |
string | $shortname |
stdClass |
mod_qbank\task\transfer_question_categories::execute | ( | ) |
Do the job.
Throw exceptions on errors (the job will be retried).
Reimplemented from core\task\task_base.
mod_qbank\task\transfer_question_categories::fix_wrong_parents | ( | ) |
Fix the context of child categories whose contextid does not match that of their parents.
Fix here means:
This is necessary because, due to old bugs, for example in backup and restoree code, we know there can be question categories in the databases of old Moodle sites with the wrong context id.
|
inherited |
Get the remaining attempts of the task.
int | Number of the remaining attempts of the task. |
mod_qbank\task\transfer_question_categories::get_categories_in_a_different_context_to_their_parent | ( | ) |
Get question categories that are in a different context to their parent.
int[] | child category id => context id of the child category. |
|
inherited |
Getter for $component.
string |
|
finalinherited |
Returns effective concurrency limit for this task.
int | effective concurrency limit for this task |
|
inherited |
Get the current lock for the entire cron.
core\lock\lock |
|
inherited |
Getter for $customdata.
mixed | (anything that can be handled by json_decode). |
|
inherited |
Alternate getter for $customdata.
string | this is the raw json encoded version. |
|
protectedinherited |
Returns default concurrency limit for this task.
int | default concurrency limit |
|
inherited |
Getter for $faildelay.
int |
|
inherited |
Getter for $hostname.
string |
|
inherited |
Getter for $id.
int|null#$id |
|
inherited |
Get the current lock for this task.
core\lock\lock |
|
inherited |
Provide default implementation of the task name for backward compatibility.
Extending classes are expected to implement this method to provide a descriptive name for the task (shown to admins)
string |
Reimplemented from core\task\task_base.
Reimplemented in core\task\badges_adhoc_task, core_reportbuilder\task\send_schedule, and quiz_statistics\task\recalculate.
|
inherited |
Get the next run time for this task.
int | timestamp |
|
inherited |
Getter for $pid.
int |
|
inherited |
Returns task runtime.
int |
|
inherited |
Returns if the task has been running for too long.
result |
|
inherited |
Getter for $timestarted.
int |
|
protected |
Find the Top category for a context, if there is one.
int | $contextid | the id of a context (which might not exist). |
int | a Top category id, or 0 if none is found. |
|
inherited |
Getter for $userid.
int|null#$userid |
|
inherited |
Informs whether the task's component is enabled.
bool | true when enabled. false otherwise. |
mod_qbank\task\transfer_question_categories::move_category_and_its_children | ( | int | $categoryid, |
int | $newcontextid ) |
Set the contextid of category $categoryid and all its children to $newcontextid.
int | $categoryid | a question_category id. |
int | $newcontextid | the place to move to. |
|
protected |
Create a new 'Top' category in our new context and move the old categories descendents beneath it.
stdClass | $oldtopcategory | The old 'Top' category that we are moving. |
context | $newcontext | The context we are moving our category to. |
void |
|
protected |
Recursively check if a question category or its children contain any questions.
int | $categoryid | The parent category to check from. |
bool | True if neither the category nor its children contain any questions. |
|
inherited |
Used to indicate if the task should be re-run if it fails.
By default, tasks will be retried until they succeed, other tasks can override this method to change this behaviour.
bool | true if the task should be retried until it succeeds, false otherwise. |
Reimplemented in core\task\asynchronous_restore_task, and core_course\task\course_delete_modules.
|
inherited |
Set the remaining attempts of the task.
int | $attemptsavailable | Number of the remaining attempts of the task. |
|
inherited |
Setter for $component.
string | $component |
|
finalinherited |
Sets concurrency task lock.
core\lock\lock | $lock | concurrency lock to be set |
|
inherited |
Set the current lock for the entire cron process.
core\lock\lock | $lock |
|
inherited |
Setter for $customdata.
mixed | $customdata | (anything that can be handled by json_encode) |
|
inherited |
Alternate setter for $customdata.
Expects the data as a json_encoded string.
string | $customdata | json_encoded string |
|
inherited |
Setter for $faildelay.
int | $faildelay |
|
inherited |
Setter for $hostname.
string | $hostname |
|
inherited |
Setter for $id.
int | null | $id |
|
inherited |
Set the current lock for this task.
core\lock\lock | $lock |
|
inherited |
Set the next run time for this task.
int | $nextruntime |
|
inherited |
Setter for $pid.
int | $pid |
|
inherited |
Setter for $timestarted.
int | $timestarted |
|
inherited |
Setter for $userid.
int | null | $userid |
|
inherited |
|
inherited |