Actions
Bug #90962
openCache and Dependency Injection in Upgrade module
Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-04-06
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
In my schema extension I injected a frontend cache with DI into a class.
The cache is defined in the ext_localconf.php:
$coreCacheIdentifier = 'tx_' . $extensionKey . '_core'; if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$coreCacheIdentifier])) { $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$coreCacheIdentifier] = []; } if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$coreCacheIdentifier]['frontend'])) { $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$coreCacheIdentifier]['frontend'] = \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class; } if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$coreCacheIdentifier]['backend'])) { $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$coreCacheIdentifier]['backend'] = \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::class; } if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$coreCacheIdentifier]['options'])) { $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$coreCacheIdentifier]['options']['defaultLifetime'] = 0; }
and listed correctly in the Configuration module.
Definition in Services.yaml:
services: cache.tx_schema_core: class: TYPO3\CMS\Core\Cache\Frontend\FrontendInterface factory: ['@TYPO3\CMS\Core\Cache\CacheManager', 'getCache'] arguments: ['tx_schema_core'] Brotkrueml\Schema\Registry\TypeRegistry: arguments: $cache: '@cache.tx_schema_core' $packageManager: '@TYPO3\CMS\Core\Package\PackageManager'
In the TypeRegistry class itself, the the constructor looks like:
public function __construct(FrontendInterface $cache = null, PackageManager $packageManager = null)
The injection works for most cases in frontend and backend. However, executing two routines in the Upgrade module fail:
- Check TCA in ext_tables.php
- Check TCA Migrations
But: When I define the cache in the AdditionalConfiguration.php instead of localconf.php it works. Also when deactivating DI in Services.yaml
The behaviour can be reproduced with the schema extension (commit af18687d from April 5th):
https://github.com/brotkrueml/schema
Files
Actions