From 8390991d6c8ef00b876c1a6e411676b44529242b Mon Sep 17 00:00:00 2001 From: Christian Morgan Date: Thu, 15 Aug 2013 14:21:20 +0100 Subject: [PATCH 1/2] Added sleep() workaround for windows php rename bug For more info see links in issue #8766 --- src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index f84b4665ee91e..e24483e34af60 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -83,6 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers')); $filesystem->rename($realCacheDir, $oldCacheDir); + sleep(1); // workaround for windows php rename bug $filesystem->rename($warmupDir, $realCacheDir); } From ddae077cb85202be9ce4674e1b2dc628fa5fa7d1 Mon Sep 17 00:00:00 2001 From: Christian Morgan Date: Thu, 15 Aug 2013 14:28:42 +0100 Subject: [PATCH 2/2] Added check for windows before implementing sleep() workaround --- .../Bundle/FrameworkBundle/Command/CacheClearCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index e24483e34af60..d384659259988 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -83,7 +83,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers')); $filesystem->rename($realCacheDir, $oldCacheDir); - sleep(1); // workaround for windows php rename bug + if (defined('PHP_WINDOWS_VERSION_BUILD')) { + sleep(1); // workaround for windows php rename bug + } $filesystem->rename($warmupDir, $realCacheDir); }