Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand::execute PHP Méthode

execute() protected méthode

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $realCacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
        $oldCacheDir  = $realCacheDir.'_old';

        if (!is_writable($realCacheDir)) {
            throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $realCacheDir));
        }

        if ($input->getOption('no-warmup')) {
            rename($realCacheDir, $oldCacheDir);
        } else {
            $warmupDir = $realCacheDir.'_new';

            $this->warmup($warmupDir);

            rename($realCacheDir, $oldCacheDir);
            rename($warmupDir, $realCacheDir);
        }

        $this->getContainer()->get('filesystem')->remove($oldCacheDir);
    }

Usage Example

 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);
 }
All Usage Examples Of Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand::execute