protected function execute(InputInterface $input, OutputInterface $output) { $reset = !$input->getOption('no-reset'); $index = $input->getOption('index'); $type = $input->getOption('type'); $maxTimeExecution = (int) $input->getOption('timeout'); /*if (null === $index && null !== $type) { throw new \InvalidArgumentException('Cannot specify type option without an index.'); }*/ if (null === $index) { throw new \InvalidArgumentException('You must specify an index.'); } $options['slice'] = $input->getOption('batch'); $clearCache = !$input->getOption('no-clear-cache'); //cache needs to be refreshed if ($clearCache) { $kernel = $this->getContainer()->get('kernel'); //cache:clear command is called $command = new CacheClearCommand(); $command->setContainer($this->getContainer()); $ccInput = new ArrayInput(array()); $command->run($ccInput, new NullOutput()); $args = array_merge(array('php', $kernel->getRootDir() . DIRECTORY_SEPARATOR . '../app/console', 'nemrod:elastica:populate', '--no-clear-cache')); if ($options['slice']) { $args[] = "--batch=" . $options['slice']; } if ($index) { $args[] = '--index=' . $index; } if ($type) { $args[] = '--type=' . $type; } $pb = new ProcessBuilder($args); $process = $pb->getProcess(); $process->setTimeout($maxTimeExecution); // run & transfer output to current output $process->run(function ($type, $buffer) use($output) { $output->writeln($buffer); }); if (!$process->isSuccessful()) { throw new \RuntimeException($process->getErrorOutput()); } exit; } $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); $this->getContainer()->get('nemrod.elastica.populator')->populate($index, $type, $reset, $options, $output); }
public function execute(InputInterface $input, OutputInterface $output) { $memory = '1024'; if ($input->getOption("memory_limit")) { $memory = $input->getOption("memory_limit"); } ini_set("memory_limit", $memory . "M"); parent::execute($input, $output); $container = $this->getContainer(); $cacheDir = $container->getParameter('kernel.cache_dir'); $chmod = $container->getParameter('skillberto_console_extend.chmod'); /** @var Filesystem $fs */ $fs = $container->get('filesystem'); $fs->chmod($cacheDir, $chmod, 00, true); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $nullOutput = new NullOutput(); $io = new SymfonyStyle($input, $output); /** @var KernelInterface $kernel */ $kernel = $this->getContainer()->get('kernel'); $context = $this->getContainer()->getParameter('sulu.context'); $io->comment(sprintf('Clearing the <info>%s cache</info> for the <info>%s</info> environment with debug <info>%s</info>', $context, $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); parent::execute($input, $nullOutput); $io->success(sprintf('%s cache for the "%s" environment (debug=%s) was successfully cleared.', ucfirst($context), $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); if (SuluKernel::CONTEXT_ADMIN === $context) { /** @var KernelFactoryInterface $kernelFactory */ $kernelFactory = $this->getContainer()->get('sulu_preview.preview.kernel_factory'); $previewKernel = $kernelFactory->create($kernel->getEnvironment()); // set preview container $this->setContainer($previewKernel->getContainer()); $io->comment(sprintf('Clearing the <info>preview cache</info> for the <info>%s</info> environment with debug <info>%s</info>', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); parent::execute($input, $nullOutput); $io->success(sprintf('Preview cache for the "%s" environment (debug=%s) was successfully cleared.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); } }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $this->saveParameterAssets(); }