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.

Internal

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()  : void
Adds a file to the index
addRaw()  : array<string|int, mixed>
Add data from record (at indexing time)
findByContentHash()  : array<string|int, mixed>
Returns all indexed files which match the content hash Used by the indexer to detect already present files
findByFolder()  : array<string|int, mixed>
Find all records for files in a Folder
findByFolders()  : array<string|int, mixed>
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>|false
Retrieves Index record for a given $fileObject
findOneByStorageAndIdentifier()  : array<string|int, mixed>|false
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
hasIndexRecord()  : bool
Checks if a file is indexed
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
updateRefIndex()  : void
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) : void
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) : array<string|int, mixed>
Parameters
$hash : string
Return values
array<string|int, mixed>

findByFolder()

Find all records for files in a Folder

public findByFolder(Folder $folder) : array<string|int, mixed>
Parameters
$folder : Folder
Return values
array<string|int, mixed>

findByFolders()

Find all records for files in an array of Folders

public findByFolders(array<string|int, Folder$folders[, bool $includeMissing = true ][, string|null $fileName = null ]) : array<string|int, mixed>
Parameters
$folders : array<string|int, Folder>
$includeMissing : bool = true
$fileName : string|null = null
Return values
array<string|int, mixed>

findInStorageAndNotInUidList()

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>|false
Parameters
$fileObject : FileInterface
Internal

only for use from FileRepository

Return values
array<string|int, mixed>|false

findOneByStorageAndIdentifier()

Retrieves Index record for a given $storageUid and $identifier

public findOneByStorageAndIdentifier(ResourceStorage $storage, string $identifier) : array<string|int, mixed>|false
Parameters
$storage : ResourceStorage
$identifier : string
Internal

only for use from FileRepository

Return values
array<string|int, mixed>|false

findOneByStorageUidAndIdentifierHash()

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
Internal

only for use from FileRepository

Return values
array<string|int, mixed>|false

findOneByUid()

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

hasIndexRecord()

Checks if a file is indexed

public hasIndexRecord(File $file) : bool
Parameters
$file : File
Return values
bool

markFileAsMissing()

Marks given file as missing in sys_file

public markFileAsMissing(int $fileUid) : void
Parameters
$fileUid : int

remove()

Remove a sys_file record from the database

public remove(int $fileUid) : void
Parameters
$fileUid : int

update()

Updates the index record in the database

public update(File $file) : void
Parameters
$file : File

updateIndexingTime()

Updates the timestamp when the file indexer extracted metadata

public updateIndexingTime(int $fileUid) : void
Parameters
$fileUid : int

updateRefIndex()

Update Reference Index (sys_refindex) for a file

public updateRefIndex(int $id) : void
Parameters
$id : int

insertRecord()

Helper to reduce code duplication

protected insertRecord(array<string|int, mixed> $data) : int
Parameters
$data : array<string|int, mixed>
Return values
int

        
On this page

Search results