custom/plugins/FroshTools/src/Components/Elasticsearch/AdminInfoSubscriber.php line 13
<?php declare(strict_types=1);
namespace Frosh\Tools\Components\Elasticsearch;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
final class AdminInfoSubscriber
{
public function __construct(private readonly bool $elasticsearchEnabled)
{
}
public function __invoke(ResponseEvent $event): void
{
if ($event->getRequest()->attributes->get('_route') !== 'api.info.config') {
return;
}
/** @var array{'version': string} $json */
$json = json_decode((string) $event->getResponse()->getContent(), true, 512, \JSON_THROW_ON_ERROR);
$json['settings']['elasticsearchEnabled'] = $this->elasticsearchEnabled;
$event->getResponse()->setContent(json_encode($json, \JSON_THROW_ON_ERROR));
}
}