FileIndexRepository

class \TYPO3\CMS\Core\Resource\Index\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.

Table of Contents

Interfaces

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

Properties

$eventDispatcher  : EventDispatcherInterface
$fields  : array
A list of properties which are to be persisted
$table  : string

Methods

__construct()  : mixed
add()  : mixed
Adds a file to the index
addRaw()  : array
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|null
Find all records for files in a Folder
findByFolders()  : array|null
Find all records for files in an array of Folders
findInStorageAndNotInUidList()  : array
Helper function for the Indexer to detect missing files
findInStorageWithIndexOutstanding()  : array
Finds the files needed for second indexer step
findOneByFileObject()  : array|bool
Retrieves Index record for a given $fileObject
findOneByStorageAndIdentifier()  : array|bool
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
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 $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']

$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 $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) : mixed

Parameters

$hash : string

findByFolder()

Find all records for files in a Folder

public findByFolder(Folder $folder) : array|null

Parameters

$folder : Folder

Return values

array|null

findByFolders()

Find all records for files in an array of Folders

public findByFolders(Folder[] $folders[, bool $includeMissing = true ][, string $fileName = null ]) : array|null

Parameters

$folders : Folder[]
$includeMissing : bool = true
$fileName : string = null

Return values

array|null

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|bool

Parameters

$fileObject : FileInterface

Return values

array|bool

findOneByStorageAndIdentifier()

Retrieves Index record for a given $storageUid and $identifier

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

Parameters

$storage : ResourceStorage
$identifier : string

Return values

array|bool

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

getInstance()

Returns an Instance of the Repository

public static getInstance() : FileIndexRepository

Deprecated

will be removed in TYPO3 v12.0. Use Dependency Injection or GeneralUtility::makeInstance() if DI is not possible.

Return values

FileIndexRepository

hasIndexRecord()

Checks if a file is indexed

public hasIndexRecord(File $file) : bool

Parameters

$file : File

Return values

bool

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 $data) : int

Parameters

$data : array

Return values

int
On this page