FileStorageConfiguration
Reads the file storage definitions from config/system/file-storages.yaml.
The file is optional: without it, or with an empty "storages" map, one local storage for the fileadmin directory with identifier 1 is assumed. Entries are returned normalized, with every key present and defaults applied.
Reading is tolerant: an entry that cannot be used is logged and made available as an offline storage, unknown options are logged and ignored, so that one broken entry does not stop every file access. Syntax errors and an invalid structure of the file are not tolerated. Writing validates strictly.
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Constants
- CONFIG_FILE_NAME : string = 'file-storages.yaml'
Methods
- __construct() : mixed
- flush() : void
- get() : array<string, mixed>|null
- getAll() : array<positive-int, array<string, mixed>>
- All configured storages, normalized and keyed by identifier, or the implicit default storage when the file does not define any.
- getConfigFileName() : string
- getImplicitDefault() : array<positive-int, array<string, mixed>>
- The storage assumed when no file exists: the fileadmin directory below the public path, local driver, default storage, identifier 1.
- isFilePresent() : bool
- load() : array
- The parsed file with placeholders resolved and imports processed.
- loadRaw() : array
- The file as written, without placeholder resolution and without imports.
- normalize() : array<string, mixed>
- Brings one storage entry into the canonical shape and validates the values that do not depend on other storages.
- normalizeAll() : array<positive-int, array<string, mixed>>
- Normalizes and validates a complete set of storage definitions as read from the file. A single storage is always the default storage.
- onConfigurationChanged() : void
- validateSet() : void
- Validates the rules spanning all storages: exactly one default.
Constants
CONFIG_FILE_NAME
public
string
CONFIG_FILE_NAME
= 'file-storages.yaml'
Methods
__construct()
public
__construct(string $configPath, YamlFileLoader $yamlFileLoader, LoggerInterface $logger, PhpFrontend $cache) : mixed
Parameters
- $configPath : string
- $yamlFileLoader : YamlFileLoader
- $logger : LoggerInterface
- $cache : PhpFrontend
flush()
public
flush() : void
get()
public
get(int $identifier) : array<string, mixed>|null
Parameters
- $identifier : int
Return values
array<string, mixed>|nullgetAll()
All configured storages, normalized and keyed by identifier, or the implicit default storage when the file does not define any.
public
getAll() : array<positive-int, array<string, mixed>>
Tags
Return values
array<positive-int, array<string, mixed>>getConfigFileName()
public
getConfigFileName() : string
Return values
stringgetImplicitDefault()
The storage assumed when no file exists: the fileadmin directory below the public path, local driver, default storage, identifier 1.
public
getImplicitDefault() : array<positive-int, array<string, mixed>>
Return values
array<positive-int, array<string, mixed>>isFilePresent()
public
isFilePresent() : bool
Return values
boolload()
The parsed file with placeholders resolved and imports processed.
public
load() : array
Only the "storages" key is evaluated by TYPO3.
Return values
arrayloadRaw()
The file as written, without placeholder resolution and without imports.
public
loadRaw() : array
This is the base a writer has to work on, so that "%env()%" values survive.
Return values
arraynormalize()
Brings one storage entry into the canonical shape and validates the values that do not depend on other storages.
public
normalize(int $identifier, array $entry) : array<string, mixed>
Parameters
- $identifier : int
- $entry : array
Tags
Return values
array<string, mixed>normalizeAll()
Normalizes and validates a complete set of storage definitions as read from the file. A single storage is always the default storage.
public
normalizeAll(array $storages[, bool $strict = true ]) : array<positive-int, array<string, mixed>>
With $strict disabled, as when reading, problems are logged instead of thrown: unusable entries become offline storages, unknown options are ignored and a missing or duplicate default flag is resolved.
Parameters
- $storages : array
- $strict : bool = true
Tags
Return values
array<positive-int, array<string, mixed>>onConfigurationChanged()
public
onConfigurationChanged(FileStorageConfigurationChangedEvent $event) : void
Parameters
- $event : FileStorageConfigurationChangedEvent
Attributes
validateSet()
Validates the rules spanning all storages: exactly one default.
public
validateSet(array<int, array<string, mixed>> $storages) : void
Parameters
- $storages : array<int, array<string, mixed>>
-
normalized entries keyed by identifier