|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of EC-CUBE |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved. |
|
7
|
|
|
* |
|
8
|
|
|
* http://www.lockon.co.jp/ |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
11
|
|
|
* file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace Eccube\Command; |
|
15
|
|
|
|
|
16
|
|
|
use Symfony\Component\Console\Command\Command; |
|
17
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
18
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
19
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
20
|
|
|
use Symfony\Component\Console\Style\SymfonyStyle; |
|
21
|
|
|
|
|
22
|
|
|
class PluginInstallCommand extends Command |
|
23
|
|
|
{ |
|
24
|
|
|
protected static $defaultName = 'eccube:plugin:install'; |
|
25
|
|
|
|
|
26
|
|
|
use PluginCommandTrait; |
|
27
|
|
|
|
|
28
|
|
|
protected function configure() |
|
29
|
|
|
{ |
|
30
|
|
|
$this |
|
31
|
|
|
->addOption('path', null, InputOption::VALUE_OPTIONAL, 'path of tar or zip') |
|
32
|
|
|
->addOption('code', null, InputOption::VALUE_OPTIONAL, 'plugin code') |
|
33
|
|
|
->addOption('with-composer') |
|
34
|
|
|
->setDescription('Install plugin from local.'); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
38
|
|
|
{ |
|
39
|
|
|
$io = new SymfonyStyle($input, $output); |
|
40
|
|
|
|
|
41
|
|
|
$path = $input->getOption('path'); |
|
42
|
|
|
$code = $input->getOption('code'); |
|
43
|
|
|
$composer = $input->getOption('with-composer'); |
|
44
|
|
|
|
|
45
|
|
|
// アーカイブからインストール |
|
46
|
|
|
if ($path) { |
|
47
|
|
|
if ($this->pluginService->install($path)) { |
|
48
|
|
|
if ($composer) { |
|
49
|
|
|
$this->pluginService->installComposer($code); |
|
50
|
|
|
} |
|
51
|
|
|
$io->success('Installed.'); |
|
52
|
|
|
|
|
53
|
|
|
return 0; |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
// 設置済ファイルからインストール |
|
58
|
|
|
if ($code) { |
|
59
|
|
|
$this->pluginService->installWithCode($code); |
|
60
|
|
|
if ($composer) { |
|
61
|
|
|
$this->pluginService->installComposer($code); |
|
62
|
|
|
} |
|
63
|
|
|
$this->clearCache($io); |
|
64
|
|
|
$io->success('Installed.'); |
|
65
|
|
|
|
|
66
|
|
|
return 0; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
|
|
70
|
|
|
$io->error('path or code is required.'); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|