1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Extension "sf_event_mgt" for TYPO3 CMS. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please read the |
9
|
|
|
* LICENSE.txt file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace DERHANSEN\SfEventMgt\Command; |
13
|
|
|
|
14
|
|
|
use DERHANSEN\SfEventMgt\Service\MaintenanceService; |
15
|
|
|
use Symfony\Component\Console\Command\Command; |
16
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
17
|
|
|
use Symfony\Component\Console\Input\InputOption; |
18
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
19
|
|
|
use Symfony\Component\Console\Style\SymfonyStyle; |
20
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Class CleanupExpiredCommand |
24
|
|
|
*/ |
25
|
|
|
class CleanupExpiredCommand extends Command |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* Configuring the command options |
29
|
|
|
*/ |
30
|
|
|
public function configure() |
31
|
|
|
{ |
32
|
|
|
$this->addOption( |
33
|
|
|
'delete', |
34
|
|
|
'd', |
35
|
|
|
InputOption::VALUE_NONE, |
36
|
|
|
'If set, registrations will be set to deleted instead of hidden' |
37
|
|
|
); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Execute the cleanup command |
42
|
|
|
* |
43
|
|
|
* @param InputInterface $input |
44
|
|
|
* @param OutputInterface $output |
45
|
|
|
* @return int |
46
|
|
|
*/ |
47
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
48
|
|
|
{ |
49
|
|
|
$maintenanceService = GeneralUtility::makeInstance(MaintenanceService::class); |
50
|
|
|
$io = new SymfonyStyle($input, $output); |
51
|
|
|
$io->title($this->getDescription()); |
52
|
|
|
$delete = (bool)$input->getOption('delete'); |
53
|
|
|
$maintenanceService->handleExpiredRegistrations($delete); |
54
|
|
|
$io->success('All done!'); |
55
|
|
|
|
56
|
|
|
return 0; |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|