瀏覽代碼

merged branch weaverryan/cache_clear_env_info (PR #1921)

Commits
-------

6738d2b [FrameworkBundle] Adding information about exactly which cache is being cleared.

Discussion
----------

[FrameworkBundle] Adding information about env being cleared

Hey guys!

I think the `cache:clear` confuses some people - they're expecting it to wipe out any and all cache (not just the cache for a specific env+debug mode). So, this adds details on *what* is being cleared, which should at least help.

I'll also put more information into the docs.

Thanks!

---------------------------------------------------------------------------

by jmikola at 2011/08/07 18:48:48 -0700

:+1: on dumping the environment at output. Does the debug option mean anything in this context, though?

---------------------------------------------------------------------------

by weaverryan at 2011/08/07 19:57:18 -0700

I can't think of a spot where it makes a difference, but of course it *could* theoretically make a difference. The command's "help" message seems to indicate that it should be treated like there's a difference, so I followed suit.

But yes, environment is the big concern, hopefully nobody gets too hung up on the debug - one of those things where I think we technically need it, but practically don't.

---------------------------------------------------------------------------

by brikou at 2011/08/08 00:44:00 -0700

@weaverryan it would also be interesting to display the env used also for router:debug and probably other commands

---------------------------------------------------------------------------

by stof at 2011/08/08 01:13:58 -0700

@weaverryan It does make a difference when warùing up the cache (which is done by default when clearing it): many service definitions change according to the debug flag, so dumping the debug container seems a weird idea (the first request will need to dump the non-debug container as they have different names). But bigger issue: some cache warmer depend of the debug state (the Doctrine one IIRC) so the warming-up would do weird things if you run the prod CLI in debug mode.
Fabien Potencier 13 年之前
父節點
當前提交
06517b9139
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

+ 3 - 0
src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

@@ -61,6 +61,9 @@ EOF
             throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $realCacheDir));
         }
 
+        $kernel = $this->getContainer()->get('kernel');
+        $output->writeln(sprintf('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
+
         if ($input->getOption('no-warmup')) {
             rename($realCacheDir, $oldCacheDir);
         } else {