ConvertForumPostTask
extends Task
in package
Table of Contents
Constants
- STATUS_CANCELLED = 'cancelled'
- Cancelled status.
- STATUS_COMPLETED = 'completed'
- Completed status.
- STATUS_ERROR = 'error'
- Error status.
- STATUS_FAILED = 'failed'
- Failed status - when task has been in error status 3 times.
- STATUS_IN_PROGRESS = 'in_progress'
- In progress status.
- STATUS_READY = 'ready'
- Ready status.
Properties
- $_container : Container
- $_attempts : int|null
- $_data : array<string|int, mixed>|null
- $_entity : string|null
- $_entityId : int|null
- $_executedAt : int|null
- $_fragment : bool
- $_fragmentNext : int|null
- $_fragmentTotal : int|null
- $_id : int|null
- $_moduleId : int
- $_name : string
- $_output : array<string|int, mixed>|null
- $_scheduledFor : int
- $_status : string
- $_task : string
- $_userId : int|null
Methods
- __construct() : mixed
- Initialise new empty task.
- fromId() : Task|null
- Initialise task from ID.
- fromNew() : Task
- Initialise new task.
- getAttempts() : int|null
- getData() : array<string|int, mixed>
- getEntity() : string|null
- getEntityId() : int|null
- getExecutedAt() : int|null
- getFragmentNext() : int|null
- getFragmentTotal() : int|null
- getId() : int|null
- getModuleId() : int
- getName() : string
- getOutput() : array<string|int, mixed>
- getScheduledFor() : int
- getStatus() : string
- getTask() : string
- getUserId() : int|null
- getWillFragment() : bool
- Will this task be fragmented?
- run() : string
- Run the task.
- schedule() : void
- Schedule this task
- setContainer() : void
- setData() : void
- setFragmentNext() : void
- setOutput() : void
Constants
STATUS_CANCELLED
Cancelled status.
public
mixed
STATUS_CANCELLED
= 'cancelled'
STATUS_COMPLETED
Completed status.
public
mixed
STATUS_COMPLETED
= 'completed'
STATUS_ERROR
Error status.
public
mixed
STATUS_ERROR
= 'error'
STATUS_FAILED
Failed status - when task has been in error status 3 times.
public
mixed
STATUS_FAILED
= 'failed'
STATUS_IN_PROGRESS
In progress status.
public
mixed
STATUS_IN_PROGRESS
= 'in_progress'
STATUS_READY
Ready status.
public
mixed
STATUS_READY
= 'ready'
Properties
$_container
protected
Container
$_container
Dependency container
$_attempts
private
int|null
$_attempts
Number of attempts already performed for this task
$_data
private
array<string|int, mixed>|null
$_data
Task data
$_entity
private
string|null
$_entity
Entity which this task relates to
$_entityId
private
int|null
$_entityId
ID of entity which this task relates to
$_executedAt
private
int|null
$_executedAt
Unix timestamp at which the task was last executed
$_fragment
private
bool
$_fragment
Whether to fragment the task or not
$_fragmentNext
private
int|null
$_fragmentNext
Index of next item in fragment to process
$_fragmentTotal
private
int|null
$_fragmentTotal
Total number of items to process
$_id
private
int|null
$_id
Task ID, only set for existing tasks in the database
$_moduleId
private
int
$_moduleId
Module ID to which the task belongs
$_name
private
string
$_name
Human readable task name
$_output
private
array<string|int, mixed>|null
$_output
Task output
$_scheduledFor
private
int
$_scheduledFor
Timestamp the task should be scheduled for
$_status
private
string
$_status
Task status
$_task
private
string
$_task
Task class::function to be run
$_userId
private
int|null
$_userId
User ID that created the task
Methods
__construct()
Initialise new empty task.
public
__construct() : mixed
fromId()
Initialise task from ID.
public
fromId(int $id) : Task|null
Parameters
- $id : int
Tags
Return values
Task|nullfromNew()
Initialise new task.
public
fromNew(int $moduleId, string $name, array<string|int, mixed>|null $data, int $scheduledFor[, string|null $entity = null ][, int|null $entityId = null ][, bool $fragment = false ][, int|null $fragmentTotal = null ][, int|null $userId = null ]) : Task
Parameters
- $moduleId : int
-
Module ID to which this task belongs
- $name : string
-
Name of the task
- $data : array<string|int, mixed>|null
-
Any data which needs passing into the task when it executes
- $scheduledFor : int
-
Unix timestamp representing the earliest time from which the task will be executed
- $entity : string|null = null
-
Optional entity the task is associated with
- $entityId : int|null = null
-
Optional entity ID the task is associated with
- $fragment : bool = false
-
Whether to fragment the task's execution or not (split up into multiple runs)
- $fragmentTotal : int|null = null
-
Total number of items which need processing if fragmenting
- $userId : int|null = null
-
Optional user ID which triggered this task's execution
Return values
TaskgetAttempts()
public
getAttempts() : int|null
Return values
int|nullgetData()
public
getData() : array<string|int, mixed>
Return values
array<string|int, mixed>getEntity()
public
getEntity() : string|null
Return values
string|nullgetEntityId()
public
getEntityId() : int|null
Return values
int|nullgetExecutedAt()
public
getExecutedAt() : int|null
Return values
int|nullgetFragmentNext()
public
getFragmentNext() : int|null
Return values
int|nullgetFragmentTotal()
public
getFragmentTotal() : int|null
Return values
int|nullgetId()
public
getId() : int|null
Return values
int|nullgetModuleId()
public
getModuleId() : int
Return values
intgetName()
public
getName() : string
Return values
stringgetOutput()
public
getOutput() : array<string|int, mixed>
Return values
array<string|int, mixed>getScheduledFor()
public
getScheduledFor() : int
Return values
intgetStatus()
public
getStatus() : string
Return values
stringgetTask()
public
getTask() : string
Return values
stringgetUserId()
public
getUserId() : int|null
Return values
int|nullgetWillFragment()
Will this task be fragmented?
public
getWillFragment() : bool
Return values
boolrun()
Run the task.
public
run() : string
Return values
string —Status of task following execution
schedule()
Schedule this task
public
static schedule() : void
setContainer()
public
setContainer(Container $container) : void
Parameters
- $container : Container
setData()
public
setData([array<string|int, mixed> $data = [] ]) : void
Parameters
- $data : array<string|int, mixed> = []
setFragmentNext()
public
setFragmentNext(int $next) : void
Parameters
- $next : int
-
Index to resume processing on next time the task is run
setOutput()
public
setOutput([array<string|int, mixed> $output = [] ]) : void
Parameters
- $output : array<string|int, mixed> = []