This commit is contained in:
Romain Neutron
2012-04-26 00:55:53 +02:00
parent edbfff226e
commit ade22295ad
631 changed files with 92375 additions and 101763 deletions

View File

@@ -26,20 +26,20 @@ use Symfony\Component\Console\Command\Command;
class module_console_systemClearCache extends Command
{
public function __construct($name = null)
{
parent::__construct($name);
public function __construct($name = null)
{
parent::__construct($name);
$this->setDescription('Empty cache directories, clear Memcached, Redis if avalaible');
$this->setDescription('Empty cache directories, clear Memcached, Redis if avalaible');
return $this;
}
return $this;
}
public function execute(InputInterface $input, OutputInterface $output)
{
$files = $dirs = array();
$finder = new Finder();
$finder
public function execute(InputInterface $input, OutputInterface $output)
{
$files = $dirs = array();
$finder = new Finder();
$finder
->files()
->exclude('.git')
->exclude('.svn')
@@ -48,15 +48,14 @@ class module_console_systemClearCache extends Command
, __DIR__ . '/../../../../tmp/cache_twig/'
));
$count = 1;
foreach ($finder as $file)
{
$files[$file->getPathname()] = $file->getPathname();
$count++;
}
$count = 1;
foreach ($finder as $file) {
$files[$file->getPathname()] = $file->getPathname();
$count ++;
}
$finder = new Finder();
$finder
$finder = new Finder();
$finder
->directories()
->in(array(
__DIR__ . '/../../../../tmp/cache_minify'
@@ -65,31 +64,26 @@ class module_console_systemClearCache extends Command
->exclude('.git')
->exclude('.svn');
foreach ($finder as $file)
{
$dirs[$file->getPathname()] = $file->getPathname();
printf('%4d) %s' . PHP_EOL, $count, $file->getPathname());
$count++;
foreach ($finder as $file) {
$dirs[$file->getPathname()] = $file->getPathname();
printf('%4d) %s' . PHP_EOL, $count, $file->getPathname());
$count ++;
}
foreach ($files as $file) {
unlink($file);
}
foreach ($dirs as $dir) {
rmdir($dir);
}
if (setup::is_installed()) {
$Core = \bootstrap::getCore();
$Core['CacheService']->flushAll();
}
$output->write('Finished !', true);
return 0;
}
foreach ($files as $file)
{
unlink($file);
}
foreach ($dirs as $dir)
{
rmdir($dir);
}
if(setup::is_installed())
{
$Core = \bootstrap::getCore();
$Core['CacheService']->flushAll();
}
$output->write('Finished !', true);
return 0;
}
}