* * Date: 2014-06-06 * Time: 17:00 */ class ModuleRefreshCommand extends ContainerAwareCommand { protected function configure() { $this ->setName('module:refresh') ->setDescription('Refresh modules list'); } protected function execute(InputInterface $input, OutputInterface $output) { try { $moduleManagement = new ModuleManagement; $moduleManagement->updateModules(); } catch (\Exception $e) { throw new \RuntimeException(sprintf('Refresh modules list fail with Exception : [%d] %s', $e->getCode(), $e->getMessage())); } if (method_exists($output, 'renderBlock')) { $output->renderBlock([ '', 'Modules list successfully refreshed', '' ], 'bg=green;fg=black' ); } } }