Bug #93249

TYPO3 FAL Driver Registry is unclear

Added by Justus Moroni 11 months ago. Updated 6 days ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Install Tool
Target version:
-
Start date:
2021-01-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Today I encountered an issue with FAL drivers as I was testing the implementation of a 3rd Party FAL driver (https://github.com/nextmotion/google-cloud-storage-fal/)

I wanted to clear the `_processed_` files from the storage, that used the FAL driver for the google cloud storage, via the Install Tool "Maintenance -> Remove Temporary Assets".
The processed files of the storage were not listed in the statistics and could not be cleared.


My debugging results

When I check the DriverRegistry in line `public/typo3/sysext/core/Classes/Resource/StorageRepository.php:187` the only driver listed is the `Local` one.

The google cloud storage driver is not listed in `$GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredDrivers']` because it was registered with the following code in the `ext_localconf.php`:

$driverRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Driver\DriverRegistry::class);
$driverRegistry->registerDriverClass(...);

instead of setting the configuration of the driver in the `$GLOBALS` array directly:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredDrivers']['Foo'] = [
    'class' => \Foo\Bar\Driver\StorageDriver::class,
    'flexFormDS' => 'FILE:EXT:bar/Configuration/FlexForms/Storage.xml',
    'label' => 'Foo Bar',
    'shortName' => \Foo\Bar\Driver\StorageDriver::class,
];

The singleton of `\TYPO3\CMS\Core\Resource\Driver\DriverRegistry` in the Install Tool does not contain the driver that was added via `->registerDriverClass(...)` because it uses the `\TYPO3\CMS\Core\DependencyInjection\FailsafeContainer` instead of the normal Dependency Injection container.


This can be reproduced if you install any TYPO3 FAL driver other than the `Local` driver like and try to clear processed files via the Install Tool:
https://github.com/nextmotion/google-cloud-storage-fal/


My problem is that I could not find the correct way in which FAL drivers should be registered in the documentation.
So I'm not entirely sure if this is actually an issue with the TYPO3 Core.

Is there a correct way for the registration of a new driver?
Does the API in `\TYPO3\CMS\Core\Resource\Driver\DriverRegistry` to register the drivers need to be changed?

#1

Updated by Gerrit Code Review 11 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67444

#2

Updated by Gerrit Code Review 17 days ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67444

#3

Updated by Gerrit Code Review 6 days ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67444

Also available in: Atom PDF