From 38e45f5d8f43019b8c78f556191b9d314b94dcf6 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Tue, 8 Aug 2023 14:30:48 +0200 Subject: [PATCH] Adding automatic cache clearing in case of changed translation files --- Classes/Package.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Classes/Package.php diff --git a/Classes/Package.php b/Classes/Package.php new file mode 100644 index 0000000..2ec7ec6 --- /dev/null +++ b/Classes/Package.php @@ -0,0 +1,32 @@ +getSignalSlotDispatcher(); + $dispatcher->connect( + FileMonitor::class, + 'filesHaveChanged', + static function ($fileMonitorId, $changedFiles) use ($bootstrap) { + if ($fileMonitorId !== 'Flow_TranslationFiles') { + return; + } + if ($changedFiles !== []) { + $cacheManager = $bootstrap->getObjectManager()->get(CacheManager::class); + $cache = $cacheManager->getCache('DigiComp_FlowTranslationEndpoint_Responses'); + $cache->flush(); + } + } + ); + } +}