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  : array<string|int, ResourceStorage>|null
$storageRowCache  : array<string|int, mixed>|null
$table  : string

Methods

__construct()  : mixed
createFromRecord()  : ResourceStorage
createLocalStorage()  : int
Create the initial local storage base e.g. for the fileadmin/ directory.
findAll()  : array<string|int, ResourceStorage>
Returns a list of mountpoints that are available in the VFS.
findByCombinedIdentifier()  : ResourceStorage|null
Gets a storage object from a combined identifier
findByStorageType()  : array<string|int, 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<string|int, mixed>
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<string|int, mixed>
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<string|int, mixed>|null $storageRowCache

$table

protected string $table = 'sys_file_storage'

Methods

__construct()

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

createFromRecord()

public createFromRecord(array<string|int, mixed> $storageRecord) : ResourceStorage
Parameters
$storageRecord : array<string|int, mixed>
Internal
Return values
ResourceStorage

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() : array<string|int, ResourceStorage>

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

Return values
array<string|int, 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) : array<string|int, ResourceStorage>
Parameters
$storageType : string
Return values
array<string|int, ResourceStorage>

flush()

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

public flush() : void
Internal

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<string|int, mixed> $recordData = [] ][, mixed|null &$fileIdentifier = null ]) : ResourceStorage
Parameters
$uid : int

The uid of the storage to instantiate.

$recordData : array<string|int, mixed> = []

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<string|int, mixed>
Parameters
$flexFormData : string
Return values
array<string|int, mixed>

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<string|int, mixed> $storageRecord[, array<string|int, mixed>|null $storageConfiguration = null ]) : ResourceStorage
Parameters
$storageRecord : array<string|int, mixed>
$storageConfiguration : array<string|int, mixed>|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<string|int, mixed>
Parameters
$uid : int
Return values
array<string|int, mixed>

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<string|int, mixed> $driverConfiguration) : DriverInterface
Parameters
$driverIdentificationString : string

The driver class (or identifier) to use.

$driverConfiguration : array<string|int, mixed>

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

Search results