Delete only six weeks old dates in cleanup past service

This commit is contained in:
Dirk Koritnik 2024-01-22 12:14:59 +01:00
parent 7db61a189a
commit 087e49df4a

View file

@ -69,10 +69,10 @@ final class Database
$queryBuilder->getRestrictions()->removeAll();
$midnightToday = new DateTimeImmutable('midnight today');
$sixWeeksAgo = (new DateTimeImmutable())->modify('-6 weeks')->setTime(0, 0, 0);
$queryBuilder->delete(self::DATE_TABLE)->where($queryBuilder->expr()->lte(
'end',
$queryBuilder->createNamedParameter($midnightToday->format('U'))
$queryBuilder->createNamedParameter($sixWeeksAgo->format('U'))
))->executeStatement();
}