Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

Adhoc task abstract class. All background tasks should extend this class.

Copyright: 2013 Damyon Wiese
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 174 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: adhoc_task  - X-Ref

Abstract class defining an adhoc task.

get_name()   X-Ref
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)

return: string

set_id($id)   X-Ref
Setter for $id.

param: int|null $id

get_userid()   X-Ref
Getter for $userid.

return: int|null $userid

set_custom_data($customdata)   X-Ref
Setter for $customdata.

param: mixed $customdata (anything that can be handled by json_encode)

set_custom_data_as_string($customdata)   X-Ref
Alternate setter for $customdata. Expects the data as a json_encoded string.

param: string $customdata json_encoded string

get_custom_data()   X-Ref
Getter for $customdata.

return: mixed (anything that can be handled by json_decode).

get_custom_data_as_string()   X-Ref
Alternate getter for $customdata.

return: string this is the raw json encoded version.

get_id()   X-Ref
Getter for $id.

return: int|null $id

set_userid($userid)   X-Ref
Setter for $userid.

param: int|null $userid

get_default_concurrency_limit()   X-Ref
Returns default concurrency limit for this task.

return: int default concurrency limit

get_concurrency_limit()   X-Ref
Returns effective concurrency limit for this task.

return: int effective concurrency limit for this task

set_concurrency_lock(\core\lock\lock $lock)   X-Ref
Sets concurrency task lock.

param: \core\lock\lock $lock concurrency lock to be set

release_concurrency_lock()   X-Ref
Release the concurrency lock for this task type.