TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
FileIndexRepository Class Reference
Inheritance diagram for FileIndexRepository:
SingletonInterface

Public Member Functions

 findOneByCombinedIdentifier ($combinedIdentifier)
 
 findOneByUid ($fileUid)
 
 findOneByStorageUidAndIdentifier ($storageUid, $identifier)
 
 findOneByStorageUidAndIdentifierHash ($storageUid, $identifierHash)
 
 findOneByFileObject (FileInterface $fileObject)
 
 findByContentHash ($hash)
 
 findByFolder (Folder $folder)
 
 findByFolders (array $folders, $includeMissing=true, $fileName=null)
 
 add (File $file)
 
 addRaw (array $data)
 
 hasIndexRecord (File $file)
 
 update (File $file)
 
 findInStorageWithIndexOutstanding (ResourceStorage $storage, $limit=-1)
 
 findInStorageAndNotInUidList (ResourceStorage $storage, array $uidList)
 
 updateIndexingTime ($fileUid)
 
 markFileAsMissing ($fileUid)
 
 remove ($fileUid)
 

Static Public Member Functions

static getInstance ()
 

Protected Member Functions

 getResourceFactory ()
 
 insertRecord (array $data)
 
 getSignalSlotDispatcher ()
 
 getObjectManager ()
 
 emitRecordUpdatedSignal (array $data)
 
 emitRecordCreatedSignal (array $data)
 
 emitRecordDeletedSignal ($fileUid)
 
 emitRecordMarkedAsMissingSignal ($fileUid)
 

Protected Attributes

 $table = 'sys_file'
 
 $fields
 

Detailed Description

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!.

Definition at line 38 of file FileIndexRepository.php.

Member Function Documentation

addRaw ( array  $data)

Add data from record (at indexing time)

Parameters
array$data
Returns
array

Definition at line 324 of file FileIndexRepository.php.

References FileIndexRepository\insertRecord().

emitRecordCreatedSignal ( array  $data)
protected

Signal that is called after an IndexRecord is created

Parameters
array$data

Definition at line 600 of file FileIndexRepository.php.

References FileIndexRepository\getSignalSlotDispatcher().

Referenced by FileIndexRepository\insertRecord().

emitRecordDeletedSignal (   $fileUid)
protected

Signal that is called after an IndexRecord is deleted

Parameters
int$fileUid

Definition at line 611 of file FileIndexRepository.php.

References FileIndexRepository\getSignalSlotDispatcher().

Referenced by FileIndexRepository\remove().

emitRecordMarkedAsMissingSignal (   $fileUid)
protected

Signal that is called after an IndexRecord is marked as missing

Parameters
int$fileUid

Definition at line 622 of file FileIndexRepository.php.

References FileIndexRepository\getSignalSlotDispatcher().

Referenced by FileIndexRepository\markFileAsMissing().

emitRecordUpdatedSignal ( array  $data)
protected

Signal that is called after an IndexRecord is updated

Parameters
array$data

Definition at line 589 of file FileIndexRepository.php.

References FileIndexRepository\getSignalSlotDispatcher().

Referenced by FileIndexRepository\update().

findByContentHash (   $hash)

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

Parameters
string$hash
Returns
mixed

Definition at line 174 of file FileIndexRepository.php.

References GeneralUtility\makeInstance().

findByFolder ( Folder  $folder)

Find all records for files in a Folder

Parameters
Folder$folder
Returns
array|NULL

Definition at line 201 of file FileIndexRepository.php.

References Folder\getHashedIdentifier(), Folder\getStorage(), and GeneralUtility\makeInstance().

findByFolders ( array  $folders,
  $includeMissing = true,
  $fileName = null 
)

Find all records for files in an array of Folders

Parameters
Folder[]$folders
bool$includeMissing
string$fileName
Returns
array|NULL

Definition at line 237 of file FileIndexRepository.php.

References GeneralUtility\makeInstance().

findInStorageAndNotInUidList ( ResourceStorage  $storage,
array  $uidList 
)

Helper function for the Indexer to detect missing files

Parameters
ResourceStorage$storage
array$uidList
Returns
array

Definition at line 462 of file FileIndexRepository.php.

References ResourceStorage\getUid(), and GeneralUtility\makeInstance().

findInStorageWithIndexOutstanding ( ResourceStorage  $storage,
  $limit = -1 
)

