mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-10 07:36:09 +01:00
Daniel Siepmann
ab9c3e0c4e
Past data is now removed again. A test ensures the functionality. Data is no longer marked as deleted but is actually deleted. Relates: #9543
38 lines
736 B
PHP
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();
|
|
}
|
|
}
|