TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Resource\ResourceFactory Class Reference
Inheritance diagram for TYPO3\CMS\Core\Resource\ResourceFactory:
TYPO3\CMS\Core\Resource\ResourceFactoryInterface TYPO3\CMS\Core\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=[])
 
 getFileObjectFromCombinedIdentifier ($identifier)
 
 getFileObjectByStorageAndIdentifier ($storageUid, &$fileIdentifier)
 
 retrieveFileOrFolderObject ($input)
 
 getFolderObjectFromCombinedIdentifier ($identifier)
 
 getStorageObjectFromCombinedIdentifier ($identifier)
 
 getObjectFromCombinedIdentifier ($identifier)
 
 getFileReferenceObject ($uid, array $fileReferenceData=[], $raw=false)
 

Static Public Member Functions

static getInstance ()
 

Protected Member Functions

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

Protected Attributes

 $storageInstances = []
 
 $collectionInstances = []
 
 $fileInstances = []
 
 $fileReferenceInstances = []
 
 $localDriverStorageCache = null
 
 $signalSlotDispatcher
 

Additional Inherited Members

- Public Attributes inherited from TYPO3\CMS\Core\Resource\ResourceFactoryInterface
const SIGNAL_PostProcessStorage = 'postProcessStorage'
 

Detailed Description

Factory class for FAL objects

Definition at line 27 of file ResourceFactory.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ convertFlexFormDataToConfigurationArray()

TYPO3\CMS\Core\Resource\ResourceFactory::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 $GLOBALS, $uid, and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Core\Resource\ResourceFactory\createStorageObject().

◆ createFolderObject()

TYPO3\CMS\Core\Resource\ResourceFactory::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 327 of file ResourceFactory.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ createStorageObject()

TYPO3\CMS\Core\Resource\ResourceFactory::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 308 of file ResourceFactory.php.

