diff --git a/src/Command/FlushLogsCommand.php b/src/Command/FlushLogsCommand.php new file mode 100644 index 0000000..44cba33 --- /dev/null +++ b/src/Command/FlushLogsCommand.php @@ -0,0 +1,41 @@ +modify('-30 days'); + try { + $result = $this + ->connection + ->executeQuery('DELETE FROM log WHERE log.timestamp < ?', [$dueDate->format('Y-m-d H:i:s')]); + $io->info('Deleted '.$result->rowCount().' log entries'); + } catch (Exception $e) { + $io->error('Unable to delete log entries: '.$e->getMessage()); + } + + return Command::SUCCESS; + } +}