Skip to content

Commit

Permalink
skip when old plugins translations directory doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
takeit committed Nov 5, 2014
1 parent f45b32c commit 718bbdf
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,15 @@ public function onRequest(GetResponseEvent $event)
if ($this->cacheService->contains($cacheKey)) {
$files = $this->cacheService->fetch($cacheKey);
} else {
$dir = __DIR__.'/../../../../plugins/*/admin-files/translations';
if (!file_exists($dir)) {
return;
}

$finder = new Finder();
$extension = $locale.'.yml';
$files = array();

$finder->files()->in($dir);
$finder->files()->name('*.'.$locale.'.yml');
try {
$finder->files()->in( __DIR__.'/../../../../plugins/*/admin-files/translations');
$finder->files()->name('*.'.$locale.'.yml');
} catch (\InvalidArgumentException $e) {
return;
}

foreach ($finder as $file) {
$domain = substr($file->getFileName(), 0, -1 * strlen($extension) - 1);
Expand Down

0 comments on commit 718bbdf

Please sign in to comment.