pm_LongTask_Task
in package
Long task object
Tags
Table of Contents
- STATUS_DONE = 'done'
- STATUS_ERROR = 'error'
- STATUS_NOT_STARTED = 'not_started'
- STATUS_RUNNING = 'running'
- $hasDangerousMessage : mixed
- Message contains unescaped html
- $hidden : bool
- Is task progress visible in Plesk UI
- $poolSize : int
- Number of tasks that can be executed at the same time, -1 is equal to unlimited pool size
- $trackProgress : bool
- Is task progress trackable
- __construct() : mixed
- getConcurrencyRules() : array<string|int, string>
- List of tags for concurrency limitation Each tag limits the number of concurrent tasks that can be executed at the same time.
- getDescription() : string
- Human-readable description of the task
- getId() : string
- Define task unique ID
- getInstanceId() : int
- Get ID of launched task
- getParam() : mixed
- Get task parameter
- getParams() : array<string|int, mixed>
- Get all task parameters as array
- getProgress() : int
- Get task progress
- getStatus() : string
- Get task status
- getSteps() : array<string|int, mixed>
- Sequence of steps in ProgressDialog
- onDone() : mixed
- Define on task done logic
- onError() : mixed
- Define processing error
- onStart() : mixed
- Define processing adding task to queue
- run() : mixed
- Define task execution logic
- setParam() : mixed
- Set task parameter
- setParams() : mixed
- Set task parameters as array
- statusMessage() : string
- Define current status message
- toArray() : array<string|int, mixed>
- Array representation of task
- updateProgress() : mixed
- Update task progress
Constants
STATUS_DONE
public
mixed
STATUS_DONE
= 'done'
STATUS_ERROR
public
mixed
STATUS_ERROR
= 'error'
STATUS_NOT_STARTED
public
mixed
STATUS_NOT_STARTED
= 'not_started'
STATUS_RUNNING
public
mixed
STATUS_RUNNING
= 'running'
Properties
$hasDangerousMessage
Message contains unescaped html
public
mixed
$hasDangerousMessage
= alse
$hidden
Is task progress visible in Plesk UI
public
bool
$hidden
= alse
$poolSize
Number of tasks that can be executed at the same time, -1 is equal to unlimited pool size
public
int
$poolSize
= -1
Tags
$trackProgress
Is task progress trackable
public
bool
$trackProgress
= alse
Methods
__construct()
public
__construct() : mixed
Return values
mixed —getConcurrencyRules()
List of tags for concurrency limitation Each tag limits the number of concurrent tasks that can be executed at the same time.
public
getConcurrencyRules() : array<string|int, string>
Limits per tag are configured in Task Manager configuration. Tags without limit configuration default to a limit of 1 (no concurrent execution). Empty tags list results in no additional limits.
Tags
Return values
array<string|int, string> —getDescription()
Human-readable description of the task
public
getDescription() : string
Tags
Return values
string —getId()
Define task unique ID
public
getId() : string
Return values
string —Task identifier
getInstanceId()
Get ID of launched task
public
getInstanceId() : int
Return values
int —Task instance identifier
getParam()
Get task parameter
public
getParam(string $name[, mixed $default = null ]) : mixed
Parameters
- $name : string
-
Parameter name
- $default : mixed = null
-
Default parameter value
Return values
mixed —Parameter value
getParams()
Get all task parameters as array
public
getParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —All task parameters specified in format [$paramName => $paramValue]
getProgress()
Get task progress
public
getProgress() : int
Return values
int —Current task progress (from 0 to 100) or -1 if task progress is not trackable
getStatus()
Get task status
public
getStatus() : string
Return values
string —Current task status, one of STATUS_NOT_STARTED|STATUS_RUNNING|STATUS_ERROR|STATUS_DONE
getSteps()
Sequence of steps in ProgressDialog
public
getSteps() : array<string|int, mixed>
[
'example-step' => [
'icon' => pm_Context::getBaseUrl() . 'images/icon.png',
'title' => 'Example Processing',
'progressStatus' => 'Processed 10 of 100 items',
'progress' => 10,
],
...
]
Return values
array<string|int, mixed> —onDone()
Define on task done logic
public
onDone() : mixed
Return values
mixed —onError()
Define processing error
public
onError(Exception $e) : mixed
Parameters
- $e : Exception
-
Exception that was thrown on task execution
Return values
mixed —onStart()
Define processing adding task to queue
public
onStart() : mixed
Return values
mixed —run()
Define task execution logic
public
abstract run() : mixed
Return values
mixed —setParam()
Set task parameter
public
setParam(string $name, mixed $value) : mixed
Parameters
- $name : string
-
Parameter name
- $value : mixed
-
Parameter value
Tags
Return values
mixed —setParams()
Set task parameters as array
public
setParams(array<string|int, mixed> $params) : mixed
Parameters
- $params : array<string|int, mixed>
-
Task parameters specified in format [$paramName => $paramValue]
Return values
mixed —statusMessage()
Define current status message
public
statusMessage() : string
Return values
string —Message to be shown in task progress bar
toArray()
Array representation of task
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —updateProgress()
Update task progress
public
updateProgress(int $progress) : mixed
Parameters
- $progress : int
-
Task progress, from 0 to 100