TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
AbstractTask Class Reference
Inheritance diagram for AbstractTask:
TaskInterface AbstractGraphicalTask ImageCropScaleMaskTask ImagePreviewTask

Public Member Functions

 __construct (Resource\ProcessedFile $targetFile, array $configuration)
 
 getConfigurationChecksum ()
 
 getTargetFilename ()
 
 getTargetFileExtension ()
 
 getName ()
 
 getType ()
 
 getTargetFile ()
 
 setTargetFile (Resource\ProcessedFile $targetFile)
 
 getSourceFile ()
 
 setSourceFile (Resource\File $sourceFile)
 
 getConfiguration ()
 
 isExecuted ()
 
 setExecuted ($successful)
 
 isSuccessful ()
 
- Public Member Functions inherited from TaskInterface
 getTargetFileName ()
 
 fileNeedsProcessing ()
 

Protected Member Functions

 getChecksumData ()
 
 isValidConfiguration (array $configuration)
 

Protected Attributes

 $checksumData = []
 
 $targetFile
 
 $sourceFile
 
 $configuration
 
 $type
 
 $name
 
 $executed = false
 
 $successful
 

Detailed Description

Abstract base implementation of a task.

If you extend this class, make sure that you redefine the member variables $type and $name or set them in the constructor. Otherwise your task won't be recognized by the system and several things will fail.

Definition at line 27 of file core/Classes/Resource/Processing/AbstractTask.php.

Constructor & Destructor Documentation

__construct ( Resource\ProcessedFile  $targetFile,
array  $configuration 
)
Parameters
Resource\ProcessedFile$targetFile
array$configuration

Implements TaskInterface.

Definition at line 73 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\$configuration, and AbstractTask\$targetFile.

Member Function Documentation

getChecksumData ( )
protected

Sets parameters needed in the checksum. Can be overridden to add additional parameters to the checksum. This should include all parameters that could possibly vary between different task instances, e.g. the TYPO3 image configuration in TYPO3_CONF_VARS[GFX] for graphic processing tasks.

Returns
array

Definition at line 87 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\getName(), AbstractTask\getSourceFile(), and AbstractTask\getType().

Referenced by AbstractTask\getConfigurationChecksum().

getConfiguration ( )
Returns
array

Implements TaskInterface.

Definition at line 184 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\$configuration.

getConfigurationChecksum ( )

Returns the checksum for this task's configuration, also taking the file and task type into account.

Returns
string

Implements TaskInterface.

Definition at line 101 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\getChecksumData(), and GeneralUtility\shortMD5().

Referenced by AbstractGraphicalTask\getTargetFilename(), and AbstractTask\getTargetFilename().

getName ( )

Returns the name of this task

Returns
string

Implements TaskInterface.

Definition at line 134 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\$name.

Referenced by AbstractTask\getChecksumData().

getTargetFile ( )
Returns
Resource

Implements TaskInterface.

Definition at line 152 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\$targetFile.

getTargetFileExtension ( )

Gets the file extension the processed file should have in the filesystem.

Returns
string

Implements TaskInterface.

Definition at line 124 of file core/Classes/Resource/Processing/AbstractTask.php.

Referenced by AbstractTask\getTargetFilename().

getTargetFilename ( )
getType ( )

Returns the type of this task

Returns
string

Implements TaskInterface.

Definition at line 144 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\$type.

Referenced by AbstractGraphicalTask\determineTargetFileExtension(), and AbstractTask\getChecksumData().

isExecuted ( )

Returns TRUE if this task has been executed, no matter if the execution was successful.

Returns
bool

Implements TaskInterface.

Definition at line 203 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\$executed.

isSuccessful ( )

Returns TRUE if this task has been successfully executed. Only call this method if the task has been processed at all.

Returns
bool
Exceptions
LogicException If the task has not been executed already

Implements TaskInterface.

Definition at line 227 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\$successful.

isValidConfiguration ( array  $configuration)
abstractprotected

Checks if the given configuration is sensible for this task, i.e. if all required parameters are given, within the boundaries and don't conflict with each other.

Parameters
array$configuration
Returns
bool
setExecuted (   $successful)

Set this task executed. This is used by the Processors in order to transfer the state of this task to the file processing service.

Parameters
bool$successfulSet this to FALSE if executing the task failed
Returns
void

Implements TaskInterface.

Definition at line 215 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\$successful.

setSourceFile ( Resource\File  $sourceFile)
Parameters
Resource\File$sourceFile

Definition at line 176 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\$sourceFile.

setTargetFile ( Resource\ProcessedFile  $targetFile)
Parameters
Resource\ProcessedFile$targetFile

Definition at line 160 of file core/Classes/Resource/Processing/AbstractTask.php.

References AbstractTask\$targetFile.

Member Data Documentation

$checksumData = []
protected
$configuration
protected
$executed = false
protected
$name
protected
$sourceFile
protected
$successful
protected
$type
protected