From 087e49df4a5da05b94dc7930abc9c4a01c406721 Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Mon, 22 Jan 2024 12:14:59 +0100 Subject: [PATCH] Delete only six weeks old dates in cleanup past service --- Classes/Service/Cleanup/Database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/Service/Cleanup/Database.php b/Classes/Service/Cleanup/Database.php index 4a6e642..edfba28 100644 --- a/Classes/Service/Cleanup/Database.php +++ b/Classes/Service/Cleanup/Database.php @@ -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(); }