2019-09-19 09:09:42 +02:00
|
|
|
<?php
|
2021-01-07 08:50:43 +01:00
|
|
|
|
2019-09-19 09:09:42 +02:00
|
|
|
namespace Wrm\Events\Command;
|
|
|
|
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
use TYPO3\CMS\Core\Core\Bootstrap;
|
|
|
|
use Wrm\Events\Service\CleanupService;
|
|
|
|
|
|
|
|
class RemovePastCommand extends Command
|
|
|
|
{
|
2021-09-07 09:49:03 +02:00
|
|
|
/**
|
|
|
|
* @var CleanupService
|
|
|
|
*/
|
|
|
|
private $cleanupService;
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
CleanupService $cleanupService
|
|
|
|
) {
|
|
|
|
$this->cleanupService = $cleanupService;
|
|
|
|
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
2021-09-07 09:52:14 +02:00
|
|
|
public function configure(): void
|
2019-09-19 09:09:42 +02:00
|
|
|
{
|
|
|
|
$this->setDescription('Remove past events');
|
|
|
|
$this->setHelp('Past dates are removed, together with events that do not have any left dates.');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
|
|
{
|
|
|
|
Bootstrap::initializeBackendAuthentication();
|
|
|
|
|
2021-09-07 09:49:03 +02:00
|
|
|
$this->cleanupService->deletePastData();
|
2021-09-07 09:52:14 +02:00
|
|
|
return 0;
|
2019-09-19 09:09:42 +02:00
|
|
|
}
|
|
|
|
}
|