events/Classes/Command/RemoveAllCommand.php
Daniel Siepmann ca4d7d3a01 Add basic cleanup command
Allows to remove all existing records regarding events.
It will search for all pages providing either organizer or events, and
will delete both types of records.

As DataHandler is used for deletion, there is already logging within
TYPO3, as well as recursive deletion for dates and sys_file_references.

To speedup for large data sets, truncate organizer and dates, as they
don't have recursive deletions, e.g. to sys_file_references. Also add
keys to database.
2019-09-18 18:04:29 +02:00

28 lines
855 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 RemoveAllCommand extends Command
{
public function configure()
{
$this->setDescription('Remove all event data');
$this->setHelp('All events and associated data will be removed.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
Bootstrap::initializeBackendAuthentication();
return GeneralUtility::makeInstance(ObjectManager::class)
->get(CleanupService::class)
->deleteAllData();
}
}