Phase1 Bearbeitung
This commit is contained in:
+21
-1
@@ -2,6 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Services\MailerService;
|
||||
use App\Services\PasswordResetService;
|
||||
use App\Services\RateLimiterService;
|
||||
|
||||
$rootPath = dirname(__DIR__);
|
||||
$lockFile = $rootPath . '/storage/cron.lock';
|
||||
|
||||
@@ -20,6 +24,17 @@ try {
|
||||
}
|
||||
|
||||
$pdo = $app['database']->pdo();
|
||||
$passwordResetService = new PasswordResetService(
|
||||
$pdo,
|
||||
new MailerService($app['config']['mail'] ?? []),
|
||||
$app['config']['password_reset'] ?? []
|
||||
);
|
||||
$rateLimiterService = new RateLimiterService(
|
||||
$pdo,
|
||||
$app['config']['rate_limits'] ?? []
|
||||
);
|
||||
$purgedPasswordResetTokens = $passwordResetService->purgeExpiredTokens();
|
||||
$prunedRateLimits = $rateLimiterService->prune();
|
||||
|
||||
$pendingRfid = (int) $pdo->query(
|
||||
'SELECT COUNT(*) FROM rfid_events WHERE status = "received"'
|
||||
@@ -27,9 +42,14 @@ try {
|
||||
|
||||
$summary = [
|
||||
'timestamp' => gmdate(DATE_ATOM),
|
||||
'cleanup' => [
|
||||
'password_reset_tokens_removed' => $purgedPasswordResetTokens,
|
||||
'rate_limit_entries_removed' => $prunedRateLimits,
|
||||
],
|
||||
'pending_rfid_events' => $pendingRfid,
|
||||
'notes' => [
|
||||
'In diesem MVP dient Cron als technischer Haken fuer spaetere Reminder, Exporte und RFID-Regeln.',
|
||||
'Cron bereinigt abgelaufene Passwort-Reset-Tokens und veraltete Rate-Limit-Eintraege.',
|
||||
'In diesem MVP dient Cron ausserdem als technischer Haken fuer spaetere Reminder, Exporte und RFID-Regeln.',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user