Finds the files needed for second indexer step

Parameters
ResourceStorage$storage
int$limit
Returns
array

Definition at line 433 of file FileIndexRepository.php.

References ResourceStorage\getUid(), and GeneralUtility\makeInstance().

findOneByCombinedIdentifier (   $combinedIdentifier)

Retrieves Index record for a given $combinedIdentifier

Parameters
string$combinedIdentifier
Returns
array|bool

Definition at line 81 of file FileIndexRepository.php.

References FileIndexRepository\findOneByStorageUidAndIdentifier(), and GeneralUtility\trimExplode().

findOneByFileObject ( FileInterface  $fileObject)

Retrieves Index record for a given $fileObject

Parameters
FileInterface$fileObject
Returns
array|bool

Definition at line 160 of file FileIndexRepository.php.

References FileIndexRepository\findOneByStorageUidAndIdentifierHash(), ResourceInterface\getHashedIdentifier(), and ResourceInterface\getStorage().

Referenced by FileIndexRepository\add().

findOneByStorageUidAndIdentifier (   $storageUid,
  $identifier 
)

Retrieves Index record for a given $storageUid and $identifier

Parameters
int$storageUid
string$identifier
Returns
array|bool

Definition at line 119 of file FileIndexRepository.php.

References FileIndexRepository\findOneByStorageUidAndIdentifierHash(), and FileIndexRepository\getResourceFactory().

Referenced by FileIndexRepository\findOneByCombinedIdentifier().

findOneByStorageUidAndIdentifierHash (   $storageUid,
  $identifierHash 
)

Retrieves Index record for a given $storageUid and $identifier

Parameters
int$storageUid
string$identifierHash
Returns
array|bool

Definition at line 134 of file FileIndexRepository.php.

References GeneralUtility\makeInstance().

Referenced by FileIndexRepository\findOneByFileObject(), and FileIndexRepository\findOneByStorageUidAndIdentifier().

findOneByUid (   $fileUid)

Retrieves Index record for a given $fileUid

Parameters
int$fileUid
Returns
array|bool

Definition at line 93 of file FileIndexRepository.php.

References GeneralUtility\makeInstance().

getObjectManager ( )
protected

Get the ObjectManager

Returns
ObjectManager

Definition at line 578 of file FileIndexRepository.php.

References GeneralUtility\makeInstance().

Referenced by FileIndexRepository\getSignalSlotDispatcher().

getResourceFactory ( )
protected
hasIndexRecord ( File  $file)

Checks if a file is indexed

Parameters
File$file
Returns
bool

Definition at line 358 of file FileIndexRepository.php.

References File\_getPropertyRaw(), AbstractFile\getStorage(), AbstractFile\getUid(), and GeneralUtility\makeInstance().

Referenced by FileIndexRepository\add().

insertRecord ( array  $data)
protected

Helper to reduce code duplication

Parameters
array$data
Returns
int

Definition at line 337 of file FileIndexRepository.php.

References FileIndexRepository\emitRecordCreatedSignal(), and GeneralUtility\makeInstance().

Referenced by FileIndexRepository\add(), and FileIndexRepository\addRaw().

markFileAsMissing (   $fileUid)

Marks given file as missing in sys_file

Parameters
int$fileUid
Returns
void

Definition at line 516 of file FileIndexRepository.php.

References FileIndexRepository\emitRecordMarkedAsMissingSignal(), and GeneralUtility\makeInstance().

remove (   $fileUid)

Remove a sys_file record from the database

Parameters
int$fileUid
Returns
void

Definition at line 537 of file FileIndexRepository.php.

References FileIndexRepository\emitRecordDeletedSignal(), and GeneralUtility\makeInstance().

updateIndexingTime (   $fileUid)

Updates the timestamp when the file indexer extracted metadata

Parameters
int$fileUid
Returns
void

Definition at line 496 of file FileIndexRepository.php.

References GeneralUtility\makeInstance().

Member Data Documentation

$fields
protected
Initial value:
= [
'uid', 'pid', 'missing', 'type', 'storage', 'identifier', 'identifier_hash', 'extension',
'mime_type', 'name', 'sha1', 'size', 'creation_date', 'modification_date', 'folder_hash'
]

Definition at line 50 of file FileIndexRepository.php.

$table = 'sys_file'
protected

Definition at line 43 of file FileIndexRepository.php.