FileIndexRepository implements SingletonInterface
Repository Class as an abstraction layer to sys_file
Every access to table sys_file_metadata which is not handled by DataHandler has to use this Repository class.
This is meant for FAL internal use only!
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
- $eventDispatcher : EventDispatcherInterface
- $fields : array<string|int, mixed>
- A list of properties which are to be persisted
- $table : string
Methods
- __construct() : mixed
- add() : mixed
- Adds a file to the index
- addRaw() : array<string|int, mixed>
- Add data from record (at indexing time)
- findByContentHash() : mixed
- Returns all indexed files which match the content hash Used by the indexer to detect already present files
- findByFolder() : array<string|int, mixed>|null
- Find all records for files in a Folder
- findByFolders() : array<string|int, mixed>|null
- Find all records for files in an array of Folders
- findInStorageAndNotInUidList() : array<string|int, mixed>
- Helper function for the Indexer to detect missing files
- findInStorageWithIndexOutstanding() : array<string|int, mixed>
- Finds the files needed for second indexer step
- findOneByFileObject() : array<string|int, mixed>|bool
- Retrieves Index record for a given $fileObject
- findOneByStorageAndIdentifier() : array<string|int, mixed>|bool
- Retrieves Index record for a given $storageUid and $identifier
- findOneByStorageUidAndIdentifierHash() : array<string|int, mixed>|false
- Retrieves Index record for a given $storageUid and $identifier
- findOneByUid() : array<string|int, mixed>|false
- Retrieves Index record for a given $fileUid
- getInstance() : FileIndexRepository
- Returns an Instance of the Repository
- hasIndexRecord() : bool
- Checks if a file is indexed
- markFileAsMissing() : mixed
- Marks given file as missing in sys_file
- remove() : mixed
- Remove a sys_file record from the database
- update() : mixed
- Updates the index record in the database
- updateIndexingTime() : mixed
- Updates the timestamp when the file indexer extracted metadata
- updateRefIndex() : mixed
- Update Reference Index (sys_refindex) for a file
- insertRecord() : int
- Helper to reduce code duplication
Properties
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$fields
A list of properties which are to be persisted
protected
array<string|int, mixed>
$fields
= ['uid', 'pid', 'missing', 'type', 'storage', 'identifier', 'identifier_hash', 'extension', 'mime_type', 'name', 'sha1', 'size', 'creation_date', 'modification_date', 'folder_hash']
$table
protected
string
$table
= 'sys_file'
Methods
__construct()
public
__construct(EventDispatcherInterface $eventDispatcher) : mixed
Parameters
- $eventDispatcher : EventDispatcherInterface
add()
Adds a file to the index
public
add(File $file) : mixed
Parameters
- $file : File
addRaw()
Add data from record (at indexing time)
public
addRaw(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
Return values
array<string|int, mixed>findByContentHash()
Returns all indexed files which match the content hash Used by the indexer to detect already present files
public
findByContentHash(string $hash) : mixed
Parameters
- $hash : string
findByFolder()
Find all records for files in a Folder
public
findByFolder(Folder $folder) : array<string|int, mixed>|null
Parameters
- $folder : Folder
Return values
array<string|int, mixed>|nullfindByFolders()
Find all records for files in an array of Folders
public
findByFolders(array<string|int, Folder> $folders[, bool $includeMissing = true ][, string $fileName = null ]) : array<string|int, mixed>|null
Parameters
- $folders : array<string|int, Folder>
- $includeMissing : bool = true
- $fileName : string = null
Return values
array<string|int, mixed>|nullfindInStorageAndNotInUidList()
Helper function for the Indexer to detect missing files
public
findInStorageAndNotInUidList(ResourceStorage $storage, array<string|int, int> $uidList) : array<string|int, mixed>
Parameters
- $storage : ResourceStorage
- $uidList : array<string|int, int>
Return values
array<string|int, mixed>findInStorageWithIndexOutstanding()
Finds the files needed for second indexer step
public
findInStorageWithIndexOutstanding(ResourceStorage $storage[, int $limit = -1 ]) : array<string|int, mixed>
Parameters
- $storage : ResourceStorage
- $limit : int = -1
Return values
array<string|int, mixed>findOneByFileObject()
Retrieves Index record for a given $fileObject
public
findOneByFileObject(FileInterface $fileObject) : array<string|int, mixed>|bool
Parameters
- $fileObject : FileInterface
only for use from FileRepository
Return values
array<string|int, mixed>|boolfindOneByStorageAndIdentifier()
Retrieves Index record for a given $storageUid and $identifier
public
findOneByStorageAndIdentifier(ResourceStorage $storage, string $identifier) : array<string|int, mixed>|bool
Parameters
- $storage : ResourceStorage
- $identifier : string
only for use from FileRepository
Return values
array<string|int, mixed>|boolfindOneByStorageUidAndIdentifierHash()
Retrieves Index record for a given $storageUid and $identifier
public
findOneByStorageUidAndIdentifierHash(int $storageUid, string $identifierHash) : array<string|int, mixed>|false
Parameters
- $storageUid : int
- $identifierHash : string
only for use from FileRepository
Return values
array<string|int, mixed>|falsefindOneByUid()
Retrieves Index record for a given $fileUid
public
findOneByUid(int $fileUid) : array<string|int, mixed>|false
Parameters
- $fileUid : int
Return values
array<string|int, mixed>|falsegetInstance()
Returns an Instance of the Repository
public
static getInstance() : FileIndexRepository
will be removed in TYPO3 v12.0. Use Dependency Injection or GeneralUtility::makeInstance() if DI is not possible.
Return values
FileIndexRepositoryhasIndexRecord()
Checks if a file is indexed
public
hasIndexRecord(File $file) : bool
Parameters
- $file : File
Return values
boolmarkFileAsMissing()
Marks given file as missing in sys_file
public
markFileAsMissing(int $fileUid) : mixed
Parameters
- $fileUid : int
remove()
Remove a sys_file record from the database
public
remove(int $fileUid) : mixed
Parameters
- $fileUid : int
update()
Updates the index record in the database
public
update(File $file) : mixed
Parameters
- $file : File
updateIndexingTime()
Updates the timestamp when the file indexer extracted metadata
public
updateIndexingTime(int $fileUid) : mixed
Parameters
- $fileUid : int
updateRefIndex()
Update Reference Index (sys_refindex) for a file
public
updateRefIndex(int $id) : mixed
Parameters
- $id : int
-
Record UID
insertRecord()
Helper to reduce code duplication
protected
insertRecord(array<string|int, mixed> $data) : int
Parameters
- $data : array<string|int, mixed>