From 7dc30c435f0caa522784d178383e1a6ff055cc35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Mummert?= Date: Mon, 5 Jan 2026 11:05:35 +0100 Subject: [PATCH] add cron --- src/Cron/MeilisearchIndexCron.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Cron/MeilisearchIndexCron.php b/src/Cron/MeilisearchIndexCron.php index d5b4309..fe86af1 100644 --- a/src/Cron/MeilisearchIndexCron.php +++ b/src/Cron/MeilisearchIndexCron.php @@ -1,22 +1,43 @@ framework->initialize(); - // einmal täglich indexieren + // 1) Contao Crawl + $this->runConsole('contao:crawl'); + + // 2) Cleanup (24h Grace) + $this->runConsole('meilisearch:files:cleanup'); + + // 3) Meilisearch Index $this->indexService->run(); } + + private function runConsole(string $command): void + { + $process = new Process([ + 'php', + $this->projectDir . '/vendor/bin/contao-console', + ...explode(' ', $command), + ]); + + $process->setTimeout(null); + $process->run(); + } } \ No newline at end of file