Feature: #110762 - Project-root relative base paths for local storages
See forge#110762
Description
A file storage using the
Local
driver is configured with a base path.
Until now, this path was either absolute, or relative to the public web
directory when the additional option
path was set to
relative
. A directory outside the web root, for example a storage for
files that must never be served directly, could therefore only be configured
with an absolute path, which ties the configuration to one server.
A relative base path without the
path option is now resolved
against the project path
(
\TYPO3\).
In a Composer-based installation this is the directory containing
composer., so
public/ denotes the default
fileadmin/ directory and
storage/ a directory next to
config/ and var/. In classic mode the project path and the
public path are the same directory, so
fileadmin/
keeps its meaning.
Whether such a storage is public is derived as before: a base path below the
public directory gets a public URL, any other path needs a
base or
is served through the file dump controller.
The following rules apply to the
base option of the local driver:
- An absolute path is used as is.
- A relative path with
pathset toType relativeis resolved against the public path. This is the behaviour of existing storage records and stays unchanged. - Any other relative path is resolved against the project path.
The same rules apply when TYPO3 resolves a legacy file path such as
fileadmin/ to the storage containing it.
Impact
Local storages can be placed anywhere below the project directory with a
relative path that works on every server the project is deployed to. Existing
storage records are not affected, as they carry the
path option.