1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace Nexus\Dumper\Communication\Command; |
5
|
|
|
|
6
|
|
|
use DataProvider\DumperConfigDataProvider; |
7
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
8
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
9
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
10
|
|
|
use Xervice\Console\Business\Model\Command\AbstractCommand; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @method \Nexus\Dumper\Business\DumperFacade getFacade() |
14
|
|
|
*/ |
15
|
|
|
class ClearCommand extends AbstractCommand |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
19
|
|
|
*/ |
20
|
|
|
protected function configure(): void |
21
|
|
|
{ |
22
|
|
|
$this |
23
|
|
|
->setName('dumper:clear') |
24
|
|
|
->setDescription('Clear one volume') |
25
|
|
|
->addArgument('volume', InputArgument::REQUIRED, 'The volume to dump') |
26
|
|
|
->addArgument('path', InputArgument::OPTIONAL, 'The path inside the volume to dump', '/data') |
27
|
|
|
->addArgument('version', InputArgument::OPTIONAL, 'The version for naming of your restore', 'master'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @param \Symfony\Component\Console\Input\InputInterface $input |
32
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
33
|
|
|
* |
34
|
|
|
* @return int|null|void |
35
|
|
|
* @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
36
|
|
|
*/ |
37
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
38
|
|
|
{ |
39
|
|
|
$configDataProvider = new DumperConfigDataProvider(); |
40
|
|
|
$configDataProvider->setVolume($input->getArgument('volume')); |
41
|
|
|
$configDataProvider->setPath($input->getArgument('path')); |
42
|
|
|
$configDataProvider->setVersion($input->getArgument('version')); |
43
|
|
|
|
44
|
|
|
$this->getFacade()->clear($configDataProvider); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
} |