[BUGFIX] Flush `l10n` cache after downloading languages 83/56583/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Fri, 6 Apr 2018 11:57:28 +0000 (13:57 +0200)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Fri, 6 Apr 2018 14:55:34 +0000 (16:55 +0200)
This patch let's the Maintenance Area flush the `l10n` caches after
language packs were downloaded. Since the Install Tool uses
"hacked settings", we have to create a new instance of the `CacheManager`
to be able to operate on the mentioned cache. The same handling can be
seen in `ClearCacheService::clearAll()`.

Resolves: #84645
Releases: master
Change-Id: I221bd0d77f2991eac550316586002a8329bb36df
Reviewed-on: https://review.typo3.org/56583
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joshua Westerheide <account@jdoubleu.de>
Tested-by: Joshua Westerheide <account@jdoubleu.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/install/Classes/Controller/MaintenanceController.php

index 842152f..ceaeca3 100644 (file)
@@ -680,6 +680,17 @@ class MaintenanceController extends AbstractController
         $isos = $request->getParsedBody()['install']['isos'];
         $languagePackService = GeneralUtility::makeInstance(LanguagePackService::class);
         $languagePackService->setLastUpdatedIsoCode($isos);
+
+        // The cache manager is already instantiated in the install tool
+        // with some hacked settings to disable caching of extbase and fluid.
+        // We want a "fresh" object here to operate on a different cache setup.
+        // cacheManager implements SingletonInterface, so the only way to get a "fresh"
+        // instance is by circumventing makeInstance and/or the objectManager and
+        // using new directly!
+        $cacheManager = new \TYPO3\CMS\Core\Cache\CacheManager();
+        $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
+        $cacheManager->getCache('l10n')->flush();
+
         return new JsonResponse(['success' => true]);
     }