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

Public Member Functions

 __construct (\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher=null)
 
 convertFlexFormDataToConfigurationArray ($flexFormData)
 
 createStorageObject (array $storageRecord, array $storageConfiguration=null)
 
 createFolderObject (ResourceStorage $storage, $identifier, $name)
 
 getFileObject ($uid, array $fileData=array())
 
 getFileObjectFromCombinedIdentifier ($identifier)
 
 getFileObjectByStorageAndIdentifier ($storageUid, &$fileIdentifier)
 
 retrieveFileOrFolderObject ($input)
 
 getFolderObjectFromCombinedIdentifier ($identifier)
 
 getStorageObjectFromCombinedIdentifier ($identifier)
 
 getObjectFromCombinedIdentifier ($identifier)
 
 getFileReferenceObject ($uid, array $fileReferenceData=array(), $raw=false)
 

Static Public Member Functions

static getInstance ()
 

Protected Member Functions

 emitPostProcessStorageSignal (ResourceStorage $storageObject)
 
 findBestMatchingStorageByLocalPath (&$localPath)
 
 getFileIndexRepository ()
 
 getProcessedFileRepository ()
 
 getIndexer (ResourceStorage $storage)
 

Protected Attributes

 $storageInstances = array()
 
 $collectionInstances = array()
 
 $fileInstances = array()
 
 $fileReferenceInstances = array()
 
 $localDriverStorageCache = null
 
 $signalSlotDispatcher
 

Additional Inherited Members

- Public Attributes inherited from ResourceFactoryInterface
const SIGNAL_PostProcessStorage = 'postProcessStorage'
 

Detailed Description

Factory class for FAL objects

Definition at line 26 of file ResourceFactory.php.

Constructor & Destructor Documentation

__construct ( \TYPO3\CMS\Extbase\SignalSlot\Dispatcher  $signalSlotDispatcher = null)

Inject signal slot dispatcher

Definition at line 73 of file ResourceFactory.php.

References ResourceFactory\$signalSlotDispatcher, and GeneralUtility\makeInstance().

Member Function Documentation

convertFlexFormDataToConfigurationArray (   $flexFormData)

Converts a flexform data string to a flat array with key value pairs

Parameters
string$flexFormData
Returns
array Array with key => value pairs of the field data in the FlexForm

Definition at line 247 of file ResourceFactory.php.

References GeneralUtility\xml2array().

Referenced by ResourceFactory\createStorageObject().

createFolderObject ( ResourceStorage  $storage,
  $identifier,
  $name 
)

Creates a folder to directly access (a part of) a storage.

Parameters
ResourceStorage$storageThe storage the folder belongs to
string$identifierThe path to the folder. Might also be a simple unique string, depending on the storage driver.
string$nameThe name of the folder (e.g. the folder name)
Returns
Folder

Definition at line 333 of file ResourceFactory.php.

References GeneralUtility\makeInstance().

createStorageObject ( array  $storageRecord,
array  $storageConfiguration = null 
)

Creates a storage object from a storage database row.

