33 lines
988 B
PHP
33 lines
988 B
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace DigiComp\FlowTranslationEndpoint;
|
||
|
|
||
|
use Neos\Flow\Cache\CacheManager;
|
||
|
use Neos\Flow\Core\Bootstrap;
|
||
|
use Neos\Flow\Monitor\FileMonitor;
|
||
|
|
||
|
class Package extends \Neos\Flow\Package\Package
|
||
|
{
|
||
|
public function boot(Bootstrap $bootstrap)
|
||
|
{
|
||
|
parent::boot($bootstrap);
|
||
|
$dispatcher = $bootstrap->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();
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
}
|