Skip to content

Commit

Permalink
CacheMacro: improved dependency on files
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 30, 2016
1 parent 2b44c12 commit 0aed862
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Bridges/CacheLatte/CacheMacro.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ public function nodeClosed(Latte\MacroNode $node)
*/
public static function initRuntime(Latte\Template $template)
{
if (!empty($template->global->caches) && $template->getEngine()->getLoader() instanceof Latte\Loaders\FileLoader) {
end($template->global->caches)->dependencies[Nette\Caching\Cache::FILES][] = $template->getName();
if (!empty($template->global->caches)) {
$file = (new \ReflectionClass($template))->getFileName();
if (@is_file($file)) { // @ - may trigger error
end($template->global->caches)->dependencies[Cache::FILES][] = $file;
}
}
}

Expand Down

0 comments on commit 0aed862

Please sign in to comment.