Parameters
array$storageRecord
array$storageConfigurationStorage configuration (if given, this won't be extracted from the FlexForm value but the supplied array used instead)
Returns
ResourceStorage

Definition at line 314 of file ResourceFactory.php.

References ResourceFactory\convertFlexFormDataToConfigurationArray(), and GeneralUtility\makeInstance().

emitPostProcessStorageSignal ( ResourceStorage  $storageObject)
protected

Emits a signal after a resource storage was initialized

Parameters
ResourceStorage$storageObject

Definition at line 183 of file ResourceFactory.php.

findBestMatchingStorageByLocalPath ( $localPath)
protected

Checks whether a file resides within a real storage in local file system. If no match is found, uid 0 is returned which is a fallback storage pointing to PATH_site.

The file identifier is adapted accordingly to match the new storage's base path.

Parameters
string$localPath
Returns
int

Definition at line 198 of file ResourceFactory.php.

References PathUtility\getCommonPrefix().

getFileIndexRepository ( )
protected

Returns an instance of the FileIndexRepository

Returns
FileIndexRepository

Definition at line 643 of file ResourceFactory.php.

References FileIndexRepository\getInstance().

Referenced by ResourceFactory\getFileObject(), and ResourceFactory\getFileObjectByStorageAndIdentifier().

getFileObject (   $uid,
array  $fileData = array() 
)

Creates an instance of the file given UID. The $fileData can be supplied to increase performance.

Parameters
int$uidThe uid of the file to instantiate.
array$fileDataThe record row from database.
Exceptions
\InvalidArgumentException
\TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException
Returns
File

Definition at line 349 of file ResourceFactory.php.

References ResourceFactory\getFileIndexRepository().

Referenced by ResourceFactory\getFileObjectByStorageAndIdentifier(), and ResourceFactory\retrieveFileOrFolderObject().

getFileObjectByStorageAndIdentifier (   $storageUid,
$fileIdentifier 
)

Gets an file object from storage by file identifier If the file is outside of the process folder it gets indexed and returned as file object afterwards If the file is within processing folder the file object will be directly returned

Parameters
int$storageUid
string$fileIdentifier
Returns
NULL|File|ProcessedFile

Definition at line 404 of file ResourceFactory.php.

References ResourceFactory\getFileIndexRepository(), ResourceFactory\getFileObject(), ResourceFactory\getIndexer(), and ResourceFactory\getProcessedFileRepository().

Referenced by ResourceFactory\getFileObjectFromCombinedIdentifier().

getFileObjectFromCombinedIdentifier (   $identifier)

Gets an file object from an identifier [storage]:[fileId]

Parameters
string$identifier
Returns
File
Exceptions
\InvalidArgumentException

Definition at line 374 of file ResourceFactory.php.

References ResourceFactory\getFileObjectByStorageAndIdentifier(), and GeneralUtility\trimExplode().

Referenced by ResourceFactory\retrieveFileOrFolderObject().

getFileReferenceObject (   $uid,
array  $fileReferenceData = array(),
  $raw = false 
)

Creates an instance of a FileReference object. The $fileReferenceData can be supplied to increase performance.

Parameters
int$uidThe uid of the file usage (sys_file_reference) to instantiate.
array$fileReferenceDataThe record row from database.
bool$rawWhether to get raw results without performing overlays
Returns
FileReference
Exceptions
\InvalidArgumentException
\TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException

Definition at line 579 of file ResourceFactory.php.

getFolderObjectFromCombinedIdentifier (   $identifier)

Gets a folder object from an identifier [storage]:[fileId]

check naming, inserted by SteffenR while working on filelist

Parameters
string$identifier
Returns
Folder

Definition at line 489 of file ResourceFactory.php.

References GeneralUtility\isFirstPartOfStr(), and GeneralUtility\trimExplode().

Referenced by ResourceFactory\retrieveFileOrFolderObject().

getIndexer ( ResourceStorage  $storage)
protected

Returns an instance of the Indexer

Returns

Definition at line 663 of file ResourceFactory.php.

References GeneralUtility\makeInstance().

Referenced by ResourceFactory\getFileObjectByStorageAndIdentifier().

static getInstance ( )
static

Gets a singleton instance of this class.

Returns
ResourceFactory

Definition at line 33 of file ResourceFactory.php.

References GeneralUtility\makeInstance().

Referenced by ResourceStorage\__construct(), ContentObjectRenderer\__wakeup(), ResourceStorage\addFile(), ResourceStorage\addFileMount(), OnlineMediaController\addMediaFromUrl(), FileLinkHandler\canHandleLink(), FileMetadataPermissionsAspect\checkFileWriteAccessForFileMetaData(), ResourceStorage\createFile(), ShortcutToolbarItem\createShortcutAction(), FileDumpController\dumpAction(), ImportExport\export_addFilesFromSysFilesRecords(), ImageManipulationElement\getFile(), ResourceStorage\getFolder(), DefaultAvatarProvider\getImage(), MetaInformation\getPath(), ResourceStorage\getProcessingFolder(), MetaInformation\getRecordInformation(), ReferenceIndex\getRelations_procFiles(), AbstractOnlineMediaHelper\getResourceFactory(), DataHandler\getResourceFactory(), ResourceStorage\getRootLevelFolder(), ImageManipulationWizard\getWizardAction(), ContentObjectRenderer\imageLinkWrap(), FileUploadController\init(), ReplaceFileController\init(), CreateFolderController\init(), EditFileController\init(), ElementInformationController\initFileOrFolderRecord(), ShowImageController\initialize(), SelectImage\main_rte(), Clipboard\printContentFromTab(), ClickMenu\printFileClickMenu(), FileInfoHook\renderFileInfo(), FileInfoHook\renderFileMetadataInfo(), InlineRecordContainer\renderForeignRecordHeader(), SetupModuleController\setAvatarFileUid(), ExtendedFileUtility\start(), FileList\start(), File\updateProperties(), FileStorageIndexingAdditionalFieldProvider\validateAdditionalFields(), and FileStorageExtractionAdditionalFieldProvider\validateAdditionalFields().

getObjectFromCombinedIdentifier (   $identifier)

Gets a file or folder object.

Parameters
string$identifier
Exceptions
\TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException
Returns
FileInterface|Folder

Definition at line 532 of file ResourceFactory.php.

References elseif, and GeneralUtility\trimExplode().

Referenced by ResourceFactory\retrieveFileOrFolderObject().

getProcessedFileRepository ( )
protected
getStorageObjectFromCombinedIdentifier (   $identifier)

Gets a storage object from a combined identifier

Parameters
string$identifierAn identifier of the form [storage uid]:[object identifier]
Returns
ResourceStorage

Definition at line 517 of file ResourceFactory.php.

References GeneralUtility\trimExplode().

retrieveFileOrFolderObject (   $input)

Bulk function, can be used for anything to get a file or folder

  1. It's a UID
  2. It's a combined identifier
  3. It's just a path/filename (coming from the oldstyle/backwards compatibility)

Files, previously laid on fileadmin/ or something, will be "mapped" to the storage the file is in now. Files like typo3temp/ or typo3conf/ will be moved to the first writable storage in its processing folder

$input could be

  • "2:myfolder/myfile.jpg" (combined identifier)
  • "23" (file UID)
  • "uploads/myfile.png" (backwards-compatibility, storage "0")
  • "file:23"
Parameters
string$input
Returns
File|Folder

Definition at line 441 of file ResourceFactory.php.

References PathUtility\basename(), MathUtility\canBeInterpretedAsInteger(), PathUtility\dirname(), elseif, GeneralUtility\getFileAbsFileName(), ResourceFactory\getFileObject(), ResourceFactory\getFileObjectFromCombinedIdentifier(), ResourceFactory\getFolderObjectFromCombinedIdentifier(), ResourceFactory\getObjectFromCombinedIdentifier(), PathUtility\getRelativePath(), and GeneralUtility\isFirstPartOfStr().

Member Data Documentation

$collectionInstances = array()
protected

Definition at line 46 of file ResourceFactory.php.

$fileInstances = array()
protected

Definition at line 51 of file ResourceFactory.php.

$fileReferenceInstances = array()
protected

Definition at line 56 of file ResourceFactory.php.

$localDriverStorageCache = null
protected

Definition at line 63 of file ResourceFactory.php.

$signalSlotDispatcher
protected

Definition at line 68 of file ResourceFactory.php.

Referenced by ResourceFactory\__construct().

$storageInstances = array()
protected

Definition at line 41 of file ResourceFactory.php.