@@ 14-56 (lines=43) @@ | ||
11 | * Class StatusCommand |
|
12 | * @package Magestead\Command\Cache |
|
13 | */ |
|
14 | class StatusCommand extends Command |
|
15 | { |
|
16 | protected $_config; |
|
17 | protected $_projectPath; |
|
18 | ||
19 | protected function configure() |
|
20 | { |
|
21 | $this->_projectPath = getcwd(); |
|
22 | $this->setName("cache:status"); |
|
23 | $this->setDescription("Checks cache status"); |
|
24 | } |
|
25 | ||
26 | /** |
|
27 | * @param InputInterface $input |
|
28 | * @param OutputInterface $output |
|
29 | * @return ProcessCommand |
|
30 | */ |
|
31 | protected function execute(InputInterface $input, OutputInterface $output) |
|
32 | { |
|
33 | $output->writeln('<info>Checking cache status</info>'); |
|
34 | ||
35 | $command = $this->getCommand(new Config($output)); |
|
36 | $pCommand = "vagrant ssh -c '". $command ."'"; |
|
37 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
|
38 | } |
|
39 | ||
40 | /** |
|
41 | * @param Config $config |
|
42 | * @return bool|string |
|
43 | */ |
|
44 | protected function getCommand(Config $config) |
|
45 | { |
|
46 | $type = $config->type; |
|
47 | switch ($type) { |
|
48 | case 'magento': |
|
49 | return "cd /var/www/public;../bin/n98-magerun.phar cache:list"; |
|
50 | case 'magento2': |
|
51 | return "cd /var/www/public;bin/magento cache:status"; |
|
52 | } |
|
53 | ||
54 | return false; |
|
55 | } |
|
56 | } |
@@ 13-55 (lines=43) @@ | ||
10 | * Class InfoCommand |
|
11 | * @package Magestead\Command\Index |
|
12 | */ |
|
13 | class InfoCommand extends Command |
|
14 | { |
|
15 | protected $_config; |
|
16 | protected $_projectPath; |
|
17 | ||
18 | protected function configure() |
|
19 | { |
|
20 | $this->_projectPath = getcwd(); |
|
21 | $this->setName("index:info"); |
|
22 | $this->setDescription("Show available indexes"); |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * @param InputInterface $input |
|
27 | * @param OutputInterface $output |
|
28 | * @return ProcessCommand |
|
29 | */ |
|
30 | protected function execute(InputInterface $input, OutputInterface $output) |
|
31 | { |
|
32 | $output->writeln('<info>Getting index information</info>'); |
|
33 | ||
34 | $command = $this->getCommand(new Config($output)); |
|
35 | $pCommand = "vagrant ssh -c '". $command ."'"; |
|
36 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * @param Config $config |
|
41 | * @return bool|string |
|
42 | */ |
|
43 | protected function getCommand(Config $config) |
|
44 | { |
|
45 | $type = $config->type; |
|
46 | switch ($type) { |
|
47 | case 'magento': |
|
48 | return "cd /var/www/public;../bin/n98-magerun.phar index:list"; |
|
49 | case 'magento2': |
|
50 | return "cd /var/www/public;bin/magento indexer:info"; |
|
51 | } |
|
52 | ||
53 | return false; |
|
54 | } |
|
55 | } |
@@ 13-53 (lines=41) @@ | ||
10 | * Class StatusCommand |
|
11 | * @package Magestead\Command\Index |
|
12 | */ |
|
13 | class StatusCommand extends Command |
|
14 | { |
|
15 | protected $_config; |
|
16 | protected $_projectPath; |
|
17 | ||
18 | protected function configure() |
|
19 | { |
|
20 | $this->_projectPath = getcwd(); |
|
21 | $this->setName("index:status"); |
|
22 | $this->setDescription("Show status of index"); |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * @param InputInterface $input |
|
27 | * @param OutputInterface $output |
|
28 | * @return ProcessCommand |
|
29 | */ |
|
30 | protected function execute(InputInterface $input, OutputInterface $output) |
|
31 | { |
|
32 | $output->writeln('<info>Getting index status</info>'); |
|
33 | ||
34 | $command = $this->getCommand(new Config($output)); |
|
35 | $pCommand = "vagrant ssh -c '". $command ."'"; |
|
36 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * @param Config $config |
|
41 | * @return bool|string |
|
42 | */ |
|
43 | protected function getCommand(Config $config) |
|
44 | { |
|
45 | $type = $config->type; |
|
46 | switch ($type) { |
|
47 | case 'magento2': |
|
48 | return "cd /var/www/public;bin/magento indexer:status"; |
|
49 | } |
|
50 | ||
51 | return false; |
|
52 | } |
|
53 | } |