mirror of
https://github.com/werkraum-media/events.git
synced 2024-12-27 19:06:09 +01:00
Daniel Siepmann
8ed5bd9970
It will search for all dates within the past and remove them. Afterwards all events with no dates are searched and removed. As DataHandler is used for deletion of events, there is already logging within TYPO3, as well as recursive deletion for sys_file_references. To speedup for large data sets, deletion of dates is done without DataHandler.
28 lines
884 B
PHP
28 lines
884 B
PHP
<?php
|
|
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 TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
|
use Wrm\Events\Service\CleanupService;
|
|
|
|
class RemovePastCommand extends Command
|
|
{
|
|
public function configure()
|
|
{
|
|
$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();
|
|
|
|
return GeneralUtility::makeInstance(ObjectManager::class)
|
|
->get(CleanupService::class)
|
|
->deletePastData();
|
|
}
|
|
}
|