Skip to content

Commit 9f5edda

Browse files
committed
CleanUp fixes
1 parent 812a3b3 commit 9f5edda

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Service/PhraseApp.php

+7-8
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
use RuntimeException;
1515
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
1616
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
17-
use Symfony\Component\Finder\Finder;
18-
use Symfony\Component\Finder\SplFileInfo;
1917
use Symfony\Component\Translation\MessageCatalogue;
2018
use Symfony\Component\Translation\Writer\TranslationWriter;
2119

@@ -305,13 +303,14 @@ protected function generateTmpPath()
305303

306304
protected function cleanUp()
307305
{
308-
$finder = new Finder();
309-
$files = $finder->files()->name('*.*.yml')->in($this->getTmpPath());
310-
/** @var SplFileInfo $file */
311-
foreach ($files as $file) {
312-
if (false === @unlink($file)) {
313-
$this->logger->warning(strtr('Could not delete the translation file "{file}".', ['{file}' => $file]));
306+
foreach ($this->downloadedLocales as $locale => $files) {
307+
foreach ($files as $file) {
308+
if (false === @unlink($file)) {
309+
$this->logger->warning(strtr('Could not delete the translation file "{file}".', ['{file}' => $file]));
310+
}
314311
}
312+
313+
unset($this->downloadedLocales[$locale]);
315314
}
316315
}
317316
}

0 commit comments

Comments
 (0)