StorageRepository

class \TYPO3\CMS\Core\Resource\StorageRepository

Implements
LoggerAwareInterface
Uses
LoggerAwareTrait

Repository for accessing the file storages

Table of Contents

Interfaces

LoggerAwareInterface

Properties

$driverRegistry  : DriverRegistry
$eventDispatcher  : EventDispatcherInterface
$localDriverStorageCache  : array<int, LocalPath>|null
$storageInstances  : ResourceStorage[]|null
$storageRowCache  : array|null
$table  : string

Methods

__construct()  : mixed
createFromRecord()  : ResourceStorage
createLocalStorage()  : int
Create the initial local storage base e.g. for the fileadmin/ directory.
findAll()  : ResourceStorage[]
Returns a list of mountpoints that are available in the VFS.
findByCombinedIdentifier()  : ResourceStorage|null
Gets a storage object from a combined identifier
findByStorageType()  : ResourceStorage[]
Finds storages by type, i.e. the driver used
findByUid()  : ResourceStorage|null
flush()  : void
Flush the internal storage caches to force reloading of storages with the next fetch.
getDefaultStorage()  : ResourceStorage|null
Returns the Default Storage
getStorageObject()  : ResourceStorage
Creates an instance of the storage from given UID. The $recordData can be supplied to increase performance.
convertFlexFormDataToConfigurationArray()  : array
Converts a flexform data string to a flat array with key value pairs
createStorageObject()  : ResourceStorage
Creates a storage object from a storage database row.
fetchRecordDataByUid()  : array
findBestMatchingStorageByLocalPath()  : int
Checks whether a file resides within a real storage in local file system.
getDriverObject()  : DriverInterface
Creates a driver object for a specified storage object.
initializeLocalCache()  : mixed
Initializes the Storage
initializeLocalStorageCache()  : void
Creates an array mapping all uids to the basePath of storages using the "local" driver.
testCaseSensitivity()  : bool
Test if the local filesystem is case sensitive

Properties

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

$storageRowCache

protected array|null $storageRowCache

$table

protected string $table = 'sys_file_storage'

Methods

__construct()

public __construct(EventDispatcherInterface $eventDispatcher, DriverRegistry $driverRegistry) : mixed

Parameters

$eventDispatcher : EventDispatcherInterface
$driverRegistry : DriverRegistry

createLocalStorage()

Create the initial local storage base e.g. for the fileadmin/ directory.

public createLocalStorage(string $name, string $basePath, string $pathType[, string $description = '' ][, bool $default = false ]) : int

Parameters

$name : string
$basePath : string
$pathType : string
$description : string = ''
$default : bool = false

set to default storage

Return values

int —

uid of the inserted record

findAll()

Returns a list of mountpoints that are available in the VFS.

public findAll() : ResourceStorage[]

In case no storage exists this automatically created a storage for fileadmin/

Return values

ResourceStorage[]

findByCombinedIdentifier()

Gets a storage object from a combined identifier

public findByCombinedIdentifier(string $identifier) : ResourceStorage|null

Parameters

$identifier : string

An identifier of the form [storage uid]:[object identifier]

Return values

ResourceStorage|null

findByStorageType()

Finds storages by type, i.e. the driver used

public findByStorageType(string $storageType) : ResourceStorage[]

Parameters

$storageType : string

Return values

ResourceStorage[]

flush()

Flush the internal storage caches to force reloading of storages with the next fetch.

public flush() : void

getDefaultStorage()

Returns the Default Storage

public getDefaultStorage() : ResourceStorage|null

The Default Storage is considered to be the replacement for the fileadmin/ construct. It is automatically created with the setting fileadminDir from install tool. getDefaultStorage->getDefaultFolder() will get you fileadmin/user_upload/ in a standard TYPO3 installation.

Return values

ResourceStorage|null

getStorageObject()

Creates an instance of the storage from given UID. The $recordData can be supplied to increase performance.

public getStorageObject(int $uid[, array $recordData = [] ][, mixed|null &$fileIdentifier = null ]) : ResourceStorage

Parameters

$uid : int

The uid of the storage to instantiate.

$recordData : array = []

The record row from database.

$fileIdentifier : mixed|null = null

Identifier for a file. Used for auto-detection of a storage, but only if $uid === 0 (Local default storage) is used

Tags

throws
InvalidArgumentException

Return values

ResourceStorage

convertFlexFormDataToConfigurationArray()

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

protected convertFlexFormDataToConfigurationArray(string $flexFormData) : array

Parameters

$flexFormData : string

Return values

array —

Array with key => value pairs of the field data in the FlexForm

createStorageObject()

Creates a storage object from a storage database row.

protected createStorageObject(array $storageRecord[, array|null $storageConfiguration = null ]) : ResourceStorage

Parameters

$storageRecord : array
$storageConfiguration : array|null = null

Storage configuration (if given, this won't be extracted from the FlexForm value but the supplied array used instead)

Return values

ResourceStorage

fetchRecordDataByUid()

protected fetchRecordDataByUid(int $uid) : array

Parameters

$uid : int

Return values

array

findBestMatchingStorageByLocalPath()

Checks whether a file resides within a real storage in local file system.

protected findBestMatchingStorageByLocalPath(string &$localPath) : int

If no match is found, uid 0 is returned which is a fallback storage pointing to fileadmin in public web path.

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

Parameters

$localPath : string

Return values

int

getDriverObject()

Creates a driver object for a specified storage object.

protected getDriverObject(string $driverIdentificationString, array $driverConfiguration) : DriverInterface

Parameters

$driverIdentificationString : string

The driver class (or identifier) to use.

$driverConfiguration : array

The configuration of the storage

Return values

DriverInterface

initializeLocalCache()

Initializes the Storage

protected initializeLocalCache() : mixed

initializeLocalStorageCache()

Creates an array mapping all uids to the basePath of storages using the "local" driver.

protected initializeLocalStorageCache() : void

testCaseSensitivity()

Test if the local filesystem is case sensitive

protected testCaseSensitivity(string $absolutePath) : bool

Parameters

$absolutePath : string

Return values

bool
On this page