Skip to content
This repository has been archived by the owner on Apr 21, 2018. It is now read-only.

Commit

Permalink
Merge pull request #3 from Seldaek/patch-3
Browse files Browse the repository at this point in the history
Avoid reloading from the written cache in debug mode
  • Loading branch information
dominikzogg committed Apr 28, 2016
2 parents c377284 + bac546d commit 743afd0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Provider/TranslationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ function (Translator $translator) use ($container) {

$cacheFile = $container['translation_cache'] . '/saxulum-translation.php';
if ($container['debug'] || !file_exists($cacheFile)) {
$translationMap = $container['translation_search']();
file_put_contents(
$cacheFile,
'<?php return ' . var_export($container['translation_search'](), true) . ';'
'<?php return ' . var_export($translationMap, true) . ';'
);
} else {
$translationMap = require $cacheFile;
}

$translationMap = require $cacheFile;
} else {
$translationMap = $container['translation_search']();
}
Expand Down

0 comments on commit 743afd0

Please sign in to comment.