-
Notifications
You must be signed in to change notification settings - Fork 64
fluidcontent cannot be installed with clean caches #420
Description
When automating deployment with TYPO3 Console a usual way is to
generate the PackageStates.php with a command, which marks extensions as active
and after that running typo3cms extension:setupactive
This currently does not work with fluidcontent and here is why:
- It registers a cache, which by default has a database backend
- It registers a hook, which is triggered, when ext_tables.php are processed
- This hook tries to access the cache
During activation of the extension ext_localconf.php is read, which registers the cache, but the tables are still missing.
After that ext_tables.php is read and the hook is triggered. Since the cache is there, the mitigation implemented here:
fluidcontent/Classes/Service/ConfigurationService.php
Lines 137 to 142 in d438d35
| // cache is not available during installation of extension, however | |
| // this method needs to still succeed (otherwise exception will prevent | |
| // installation to complete) | |
| $cacheExists = $this->manager->hasCache('fluidcontent'); | |
| $cache = $cacheExists ? $this->manager->getCache('fluidcontent') : null; | |
| $cachedPageTsConfigExists = ($cache !== null) && $cache->has('pageTsConfig'); |
$cache->has() fails with an exception.
Steps to reproduce:
Have a TYPO3 8.7.x composer installation
composer require fluidtypo3/fluidcontent
typo3cms install:generatepackagestates # or manually add the extension to PackageStates.php
typo3cms cache:flush # or manually delete typo3temp/var/Cache
The easiest way to solve would be to set $cacheExists as well to false on cli request, as this is the most likely way how this bug can be triggered and caches should not be needed on cli, or at least it does not hurt much when the cli run is a bit slower.
Another option would be to bring your own database backend which inherits from the TYPO3 one, which gracefully returns false when an exception occurs on checking/fetching the cache