events/Classes/Service/CleanupService.php

31 lines
666 B
PHP
Raw Normal View History

2019-08-12 07:43:37 +02:00
<?php
declare(strict_types=1);
namespace WerkraumMedia\Events\Service;
2019-08-12 07:43:37 +02:00
use WerkraumMedia\Events\Service\Cleanup\Database;
use WerkraumMedia\Events\Service\Cleanup\Files;
final class CleanupService
{
public function __construct(
private readonly Database $database,
private readonly Files $files
) {
}
public function deleteAllData(): void
{
$this->database->truncateTables();
$this->files->deleteDangling();
}
public function deletePastData(): void
{
$this->database->deletePastDates();
$this->database->deleteEventsWithoutDates();
$this->files->deleteDangling();
}
}