StorageRepository implements LoggerAwareInterface uses LoggerAwareTrait
Repository for accessing the file storages
Table of Contents
Interfaces
- LoggerAwareInterface
Properties
- $driverRegistry : DriverRegistry
- $eventDispatcher : EventDispatcherInterface
- $localDriverStorageCache : array<int<0, max>, LocalPath>|null
- $storageInstances : array<int<0, max>, ResourceStorage>
- $storageRowCache : array<positive-int, array<string|int, mixed>>|null
- $table : string
Methods
- __construct() : mixed
- createFromRecord() : ResourceStorage
- createLocalStorage() : int<0, max>
- Create the initial local storage base e.g. for the fileadmin/ directory.
- findAll() : array<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<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<0, max>
- 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() : void
- 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
$driverRegistry read-only
protected
DriverRegistry
$driverRegistry
$eventDispatcher read-only
protected
EventDispatcherInterface
$eventDispatcher
$localDriverStorageCache
protected
array<int<0, max>, LocalPath>|null
$localDriverStorageCache
= null
$storageInstances
protected
array<int<0, max>, ResourceStorage>
$storageInstances
= []
$storageRowCache
protected
array<positive-int, array<string|int, mixed>>|null
$storageRowCache
= null
$table read-only
protected
string
$table
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>
Return values
ResourceStoragecreateLocalStorage()
Create the initial local storage base e.g. for the fileadmin/ directory.
public
createLocalStorage(non-empty-string $name, non-empty-string $basePath, non-empty-string $pathType[, string $description = '' ][, bool $default = false ]) : int<0, max>
Parameters
- $name : non-empty-string
- $basePath : non-empty-string
- $pathType : non-empty-string
- $description : string = ''
- $default : bool = false
Return values
int<0, max>findAll()
Returns a list of mountpoints that are available in the VFS.
public
findAll() : array<int, ResourceStorage>
In case no storage exists this automatically created a storage for fileadmin/
Return values
array<int, ResourceStorage>findByCombinedIdentifier()
Gets a storage object from a combined identifier
public
findByCombinedIdentifier(non-empty-string $identifier) : ResourceStorage|null
Parameters
- $identifier : non-empty-string
-
An identifier of the form [storage uid]:[object identifier]
Return values
ResourceStorage|nullfindByStorageType()
Finds storages by type, i.e. the driver used
public
findByStorageType(non-empty-string $storageType) : array<int, ResourceStorage>
Parameters
- $storageType : non-empty-string
Return values
array<int, ResourceStorage>findByUid()
public
findByUid(int $uid) : ResourceStorage|null
Parameters
- $uid : int
Return values
ResourceStorage|nullflush()
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|nullgetStorageObject()
Creates an instance of the storage from given UID. The $recordData can be supplied to increase performance.
public
getStorageObject(int<0, max> $uid[, array<string|int, mixed> $recordData = [] ][, non-empty-string|null &$fileIdentifier = null ]) : ResourceStorage
Parameters
- $uid : int<0, max>
-
The uid of the storage to instantiate.
- $recordData : array<string|int, mixed> = []
-
<string, mixed> The record row from database.
- $fileIdentifier : non-empty-string|null = null
-
Identifier for a file. Used for auto-detection of a storage, but only if $uid === 0 (Local default storage) is used
Return values
ResourceStorageconvertFlexFormDataToConfigurationArray()
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
ResourceStoragefetchRecordDataByUid()
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(non-empty-string &$localPath) : int<0, max>
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 : non-empty-string
Return values
int<0, max>getDriverObject()
Creates a driver object for a specified storage object.
protected
getDriverObject(non-empty-string $driverIdentificationString, array<string|int, mixed> $driverConfiguration) : DriverInterface
Parameters
- $driverIdentificationString : non-empty-string
-
The driver class (or identifier) to use.
- $driverConfiguration : array<string|int, mixed>
-
The configuration of the storage
Return values
DriverInterfaceinitializeLocalCache()
Initializes the Storage
protected
initializeLocalCache() : void
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(non-empty-string $absolutePath) : bool
Parameters
- $absolutePath : non-empty-string