FileIndexRepository

readonly class \TYPO3\CMS\Core\Resource\Index\FileIndexRepository

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.

Attributes

#[Autoconfigure]
$public: true

Table of Contents

Constants

FIELDS  : mixed = ['uid', 'pid', 'missing', 'type', 'storage', 'i...
A list of properties which are to be persisted

Methods

__construct()  : mixed
add()  : void
Adds a file to the index
addRaw()  : array
Add data from record (at indexing time)
findByContentHash()  : array
Returns all indexed files which match the content hash Used by the indexer to detect already present files
findByFolder()  : array
Find all records for files in a Folder
findInStorageAndNotInUidList()  : array
Helper function for the Indexer to detect missing files
findInStorageWithIndexOutstanding()  : array
Finds the files needed for second indexer step
findOneByFileObject()  : array|false
Retrieves Index record for a given $fileObject
findOneByStorageAndIdentifier()  : array|false
Retrieves Index record for a given $storageUid and $identifier
findOneByStorageUidAndIdentifierHash()  : array|false
Retrieves Index record for a given $storageUid and $identifier
findOneByUid()  : array|false
Retrieves Index record for a given $fileUid
hasIndexRecord()  : bool
Checks if a file is indexed
iterateUidsAndIdentifiersInStorage()  : Generator<string|int, array{uid: int, identifier: string}>
Helper function for the Indexer to detect missing files without holding all records of a storage in memory
markFileAsMissing()  : void
Marks given file as missing in sys_file
remove()  : void
Remove a sys_file record from the database
update()  : void
Updates the index record in the database
updateIndexingTime()  : void
Updates the timestamp when the file indexer extracted metadata
insertRecord()  : int
Helper to reduce code duplication
updateRefIndex()  : void
Update Reference Index (sys_refindex) for a file

Constants

FIELDS

A list of properties which are to be persisted

protected mixed FIELDS = ['uid', 'pid', 'missing', 'type', 'storage', 'identifier', '…
Show the full value['uid', 'pid', 'missing', 'type', 'storage', 'identifier', 'identifier_hash', 'extension', 'mime_type', 'name', 'sha1', 'size', 'creation_date', 'modification_date', 'folder_hash']

Methods

__construct()

public __construct(EventDispatcherInterface $eventDispatcher, ConnectionPool $connectionPool) : mixed

Parameters

$eventDispatcher : EventDispatcherInterface
$connectionPool : ConnectionPool

add()

Adds a file to the index

public add(File $file) : void

Parameters

$file : File

addRaw()

Add data from record (at indexing time)

public addRaw(array $data) : array

Parameters

$data : array

Return values

array

findByContentHash()

Returns all indexed files which match the content hash Used by the indexer to detect already present files

public findByContentHash(string $hash) : array

Parameters

$hash : string

Return values

array

findByFolder()

Find all records for files in a Folder

public findByFolder(Folder $folder) : array

Parameters

$folder : Folder

Return values

array

findInStorageAndNotInUidList()

Helper function for the Indexer to detect missing files

public findInStorageAndNotInUidList(ResourceStorage $storage, int[] $uidList) : array

Parameters

$storage : ResourceStorage
$uidList : int[]

Return values

array

findInStorageWithIndexOutstanding()

Finds the files needed for second indexer step

public findInStorageWithIndexOutstanding(ResourceStorage $storage[, int $limit = -1 ]) : array

Parameters

$storage : ResourceStorage
$limit : int = -1

Return values

array

findOneByFileObject()

Retrieves Index record for a given $fileObject

public findOneByFileObject(FileInterface $fileObject) : array|false

Parameters

$fileObject : FileInterface

Return values

array|false

findOneByStorageAndIdentifier()

Retrieves Index record for a given $storageUid and $identifier

public findOneByStorageAndIdentifier(ResourceStorage $storage, string $identifier) : array|false

Parameters

$storage : ResourceStorage
$identifier : string

Return values

array|false

findOneByStorageUidAndIdentifierHash()

Retrieves Index record for a given $storageUid and $identifier

public findOneByStorageUidAndIdentifierHash(int $storageUid, string $identifierHash) : array|false

Parameters

$storageUid : int
$identifierHash : string

Return values

array|false

findOneByUid()

Retrieves Index record for a given $fileUid

public findOneByUid(int $fileUid) : array|false

Parameters

$fileUid : int

Return values

array|false

hasIndexRecord()

Checks if a file is indexed

public hasIndexRecord(File $file) : bool

Parameters

$file : File

Return values

bool

iterateUidsAndIdentifiersInStorage()

Helper function for the Indexer to detect missing files without holding all records of a storage in memory

public iterateUidsAndIdentifiersInStorage(ResourceStorage $storage) : Generator<string|int, array{uid: int, identifier: string}>

Parameters

$storage : ResourceStorage

Return values

Generator<string|int, array{uid: int, identifier: string}>

updateIndexingTime()

Updates the timestamp when the file indexer extracted metadata

public updateIndexingTime(int $fileUid) : void

Parameters

$fileUid : int

insertRecord()

Helper to reduce code duplication

protected insertRecord(array $data) : int

Parameters

$data : array

Return values

int

updateRefIndex()

Update Reference Index (sys_refindex) for a file

protected updateRefIndex(int $id) : void

Parameters

$id : int
On this page