ProcessedFileRepository

class \TYPO3\CMS\Core\Resource\ProcessedFileRepository

Implements
LoggerAwareInterface, SingletonInterface
Uses
LoggerAwareTrait

A repository for accessing and storing processed files.

This class is mainly meant to be used internally in TYPO3 for accessing via FileProcessingService or custom FAL Processors.

Table of Contents

Interfaces

LoggerAwareInterface
SingletonInterface
"empty" interface for singletons (marker interface pattern)

Properties

$factory  : ResourceFactory
$taskTypeRegistry  : TaskTypeRegistry

Methods

__construct()  : mixed
add()  : void
Adds a processed file object to the database.
countByStorage()  : int
Count processed files by storage. This is used in the "Install Tool" to render statistics of processed files.
findAllByOriginalFile()  : ProcessedFile[]
findByStorageAndIdentifier()  : ProcessedFile|null
findByUid()  : ProcessedFile
Finds a processed file matching the given UID.
findOneByOriginalFileAndTaskTypeAndConfiguration()  : ProcessedFile
removeAll()  : int
Removes all processed files and also deletes the associated physical files.
update()  : void
Updates an existing file object in the database. If the file has not been persisted yet, nothing changes.
cleanUnavailableColumns()  : array
Removes all array keys which cannot be persisted.
createDomainObject()  : ProcessedFile
createNewProcessedFileObject()  : ProcessedFile
Creates a ProcessedFile object from a file object and a processing configuration.
prepareTaskObject()  : TaskInterface
We need a task object, so the task can define what configuration is necessary. This way, we can then use a cleaned up configuration to find already processed files.

Properties

Methods

countByStorage()

Count processed files by storage. This is used in the "Install Tool" to render statistics of processed files.

public countByStorage(ResourceStorage $storage) : int

Parameters

$storage : ResourceStorage

Return values

int

findOneByOriginalFileAndTaskTypeAndConfiguration()

public findOneByOriginalFileAndTaskTypeAndConfiguration(File $file, string $taskType, array $configuration) : ProcessedFile

Parameters

$file : File
$taskType : string

The task that should be executed on the file

$configuration : array

Return values

ProcessedFile

removeAll()

Removes all processed files and also deletes the associated physical files.

public removeAll([int|null $storageUid = null ]) : int

If a storageUid is given, only db entries and files of this storage are removed.

Parameters

$storageUid : int|null = null

If not NULL, only the processed files of the given storage are removed

Return values

int —

Number of failed deletions

update()

Updates an existing file object in the database. If the file has not been persisted yet, nothing changes.

public update(ProcessedFile $processedFile) : void

Parameters

$processedFile : ProcessedFile

cleanUnavailableColumns()

Removes all array keys which cannot be persisted.

protected cleanUnavailableColumns(array $data) : array

Parameters

$data : array

Return values

array

createNewProcessedFileObject()

Creates a ProcessedFile object from a file object and a processing configuration.

protected createNewProcessedFileObject(FileInterface $originalFile, string $taskType, array $configuration) : ProcessedFile

Parameters

$originalFile : FileInterface
$taskType : string
$configuration : array

Return values

ProcessedFile

prepareTaskObject()

We need a task object, so the task can define what configuration is necessary. This way, we can then use a cleaned up configuration to find already processed files.

protected prepareTaskObject(FileInterface $fileObject, string $taskType, array $configuration) : TaskInterface

The method sanitizeConfiguration should then be part of the TaskInterface later-on.

Note: The Task object needs to be re-created with a real processed file, once we have one, as the current API Design is very tightly coupled:

  • TaskInterface has a constructor in the interface (which is bad)
  • TaskObject requires a constituted ProcessedFile object in order to "work"
  • ProcessedFile creates a TaskObject in ProcessedFile->getTask()
  • ProcessedFile AND TaskObject contain both the configuration, which should be avoided as well.

Parameters

$fileObject : FileInterface
$taskType : string
$configuration : array

Tags

todo:

This should be shifted into a TaskFactory or the TaskRegistry

Return values

TaskInterface
On this page