| @@ 23-55 (lines=33) @@ | ||
| 20 | use Symfony\Component\Console\Output\OutputInterface; |
|
| 21 | use Symfony\Component\Console\Style\SymfonyStyle; |
|
| 22 | ||
| 23 | class PluginSchemaUpdateCommand extends Command |
|
| 24 | { |
|
| 25 | use PluginCommandTrait; |
|
| 26 | ||
| 27 | protected static $defaultName = 'eccube:plugin:schema-update'; |
|
| 28 | ||
| 29 | protected function configure() |
|
| 30 | { |
|
| 31 | $this |
|
| 32 | ->addArgument('code', InputArgument::REQUIRED, 'Plugin code') |
|
| 33 | ->setDescription('Execute plugin schema update.'); |
|
| 34 | } |
|
| 35 | ||
| 36 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 37 | { |
|
| 38 | $io = new SymfonyStyle($input, $output); |
|
| 39 | ||
| 40 | $code = $input->getArgument('code'); |
|
| 41 | ||
| 42 | /** @var Plugin $Plugin */ |
|
| 43 | $Plugin = $this->pluginRepository->findByCode($code); |
|
| 44 | if (!$Plugin) { |
|
| 45 | $io->error("No such plugin `${code}`."); |
|
| 46 | return 1; |
|
| 47 | } |
|
| 48 | ||
| 49 | $config = $this->pluginService->readConfig($this->pluginService->calcPluginDir($code)); |
|
| 50 | $this->pluginService->generateProxyAndUpdateSchema($Plugin, $config); |
|
| 51 | $this->clearCache($io); |
|
| 52 | ||
| 53 | $io->success('Schema Updated.'); |
|
| 54 | } |
|
| 55 | } |
|
| 56 | ||
| @@ 23-56 (lines=34) @@ | ||
| 20 | use Symfony\Component\Console\Output\OutputInterface; |
|
| 21 | use Symfony\Component\Console\Style\SymfonyStyle; |
|
| 22 | ||
| 23 | class PluginUpdateCommand extends Command |
|
| 24 | { |
|
| 25 | protected static $defaultName = 'eccube:plugin:update'; |
|
| 26 | ||
| 27 | use PluginCommandTrait; |
|
| 28 | ||
| 29 | protected function configure() |
|
| 30 | { |
|
| 31 | $this |
|
| 32 | ->addArgument('code', InputArgument::REQUIRED, 'Plugin code') |
|
| 33 | ->setDescription('Execute plugin update process.'); |
|
| 34 | } |
|
| 35 | ||
| 36 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 37 | { |
|
| 38 | $io = new SymfonyStyle($input, $output); |
|
| 39 | ||
| 40 | $code = $input->getArgument('code'); |
|
| 41 | ||
| 42 | /** @var Plugin $Plugin */ |
|
| 43 | $Plugin = $this->pluginRepository->findByCode($code); |
|
| 44 | ||
| 45 | if (!$Plugin) { |
|
| 46 | $io->error("No such plugin `${code}`."); |
|
| 47 | return 1; |
|
| 48 | } |
|
| 49 | ||
| 50 | $config = $this->pluginService->readConfig($this->pluginService->calcPluginDir($code)); |
|
| 51 | $this->pluginService->updatePlugin($Plugin, $config); |
|
| 52 | $this->clearCache($io); |
|
| 53 | ||
| 54 | $io->success('Updated.'); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||