This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of EC-CUBE |
||
5 | * |
||
6 | * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved. |
||
7 | * |
||
8 | * http://www.lockon.co.jp/ |
||
9 | * |
||
10 | * This program is free software; you can redistribute it and/or |
||
11 | * modify it under the terms of the GNU General Public License |
||
12 | * as published by the Free Software Foundation; either version 2 |
||
13 | * of the License, or (at your option) any later version. |
||
14 | * |
||
15 | * This program is distributed in the hope that it will be useful, |
||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
18 | * GNU General Public License for more details. |
||
19 | * |
||
20 | * You should have received a copy of the GNU General Public License |
||
21 | * along with this program; if not, write to the Free Software |
||
22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||
23 | */ |
||
24 | |||
25 | namespace Eccube\Command; |
||
26 | |||
27 | use Symfony\Component\Console\Input\InputArgument; |
||
28 | use Symfony\Component\Console\Input\InputInterface; |
||
29 | use Symfony\Component\Console\Output\OutputInterface; |
||
30 | use Symfony\Component\Console\Input\InputOption; |
||
31 | use Symfony\Component\Validator\Constraints as Assert; |
||
32 | use Eccube\Command\PluginCommand\PluginGenerator; |
||
33 | use Eccube\Command\PluginCommand\EntityFromDbGenerator; |
||
34 | use Eccube\Command\PluginCommand\EntityFromYamlGenerator; |
||
35 | use Symfony\Component\Console\Helper\QuestionHelper; |
||
36 | use Symfony\Component\Console\Question\Question; |
||
37 | |||
38 | class PluginCommand extends \Knp\Command\Command |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
39 | { |
||
40 | |||
41 | protected $app; |
||
42 | |||
43 | |||
44 | 3 | protected function configure() |
|
45 | { |
||
46 | 3 | $modeDescription = 'mode(install/uninstall/enable/disable/update/reload/generate/entity)'; |
|
47 | 3 | $modeDescription .= PHP_EOL; |
|
48 | 3 | $modeDescription .= 'install [/path_to_tar] - install plugin from tar or zip'; |
|
49 | 3 | $modeDescription .= PHP_EOL; |
|
50 | 3 | $modeDescription .= 'uninstall [plugin_code] - uninstall plugin '; |
|
51 | 3 | $modeDescription .= PHP_EOL; |
|
52 | 3 | $modeDescription .= 'enable [plugin_code] --- enable plugin'; |
|
53 | 3 | $modeDescription .= PHP_EOL; |
|
54 | 3 | $modeDescription .= 'disable [plugin_code] --- disableplugin'; |
|
55 | 3 | $modeDescription .= PHP_EOL; |
|
56 | 3 | $modeDescription .= 'reload [plugin_code] ---- reload plugin'; |
|
57 | 3 | $modeDescription .= PHP_EOL; |
|
58 | 3 | $modeDescription .= 'generate -------------- create plugin skeleton '; |
|
59 | 3 | $modeDescription .= PHP_EOL; |
|
60 | 3 | $modeDescription .= 'entity ---------------- create Entity,Rpository,Migration'; |
|
61 | $this |
||
62 | 3 | ->setName('plugin:develop') |
|
63 | 3 | ->addArgument('mode', InputArgument::REQUIRED, $modeDescription, null) |
|
64 | 3 | ->addOption('path', null, InputOption::VALUE_OPTIONAL, 'path of tar or zip') |
|
65 | 3 | ->addOption('code', null, InputOption::VALUE_OPTIONAL, 'plugin code') |
|
66 | 3 | ->addOption('uninstall-force', null, InputOption::VALUE_OPTIONAL, 'if set true, remove directory') |
|
67 | 3 | ->setDescription('plugin commandline installer.') |
|
68 | 3 | ->setHelp(<<<EOF |
|
69 | 3 | The <info>%command.name%</info> plugin installer runner for developer; |
|
70 | EOF |
||
71 | ); |
||
0 ignored issues
–
show
|
|||
72 | } |
||
73 | |||
74 | protected function getPluginFromCode($pluginCode) |
||
75 | { |
||
76 | return $this->app['eccube.repository.plugin']->findOneBy(array('del_flg' => 0, 'code' => $pluginCode)); |
||
77 | } |
||
78 | |||
79 | 3 | protected function execute(InputInterface $input, OutputInterface $output) |
|
80 | { |
||
81 | 3 | $this->app = $this->getSilexApplication(); |
|
82 | 3 | $this->app->initialize(); |
|
83 | 3 | $this->app->boot(); |
|
84 | |||
85 | 3 | $mode = $input->getArgument('mode'); |
|
86 | |||
87 | //プラグイン作成 |
||
88 | 3 | if ($mode == 'generate') { |
|
89 | 1 | $PluginGenerator = new PluginGenerator($this->app); |
|
90 | 1 | $PluginGenerator->init($this->getHelper('question'), $input, $output); |
|
0 ignored issues
–
show
$this->getHelper('question') of type object<Symfony\Component...Helper\HelperInterface> is not a sub-type of object<Symfony\Component...\Helper\QuestionHelper> . It seems like you assume a concrete implementation of the interface Symfony\Component\Console\Helper\HelperInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
91 | 1 | $PluginGenerator->run(); |
|
92 | 1 | return; |
|
0 ignored issues
–
show
|
|||
93 | } |
||
94 | //プラグインEntity用作成 |
||
95 | 2 | if ($mode == 'entity') { |
|
96 | 2 | $output->writeln(''); |
|
97 | 2 | $Question = new Question('<comment>[entity]How to generate entities from db schema or yaml? [d => db, y => yaml] : </comment>', ''); |
|
98 | 2 | $QuestionHelper = $this->getHelper('question'); |
|
99 | 2 | $value = $QuestionHelper->ask($input, $output, $Question); |
|
100 | 2 | $value = substr(strtolower(trim($value)), 0, 1); |
|
101 | 2 | if ($value == 'd') { |
|
102 | 1 | $PluginEntityGenerator = new EntityFromDbGenerator($this->app); |
|
103 | 1 | $PluginEntityGenerator->init($QuestionHelper, $input, $output); |
|
0 ignored issues
–
show
$QuestionHelper of type object<Symfony\Component...Helper\HelperInterface> is not a sub-type of object<Symfony\Component...\Helper\QuestionHelper> . It seems like you assume a concrete implementation of the interface Symfony\Component\Console\Helper\HelperInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
104 | 1 | $PluginEntityGenerator->run(); |
|
105 | 1 | } elseif ($value == 'y') { |
|
106 | //TODO |
||
107 | 1 | $PluginEntityGenerator = new EntityFromYamlGenerator($this->app); |
|
108 | 1 | $PluginEntityGenerator->init($QuestionHelper, $input, $output); |
|
0 ignored issues
–
show
$QuestionHelper of type object<Symfony\Component...Helper\HelperInterface> is not a sub-type of object<Symfony\Component...\Helper\QuestionHelper> . It seems like you assume a concrete implementation of the interface Symfony\Component\Console\Helper\HelperInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
109 | 1 | $PluginEntityGenerator->run(); |
|
110 | } else { |
||
111 | //入力値正しくない |
||
112 | $output->writeln('Input value is incorrect, please choose [d] for database schema or [y] for yaml file.'); |
||
113 | } |
||
114 | |||
115 | 2 | return; |
|
116 | } |
||
117 | $path = $input->getOption('path'); |
||
118 | $code = $input->getOption('code'); |
||
119 | $uninstallForce = $input->getOption('uninstall-force'); |
||
120 | $service = $this->app['eccube.service.plugin']; |
||
121 | |||
122 | if ($mode == 'install') { |
||
123 | // アーカイブからインストール |
||
124 | if ($path) { |
||
125 | if ($service->install($path)) { |
||
126 | $output->writeln('success'); |
||
127 | |||
128 | return; |
||
129 | } |
||
130 | } |
||
131 | // 設置済ファイルからインストール |
||
132 | if ($code) { |
||
133 | $pluginDir = $service->calcPluginDir($code); |
||
134 | $service->checkPluginArchiveContent($pluginDir); |
||
135 | $config = $service->readYml($pluginDir . '/config.yml'); |
||
0 ignored issues
–
show
|
|||
136 | $event = $service->readYml($pluginDir . '/event.yml'); |
||
0 ignored issues
–
show
|
|||
137 | $service->checkSamePlugin($config['code']); |
||
138 | $service->registerPlugin($config, $event); |
||
139 | |||
140 | $output->writeln('success'); |
||
141 | |||
142 | return; |
||
143 | } |
||
144 | |||
145 | $output->writeln('path or code is required.'); |
||
146 | |||
147 | return; |
||
148 | } |
||
149 | if ($mode == 'update') { |
||
150 | if (empty($code)) { |
||
151 | $output->writeln('code is required.'); |
||
152 | return; |
||
0 ignored issues
–
show
|
|||
153 | } |
||
154 | if (empty($path)) { |
||
155 | $output->writeln('path is required.'); |
||
156 | return; |
||
0 ignored issues
–
show
|
|||
157 | } |
||
158 | $plugin = $this->getPluginFromCode($code); |
||
159 | if ($service->update($plugin, $path)) { |
||
160 | $output->writeln('success'); |
||
161 | return; |
||
0 ignored issues
–
show
|
|||
162 | } |
||
163 | } |
||
164 | |||
165 | if ($mode == 'uninstall') { |
||
166 | if (empty($code)) { |
||
167 | $output->writeln('code is required.'); |
||
168 | return; |
||
0 ignored issues
–
show
|
|||
169 | } |
||
170 | |||
171 | $plugin = $this->getPluginFromCode($code); |
||
172 | |||
173 | // ディレクトリも含め全て削除. |
||
174 | if ($uninstallForce) { |
||
175 | if ($service->uninstall($plugin)) { |
||
176 | $output->writeln('success'); |
||
177 | return; |
||
0 ignored issues
–
show
|
|||
178 | } |
||
179 | |||
180 | return; |
||
181 | } |
||
182 | |||
183 | // ディレクトリは残し, プラグインを削除. |
||
184 | $pluginDir = $service->calcPluginDir($code); |
||
185 | $config = $service->readYml($pluginDir . '/config.yml'); |
||
0 ignored issues
–
show
|
|||
186 | $service->callPluginManagerMethod($config, 'disable'); |
||
187 | $service->callPluginManagerMethod($config, 'uninstall'); |
||
188 | $service->unregisterPlugin($plugin); |
||
189 | |||
190 | $output->writeln('success'); |
||
191 | return; |
||
0 ignored issues
–
show
|
|||
192 | } |
||
193 | |||
194 | if (in_array($mode, array('enable', 'disable'), true)) { |
||
195 | if (empty($code)) { |
||
196 | $output->writeln('code is required.'); |
||
197 | return; |
||
0 ignored issues
–
show
|
|||
198 | } |
||
199 | |||
200 | $plugin = $this->getPluginFromCode($code); |
||
201 | if ($service->$mode($plugin)) { |
||
202 | $output->writeln('success'); |
||
203 | return; |
||
0 ignored issues
–
show
|
|||
204 | } |
||
205 | } |
||
206 | |||
207 | $output->writeln(' mode is not correct, try help for more options'); |
||
208 | $output->writeln(' plugin:develop --help '); |
||
209 | } |
||
210 | |||
0 ignored issues
–
show
|
|||
211 | } |
||
212 |