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 May 2, 2016
1 parent 1128ab4 commit a0c400e
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,10 +81,13 @@ public function nodeClosed(Latte\MacroNode $node)
*/
public static function initRuntime(Latte\Template $template, $global)
{
if (!empty($global->caches) && $template->getEngine()->getLoader() instanceof Latte\Loaders\FileLoader) {
end($global->caches)->dependencies[Nette\Caching\Cache::FILES][] = $template->getName();
if (!empty($global->caches)) {
$file = (new \ReflectionClass($template))->getFileName();
if (@is_file($file)) { // @ - may trigger error
end($global->caches)->dependencies[Cache::FILES][] = $file;
}
}
}


/**
Expand Down

0 comments on commit a0c400e

Please sign in to comment.