1 Commits

Author SHA1 Message Date
Jürgen Mummert 0c637c2f92 Fix file indexing in Contao 5.6 (inject DBAL connection, add debug logs) 2026-01-11 18:19:40 +01:00
+17 -6
View File
@@ -4,18 +4,21 @@ namespace MummertMedia\ContaoMeilisearchBundle\EventListener;
use Contao\Config;
use Contao\System;
use Doctrine\DBAL\Connection;
class IndexPageListener
{
public function __construct()
{
public function __construct(
private readonly Connection $connection,
) {
}
private function debug(string $message, array $context = []): void
{
// Debug bewusst immer aktiv (bis du es wieder entfernst)
// Kontext kurz halten, damit Logs nicht explodieren
$ctx = $context ? ' | ' . json_encode($context, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : '';
$ctx = $context
? ' | ' . json_encode($context, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)
: '';
error_log('[ContaoMeilisearch][IndexPageListener] ' . $message . $ctx);
}
@@ -178,7 +181,15 @@ class IndexPageListener
]);
if ($fileLinks) {
$db = System::getContainer()->get('database_connection');
$this->debug('About to use Doctrine DBAL connection');
$db = $this->connection;
$this->debug('Doctrine DBAL connection ready', [
'driver' => get_class($db->getDriver()),
]);
$time = time();
foreach ($fileLinks as $file) {