TYPO3  7.6
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FileIndexRepository Class Reference
Inheritance diagram for FileIndexRepository:
SingletonInterface

Public Member Functions

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

Static Public Member Functions

static getInstance ()
 

Protected Member Functions

 getDatabaseConnection ()
 
 getResourceFactory ()
 
 insertRecord (array $data)
 
 getWhereClauseForFile (File $file)
 
 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 TCEmain has to use this Repository class.

This is meant for FAL internal use only!.

Definition at line 30 of file FileIndexRepository.php.

Member Function Documentation

add ( File  $file)
addRaw ( array  $data)

Add data from record (at indexing time)

Parameters
array$data
Returns
array

Definition at line 258 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 460 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 471 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 482 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 449 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 162 of file FileIndexRepository.php.

References FileIndexRepository\getDatabaseConnection().

findByFolder ( \TYPO3\CMS\Core\Resource\Folder  $folder)

Find all records for files in a Folder

Parameters
\TYPO3\CMS\Core\Resource\Folder$folder
Returns
array|NULL

Definition at line 181 of file FileIndexRepository.php.

References FileIndexRepository\$table, and FileIndexRepository\getDatabaseConnection().

findByFolders ( array  $folders,
  $includeMissing = true 
)

Find all records for files in an array of Folders

Parameters
\TYPO3\CMS\Core\Resource\Folder[]$folders
bool$includeMissing
Returns
array|NULL

Definition at line 203 of file FileIndexRepository.php.

References FileIndexRepository\getDatabaseConnection().

findInStorageAndNotInUidList ( \TYPO3\CMS\Core\Resource\ResourceStorage  $storage,
array  $uidList 
)

Helper function for the Indexer to detect missing files

Parameters
\TYPO3\CMS\Core\Resource\ResourceStorage$storage
array$uidList
Returns
array

Definition at line 340 of file FileIndexRepository.php.

References FileIndexRepository\getDatabaseConnection().

findInStorageWithIndexOutstanding ( \TYPO3\CMS\Core\Resource\ResourceStorage  $storage,
  $limit = -1 
)

Finds the files needed for second indexer step

Parameters
\TYPO3\CMS\Core\Resource\ResourceStorage$storage
int$limit
Returns
array

Definition at line 320 of file FileIndexRepository.php.

References FileIndexRepository\getDatabaseConnection().

findOneByCombinedIdentifier (   $combinedIdentifier)

Retrieves Index record for a given $combinedIdentifier

Parameters
string$combinedIdentifier
Returns
array|boolean

Definition at line 84 of file FileIndexRepository.php.

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

findOneByFileObject ( \TYPO3\CMS\Core\Resource\FileInterface  $fileObject)

Retrieves Index record for a given $fileObject

Parameters
\TYPO3\CMS\Core\Resource\FileInterface$fileObject
Returns
array|boolean

Definition at line 148 of file FileIndexRepository.php.

References FileIndexRepository\findOneByStorageUidAndIdentifierHash().

Referenced by FileIndexRepository\add().

findOneByStorageUidAndIdentifier (   $storageUid,
  $identifier 
)

Retrieves Index record for a given $storageUid and $identifier

Parameters
int$storageUid
string$identifier
Returns
array|boolean

Definition at line 115 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|boolean

Definition at line 130 of file FileIndexRepository.php.

References FileIndexRepository\getDatabaseConnection().

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

findOneByUid (   $fileUid)

Retrieves Index record for a given $fileUid

Parameters
int$fileUid
Returns
array|boolean

Definition at line 96 of file FileIndexRepository.php.

References FileIndexRepository\getDatabaseConnection().

getDatabaseConnection ( )
protected
static getInstance ( )
static
getObjectManager ( )
protected

Get the ObjectManager

Returns

Definition at line 436 of file FileIndexRepository.php.

Referenced by FileIndexRepository\getSignalSlotDispatcher().

getResourceFactory ( )
protected

Gets the Resource Factory

Returns

Definition at line 62 of file FileIndexRepository.php.

Referenced by FileIndexRepository\findOneByStorageUidAndIdentifier().

getSignalSlotDispatcher ( )
protected
getWhereClauseForFile ( File  $file)
protected

Returns a where clause to find a file in database

Parameters
File$file
Returns
string

Definition at line 379 of file FileIndexRepository.php.

References FileIndexRepository\$table, File\_getPropertyRaw(), FileIndexRepository\getDatabaseConnection(), AbstractFile\getStorage(), and AbstractFile\getUid().

Referenced by FileIndexRepository\hasIndexRecord(), and FileIndexRepository\update().

hasIndexRecord ( File  $file)

Checks if a file is indexed

Parameters
File$file
Returns
bool

Definition at line 287 of file FileIndexRepository.php.

References FileIndexRepository\getDatabaseConnection(), and FileIndexRepository\getWhereClauseForFile().

Referenced by FileIndexRepository\add().

insertRecord ( array  $data)
protected

Helper to reduce code duplication

Parameters
array$data
Returns
int

Definition at line 271 of file FileIndexRepository.php.

References FileIndexRepository\emitRecordCreatedSignal(), and FileIndexRepository\getDatabaseConnection().

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 366 of file FileIndexRepository.php.

References FileIndexRepository\emitRecordMarkedAsMissingSignal(), and FileIndexRepository\getDatabaseConnection().

remove (   $fileUid)

Remove a sys_file record from the database

Parameters
int$fileUid
Returns
void

Definition at line 399 of file FileIndexRepository.php.

References FileIndexRepository\emitRecordDeletedSignal(), and FileIndexRepository\getDatabaseConnection().

update ( File  $file)
updateIndexingTime (   $fileUid)

Updates the timestamp when the file indexer extracted metadata

Parameters
int$fileUid
Returns
void

Definition at line 355 of file FileIndexRepository.php.

References FileIndexRepository\getDatabaseConnection().

Member Data Documentation

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

Definition at line 42 of file FileIndexRepository.php.

$table = 'sys_file'
protected