TaskInterface
A task is a unit of work that can be performed by a file processor. This may include multiple steps in any order, details depend on the configuration of the task and the tools the processor uses.
Each task has a type and a name. The type describes the category of the task, like "image" and "video". If your task is generic or applies to multiple types of files, use "general".
A task also already has to know the target file it should be executed on, so there is no "abstract" task that just specifies the steps to be executed without a concrete file. However, new tasks can easily be created from an existing task object.
Table of Contents
Methods
- fileNeedsProcessing() : bool
- Returns TRUE if the file has to be processed at all, such as e.g. the original file does.
- getConfiguration() : array<string|int, mixed>
- Returns the configuration for this task.
- getConfigurationChecksum() : string
- Returns the configuration checksum of this task.
- getName() : string
- Returns the name of this task.
- getSourceFile() : File
- Returns the original file this task is based on.
- getTargetFile() : ProcessedFile
- Returns the processed file this task is executed on.
- getTargetFileExtension() : string
- Gets the file extension the processed file should have in the filesystem.
- getTargetFileName() : string
- Returns the name the processed file should have in the filesystem.
- getType() : string
- Returns the type of this task.
- isExecuted() : bool
- Returns TRUE if this task has been executed, no matter if the execution was successful.
- isSuccessful() : bool
- Returns TRUE if this task has been successfully executed. Only call this method if the task has been processed at all.
- sanitizeConfiguration() : void
- For some tasks it might be important and useful to clean up the configuration, in order to find the ProcessedFile that uses this configuration.
- setExecuted() : void
- Mark this task as executed. This is used by the Processors in order to transfer the state of this task to the file processing service.
Methods
fileNeedsProcessing()
Returns TRUE if the file has to be processed at all, such as e.g. the original file does.
public
fileNeedsProcessing() : bool
Note: This does not indicate if the concrete ProcessedFile attached to this task has to be (re)processed. This check is done in ProcessedFile::isOutdated(). @todo isOutdated()/needsReprocessing()?
Return values
boolgetConfiguration()
Returns the configuration for this task.
public
getConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed>getConfigurationChecksum()
Returns the configuration checksum of this task.
public
getConfigurationChecksum() : string
Return values
stringgetName()
Returns the name of this task.
public
getName() : string
Return values
stringgetSourceFile()
Returns the original file this task is based on.
public
getSourceFile() : File
Return values
FilegetTargetFile()
Returns the processed file this task is executed on.
public
getTargetFile() : ProcessedFile
Return values
ProcessedFilegetTargetFileExtension()
Gets the file extension the processed file should have in the filesystem.
public
getTargetFileExtension() : string
Return values
stringgetTargetFileName()
Returns the name the processed file should have in the filesystem.
public
getTargetFileName() : string
Return values
stringgetType()
Returns the type of this task.
public
getType() : string
Return values
stringisExecuted()
Returns TRUE if this task has been executed, no matter if the execution was successful.
public
isExecuted() : bool
Return values
boolisSuccessful()
Returns TRUE if this task has been successfully executed. Only call this method if the task has been processed at all.
public
isSuccessful() : bool
Tags
Return values
boolsanitizeConfiguration()
For some tasks it might be important and useful to clean up the configuration, in order to find the ProcessedFile that uses this configuration.
public
sanitizeConfiguration() : void
Ideally, a task has some information what needs to be used or not.
setExecuted()
Mark this task as executed. This is used by the Processors in order to transfer the state of this task to the file processing service.
public
setExecuted(bool $successful) : void
Parameters
- $successful : bool
-
Set this to FALSE if executing the task failed