Constants

STATUS_NOT_STARTED

STATUS_NOT_STARTED

STATUS_RUNNING

STATUS_RUNNING

STATUS_ERROR

STATUS_ERROR

STATUS_DONE

STATUS_DONE

Properties

$poolSize

$poolSize : integer

Number of tasks that can be executed at the same time, -1 is equal to unlimited pool size

Type

integer

$trackProgress

$trackProgress : boolean

Is task progress trackable

Type

boolean

$hidden

$hidden : boolean

Is task progress visible in Plesk UI

Type

boolean

$hasDangerousMessage

$hasDangerousMessage : 

Message contains unescaped html

Type

Methods

__construct()

__construct() 

run()

run() 

Define task execution logic

getId()

getId() : string

Define task unique ID

Returns

string —

Task identifier

statusMessage()

statusMessage() : string

Define current status message

Returns

string —

Message to be shown in task progress bar

onStart()

onStart() 

Define processing adding task to queue

onError()

onError(\Exception  $e) 

Define processing error

Parameters

\Exception $e

Exception that was thrown on task execution

onDone()

onDone() 

Define on task done logic

setParam()

setParam(string  $name, mixed  $value) 

Set task parameter

Parameters

string $name

Parameter name

mixed $value

Parameter value

Throws

\pm_Exception

setParams()

setParams(array  $params) 

Set task parameters as array

Parameters

array $params

Task parameters specified in format [$paramName => $paramValue]

getParam()

getParam(string  $name, mixed  $default = null) : mixed

Get task parameter

Parameters

string $name

Parameter name

mixed $default

Default parameter value

Returns

mixed —

Parameter value

getParams()

getParams() : array

Get all task parameters as array

Returns

array —

All task parameters specified in format [$paramName => $paramValue]

getInstanceId()

getInstanceId() : integer

Get ID of launched task

Returns

integer —

Task instance identifier

getProgress()

getProgress() : integer

Get task progress

Returns

integer —

Current task progress (from 0 to 100) or -1 if task progress is not trackable

getStatus()

getStatus() : string

Get task status

Returns

string —

Current task status, one of STATUS_NOT_STARTED|STATUS_RUNNING|STATUS_ERROR|STATUS_DONE

updateProgress()

updateProgress(integer  $progress) 

Update task progress

Parameters

integer $progress

Task progress, from 0 to 100

getSteps()

getSteps() : array

Sequence of steps in ProgressDialog

[
    'example-step' => [
        'icon' => pm_Context::getBaseUrl() . 'images/icon.png',
        'title' => 'Example Processing',
        'progressStatus' => 'Processed 10 of 100 items',
        'progress' => 10,
    ],
    ...
]

Returns

array

toArray()

toArray() : array

Array representation of task

Returns

array