‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Resource\ProcessedFileRepository Class Reference
Inheritance diagram for TYPO3\CMS\Core\Resource\ProcessedFileRepository:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct (protected readonly ResourceFactory $factory, protected readonly TaskTypeRegistry $taskTypeRegistry)
 
 findByUid (int $uid)
 
 findByStorageAndIdentifier (ResourceStorage $storage, string $identifier)
 
 countByStorage (ResourceStorage $storage)
 
 add (ProcessedFile $processedFile)
 
 update (ProcessedFile $processedFile)
 
 findOneByOriginalFileAndTaskTypeAndConfiguration (File $file, string $taskType, array $configuration)
 
ProcessedFile[] findAllByOriginalFile (File $file)
 
int removeAll (?int $storageUid=null)
 

Protected Member Functions

 createNewProcessedFileObject (FileInterface $originalFile, string $taskType, array $configuration)
 
 createDomainObject (array $databaseRow)
 
 cleanUnavailableColumns (array $data)
 
 prepareTaskObject (FileInterface $fileObject, string $taskType, array $configuration)
 

Protected Attributes

array $tableColumns = []
 

Detailed Description

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.

Definition at line 38 of file ProcessedFileRepository.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Resource\ProcessedFileRepository::__construct ( protected readonly ResourceFactory  $factory,
protected readonly TaskTypeRegistry  $taskTypeRegistry 
)

Definition at line 50 of file ProcessedFileRepository.php.

Member Function Documentation

◆ add()

◆ cleanUnavailableColumns()

TYPO3\CMS\Core\Resource\ProcessedFileRepository::cleanUnavailableColumns ( array  $data)
protected

Removes all array keys which cannot be persisted.

Definition at line 330 of file ProcessedFileRepository.php.

Referenced by TYPO3\CMS\Core\Resource\ProcessedFileRepository\add(), and TYPO3\CMS\Core\Resource\ProcessedFileRepository\update().

◆ countByStorage()

TYPO3\CMS\Core\Resource\ProcessedFileRepository::countByStorage ( ResourceStorage  $storage)

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

Definition at line 107 of file ProcessedFileRepository.php.

References TYPO3\CMS\Core\Resource\ResourceStorage\getUid(), and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

◆ createDomainObject()

◆ createNewProcessedFileObject()

TYPO3\CMS\Core\Resource\ProcessedFileRepository::createNewProcessedFileObject ( FileInterface  $originalFile,
string  $taskType,
array  $configuration 
)
protected

◆ findAllByOriginalFile()

ProcessedFile [] TYPO3\CMS\Core\Resource\ProcessedFileRepository::findAllByOriginalFile ( File  $file)

◆ findByStorageAndIdentifier()

◆ findByUid()

TYPO3\CMS\Core\Resource\ProcessedFileRepository::findByUid ( int  $uid)

◆ findOneByOriginalFileAndTaskTypeAndConfiguration()

TYPO3\CMS\Core\Resource\ProcessedFileRepository::findOneByOriginalFileAndTaskTypeAndConfiguration ( File  $file,
string  $taskType,
array  $configuration 
)

◆ prepareTaskObject()

TYPO3\CMS\Core\Resource\ProcessedFileRepository::prepareTaskObject ( FileInterface  $fileObject,
string  $taskType,
array  $configuration 
)
protected

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.

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.

    Todo:
    ‪: This should be shifted into a TaskFactory or the TaskRegistry

Definition at line 358 of file ProcessedFileRepository.php.

References TYPO3\CMS\Core\Resource\ProcessedFileRepository\createNewProcessedFileObject().

Referenced by TYPO3\CMS\Core\Resource\ProcessedFileRepository\findOneByOriginalFileAndTaskTypeAndConfiguration().

◆ removeAll()

int TYPO3\CMS\Core\Resource\ProcessedFileRepository::removeAll ( ?int  $storageUid = null)

Removes all processed files and also deletes the associated physical files. If a storageUid is given, only db entries and files of this storage are removed.

Parameters
int | null$storageUid‪If not NULL, only the processed files of the given storage are removed
Returns
‪int Number of failed deletions

Definition at line 240 of file ProcessedFileRepository.php.

References TYPO3\CMS\Core\Resource\ProcessedFileRepository\createDomainObject(), and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

◆ update()

TYPO3\CMS\Core\Resource\ProcessedFileRepository::update ( ProcessedFile  $processedFile)

Member Data Documentation

◆ $tableColumns

array TYPO3\CMS\Core\Resource\ProcessedFileRepository::$tableColumns = []
protected

As determining the table columns is a costly operation this is done only once during runtime and cached afterward.

See also
cleanUnavailableColumns()

Definition at line 48 of file ProcessedFileRepository.php.