Skip to content

Commit

Permalink
CleanUp fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nediam committed Feb 9, 2016
1 parent 812a3b3 commit 9f5edda
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Service/PhraseApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
use RuntimeException;
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\Writer\TranslationWriter;

Expand Down Expand Up @@ -305,13 +303,14 @@ protected function generateTmpPath()

protected function cleanUp()
{
$finder = new Finder();
$files = $finder->files()->name('*.*.yml')->in($this->getTmpPath());
/** @var SplFileInfo $file */
foreach ($files as $file) {
if (false === @unlink($file)) {
$this->logger->warning(strtr('Could not delete the translation file "{file}".', ['{file}' => $file]));
foreach ($this->downloadedLocales as $locale => $files) {
foreach ($files as $file) {
if (false === @unlink($file)) {
$this->logger->warning(strtr('Could not delete the translation file "{file}".', ['{file}' => $file]));
}
}

unset($this->downloadedLocales[$locale]);
}
}
}

0 comments on commit 9f5edda

Please sign in to comment.