events/Classes/Service/CleanupService.php

39 lines
736 B
PHP
Raw Permalink Normal View History

2019-08-12 07:43:37 +02:00
<?php
namespace Wrm\Events\Service;
use Wrm\Events\Service\Cleanup\Database;
use Wrm\Events\Service\Cleanup\Files;
class CleanupService
{
/**
* @var Database
*/
private $database;
/**
* @var Files
*/
private $files;
public function __construct(Database $database, Files $files)
{
$this->database = $database;
$this->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();
}
}