diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
index 10732f2b5d..b96aab28d9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
@@ -34,3 +34,5 @@ CHANGELOG
declares how long a cookie can be stored on the remote client.
* Removed 'auto_start' configuration parameter from session config. The session will
start on demand.
+ * Commands cache:warmup and cache:clear (unless --no-warmup is specified) now
+ create the class cache.
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
index a9aa7a5b8f..9a86c75a3e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
+use Symfony\Component\ClassLoader\ClassCollectionLoader;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -63,7 +64,8 @@ EOF
}
$kernel = $this->getContainer()->get('kernel');
- $output->writeln(sprintf('Clearing the cache for the %s environment with debug %s', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
+ $debug = $kernel->isDebug();
+ $output->writeln(sprintf('Clearing the cache for the %s environment with debug %s', $kernel->getEnvironment(), var_export($debug, true)));
$this->getContainer()->get('cache_clearer')->clear($realCacheDir);
@@ -76,11 +78,21 @@ EOF
rename($realCacheDir, $oldCacheDir);
rename($warmupDir, $realCacheDir);
+
+ $this->createClassCache($realCacheDir, $debug);
}
$this->getContainer()->get('filesystem')->remove($oldCacheDir);
}
+ protected function createClassCache($cacheDir, $debug)
+ {
+ $classmap = $cacheDir.'/classes.map';
+ if (is_file($classmap)) {
+ ClassCollectionLoader::load(include($classmap), $cacheDir, 'classes', $debug, false, '.php');
+ }
+ }
+
protected function warmup($warmupDir, $enableOptionalWarmers = true)
{
$this->getContainer()->get('filesystem')->remove($warmupDir);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php
index e997e55df7..11594764ff 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
+use Symfony\Component\ClassLoader\ClassCollectionLoader;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -56,6 +57,12 @@ EOF
$warmer->enableOptionalWarmers();
}
- $warmer->warmUp($this->getContainer()->getParameter('kernel.cache_dir'));
+ $cacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
+ $warmer->warmUp($cacheDir);
+
+ $classmap = $cacheDir.'/classes.map';
+ if (is_file($classmap)) {
+ ClassCollectionLoader::load(include($classmap), $cacheDir, 'classes', $kernel->isDebug(), false, '.php');
+ }
}
}