References TYPO3\CMS\Core\Resource\ResourceFactory\convertFlexFormDataToConfigurationArray(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Core\Resource\ResourceFactory\__construct().

◆ emitPostProcessStorageSignal()

TYPO3\CMS\Core\Resource\ResourceFactory::emitPostProcessStorageSignal ( ResourceStorage  $storageObject)
protected

Emits a signal after a resource storage was initialized

Parameters
ResourceStorage$storageObject

Definition at line 183 of file ResourceFactory.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceFactory\__construct().

◆ findBestMatchingStorageByLocalPath()

TYPO3\CMS\Core\Resource\ResourceFactory::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 TYPO3\CMS\Core\Utility\PathUtility\getCommonPrefix(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Core\Resource\ResourceFactory\__construct().

◆ getFileIndexRepository()

TYPO3\CMS\Core\Resource\ResourceFactory::getFileIndexRepository ( )
protected

◆ getFileObject()

TYPO3\CMS\Core\Resource\ResourceFactory::getFileObject (   $uid,
array  $fileData = [] 
)

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

Definition at line 343 of file ResourceFactory.php.

References $uid, and TYPO3\CMS\Core\Resource\ResourceFactory\getFileIndexRepository().

Referenced by TYPO3\CMS\Core\Resource\ResourceFactory\getFileObjectByStorageAndIdentifier(), and TYPO3\CMS\Core\Resource\ResourceFactory\retrieveFileOrFolderObject().

◆ getFileObjectByStorageAndIdentifier()

TYPO3\CMS\Core\Resource\ResourceFactory::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 398 of file ResourceFactory.php.

References TYPO3\CMS\Core\Resource\ResourceFactory\getFileIndexRepository(), TYPO3\CMS\Core\Resource\ResourceFactory\getFileObject(), TYPO3\CMS\Core\Resource\ResourceFactory\getIndexer(), and TYPO3\CMS\Core\Resource\ResourceFactory\getProcessedFileRepository().

Referenced by TYPO3\CMS\Core\Resource\ResourceFactory\getFileObjectFromCombinedIdentifier().

◆ getFileObjectFromCombinedIdentifier()

TYPO3\CMS\Core\Resource\ResourceFactory::getFileObjectFromCombinedIdentifier (   $identifier)

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

Parameters
string$identifier
Returns
File
Exceptions

Definition at line 368 of file ResourceFactory.php.

References TYPO3\CMS\Core\Resource\ResourceFactory\getFileObjectByStorageAndIdentifier(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Core\Resource\ResourceFactory\retrieveFileOrFolderObject().

◆ getFileReferenceObject()

TYPO3\CMS\Core\Resource\ResourceFactory::getFileReferenceObject (   $uid,
array  $fileReferenceData = [],
  $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

Definition at line 573 of file ResourceFactory.php.

References $GLOBALS, $uid, TYPO3\CMS\Backend\Utility\BackendUtility\getRecordWSOL(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ getFolderObjectFromCombinedIdentifier()

TYPO3\CMS\Core\Resource\ResourceFactory::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 483 of file ResourceFactory.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\isFirstPartOfStr(), TYPO3\CMS\Core\Utility\PathUtility\stripPathSitePrefix(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Core\Resource\ResourceFactory\retrieveFileOrFolderObject().

◆ getIndexer()

TYPO3\CMS\Core\Resource\ResourceFactory::getIndexer ( ResourceStorage  $storage)
protected

Returns an instance of the Indexer

Returns

Definition at line 657 of file ResourceFactory.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Core\Resource\ResourceFactory\getFileObjectByStorageAndIdentifier().

◆ getInstance()

static TYPO3\CMS\Core\Resource\ResourceFactory::getInstance ( )
static

Gets a singleton instance of this class.

Returns
ResourceFactory

Definition at line 34 of file ResourceFactory.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Core\Resource\ResourceStorage\__construct(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\__wakeup(), TYPO3\CMS\Core\Resource\ResourceStorage\addFile(), TYPO3\CMS\Core\Resource\ResourceStorage\addFileMount(), TYPO3\CMS\Backend\Controller\OnlineMediaController\addMediaFromUrl(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\addParams(), TYPO3\CMS\Core\DataHandling\DataHandler\applyFiltersToValues(), TYPO3\CMS\Rtehtmlarea\Controller\SelectImageController\buildImageMarkup(), TYPO3\CMS\Rtehtmlarea\ImageHandler\EditImageHandler\canHandleLink(), TYPO3\CMS\Recordlist\LinkHandler\FileLinkHandler\canHandleLink(), TYPO3\CMS\Core\Resource\Security\FileMetadataPermissionsAspect\checkFileWriteAccessForFileMetaData(), TYPO3\CMS\Impexp\Import\checkImportPrerequisites(), TYPO3\CMS\Scheduler\Task\RecyclerGarbageCollectionTask\cleanupRecycledFiles(), TYPO3\CMS\Core\Resource\ResourceStorage\copyFile(), TYPO3\CMS\Core\Resource\ResourceStorage\createFile(), TYPO3\CMS\Backend\Backend\ToolbarItems\ShortcutToolbarItem\createShortcutAction(), TYPO3\CMS\Core\Controller\FileDumpController\dumpAction(), TYPO3\CMS\Scheduler\Task\FileStorageIndexingTask\execute(), TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask\execute(), TYPO3\CMS\Impexp\Export\export_addFilesFromSysFilesRecords(), TYPO3\CMS\Backend\ClickMenu\ClickMenu\FILE_delete(), TYPO3\CMS\Core\Resource\Filter\FileExtensionFilter\filterInlineChildren(), TYPO3\CMS\Recordlist\LinkHandler\FileLinkHandler\formatCurrentUrl(), TYPO3\CMS\Core\Utility\File\ExtendedFileUtility\func_edit(), TYPO3\CMS\Impexp\Controller\ImportExportController\getButtons(), TYPO3\CMS\Backend\Form\Element\ImageManipulationElement\getFile(), TYPO3\CMS\Impexp\Controller\ImportExportController\getFile(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getFilePermissionsForStorage(), TYPO3\CMS\Core\Resource\ResourceStorage\getFolder(), TYPO3\CMS\Backend\Backend\Avatar\DefaultAvatarProvider\getImage(), TYPO3\CMS\Extbase\Domain\Model\File\getOriginalResource(), TYPO3\CMS\Extbase\Domain\Model\FileReference\getOriginalResource(), TYPO3\CMS\Backend\Template\Components\MetaInformation\getPath(), TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolder(), TYPO3\CMS\Backend\Template\Components\MetaInformation\getRecordInformation(), TYPO3\CMS\Core\Database\ReferenceIndex\getRelations_procFiles(), TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\AbstractOnlineMediaHelper\getResourceFactory(), TYPO3\CMS\Core\DataHandling\DataHandler\getResourceFactory(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\getResourceFactory(), TYPO3\CMS\Core\Resource\ResourceStorage\getRootLevelFolder(), TYPO3\CMS\Backend\Form\Wizard\ImageManipulationWizard\getWizardAction(), TYPO3\CMS\Core\Resource\ResourceStorage\hasFile(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\imageLinkWrap(), TYPO3\CMS\Backend\Controller\File\RenameFileController\init(), TYPO3\CMS\Backend\Controller\File\FileUploadController\init(), TYPO3\CMS\Backend\Controller\File\ReplaceFileController\init(), TYPO3\CMS\Backend\Controller\File\CreateFolderController\init(), TYPO3\CMS\Backend\Controller\File\EditFileController\init(), TYPO3\CMS\Backend\Controller\ContentElement\ElementInformationController\initFileOrFolderRecord(), TYPO3\CMS\Frontend\Controller\ShowImageController\initialize(), TYPO3\CMS\Rtehtmlarea\ImageHandler\AddImageHandler\initialize(), TYPO3\CMS\CssStyledContent\Controller\CssStyledContentController\initializeCurrentFileInContentObjectRenderer(), TYPO3\CMS\Impexp\Import\isEquivalentObjectStorage(), TYPO3\CMS\Core\Resource\Collection\CategoryBasedFileCollection\loadContents(), TYPO3\CMS\Backend\Clipboard\Clipboard\printContentFromTab(), TYPO3\CMS\Backend\ClickMenu\ClickMenu\printFileClickMenu(), TYPO3\CMS\Recordlist\Browser\FolderBrowser\processSessionData(), TYPO3\CMS\Recordlist\Browser\FileBrowser\processSessionData(), TYPO3\CMS\Impexp\Export\removeSoftrefsHavingTheSameDatabaseRelation(), TYPO3\CMS\Rtehtmlarea\Controller\CustomAttributeController\render_clickenlarge(), TYPO3\CMS\Core\Resource\Hook\FileInfoHook\renderFileInfo(), TYPO3\CMS\Core\Resource\Hook\FileInfoHook\renderFileMetadataInfo(), TYPO3\CMS\Backend\Form\Container\InlineRecordContainer\renderForeignRecordHeader(), TYPO3\CMS\Core\Html\RteHtmlParser\RTE_transform(), TYPO3\CMS\Setup\Controller\SetupModuleController\setAvatarFileUid(), TYPO3\CMS\Rtehtmlarea\Controller\SpellCheckingController\setPersonalDictionaryPath(), TYPO3\CMS\Impexp\Import\setRelations_db(), TYPO3\CMS\Core\Utility\File\ExtendedFileUtility\start(), TYPO3\CMS\Filelist\FileList\start(), TYPO3\CMS\Backend\Utility\BackendUtility\titleAltAttrib(), TYPO3\CMS\Core\Html\RteHtmlParser\TS_links_db(), TYPO3\CMS\Core\Html\RteHtmlParser\TS_links_rte(), TYPO3\CMS\Core\Resource\File\updateProperties(), TYPO3\CMS\Scheduler\Task\FileStorageIndexingAdditionalFieldProvider\validateAdditionalFields(), TYPO3\CMS\Scheduler\Task\FileStorageExtractionAdditionalFieldProvider\validateAdditionalFields(), and TYPO3\CMS\Impexp\Import\writeSysFileStorageRecords().

◆ getObjectFromCombinedIdentifier()

TYPO3\CMS\Core\Resource\ResourceFactory::getObjectFromCombinedIdentifier (   $identifier)

◆ getProcessedFileRepository()

TYPO3\CMS\Core\Resource\ResourceFactory::getProcessedFileRepository ( )
protected

◆ getStorageObjectFromCombinedIdentifier()

TYPO3\CMS\Core\Resource\ResourceFactory::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 511 of file ResourceFactory.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

◆ retrieveFileOrFolderObject()

TYPO3\CMS\Core\Resource\ResourceFactory::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 435 of file ResourceFactory.php.

References TYPO3\CMS\Core\Utility\PathUtility\basename(), TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger(), TYPO3\CMS\Core\Utility\PathUtility\dirname(), TYPO3\CMS\Core\Utility\PathUtility\getCanonicalPath(), TYPO3\CMS\Core\Utility\GeneralUtility\getFileAbsFileName(), TYPO3\CMS\Core\Resource\ResourceFactory\getFileObject(), TYPO3\CMS\Core\Resource\ResourceFactory\getFileObjectFromCombinedIdentifier(), TYPO3\CMS\Core\Resource\ResourceFactory\getFolderObjectFromCombinedIdentifier(), TYPO3\CMS\Core\Resource\ResourceFactory\getObjectFromCombinedIdentifier(), TYPO3\CMS\Core\Utility\PathUtility\getRelativePath(), and TYPO3\CMS\Core\Utility\GeneralUtility\isFirstPartOfStr().

Member Data Documentation

◆ $collectionInstances

TYPO3\CMS\Core\Resource\ResourceFactory::$collectionInstances = []
protected

Definition at line 47 of file ResourceFactory.php.

◆ $fileInstances

TYPO3\CMS\Core\Resource\ResourceFactory::$fileInstances = []
protected

Definition at line 52 of file ResourceFactory.php.

◆ $fileReferenceInstances

TYPO3\CMS\Core\Resource\ResourceFactory::$fileReferenceInstances = []
protected

Definition at line 57 of file ResourceFactory.php.

◆ $localDriverStorageCache

TYPO3\CMS\Core\Resource\ResourceFactory::$localDriverStorageCache = null
protected

Definition at line 64 of file ResourceFactory.php.

◆ $signalSlotDispatcher

TYPO3\CMS\Core\Resource\ResourceFactory::$signalSlotDispatcher
protected

◆ $storageInstances

TYPO3\CMS\Core\Resource\ResourceFactory::$storageInstances = []
protected

Definition at line 42 of file ResourceFactory.php.