events/Classes/Service/CleanupService.php
Daniel Siepmann ab9c3e0c4e Fix broken remove past data
Past data is now removed again.
A test ensures the functionality.
Data is no longer marked as deleted but is actually deleted.

Relates: #9543
2021-12-20 09:45:25 +01:00

38 lines
736 B
PHP

<?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();
}
}